set.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <!-- 商户信息添加|修改 -->
  3. <div class="merchantSetPage flex-col">
  4. <s-header :name="$t('merchantManage.merchantInformation')" :noback="false"></s-header>
  5. <div class="merchantSetBox">
  6. <div class="Body flex-col">
  7. <div class="Body flex-col">
  8. <div class="wrap1 flex-col">
  9. <div class="section1 flex-row justify-between">
  10. <span class="word3" :class="{ acttive: tabType === '0' }" @click="tabType = '0'">{{
  11. $t('merchantManage.essentialInformation') }}</span>
  12. <span class="info1" :class="{ acttive: tabType === '1' }" @click="tabType = '1'">{{
  13. $t('merchantManage.withdrawalData') }}</span>
  14. </div>
  15. <!-- <div class="section2 flex-col"></div> -->
  16. <img class="img1" referrerpolicy="no-referrer"
  17. src="https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPng8947935ab81635fdedd8124b11e305eef66286421b69c84fef22233014a3fa9a" />
  18. </div>
  19. <div v-if="tabType === '0'">
  20. <!-- <div class="wrap2 l-flex-RC">
  21. <span class="info2">*</span>
  22. <span class="info3">{{ $t('merchantManage.region') }}:
  23. </span>
  24. </div> -->
  25. <!-- <span class="info5">{{ $t('merchantManage.subscriptionAdministrator') }}:</span> -->
  26. <van-form @submit="onSubmit">
  27. <div class="van-cell van-field">
  28. <div class="van-cell__title van-field__label"><span>{{ $t('merchantManage.accountNumber') }}</span>
  29. </div>
  30. <div class="van-field__value o-pt-8" style="text-align: left;">
  31. <span> {{ adminObj.username }}</span>
  32. </div>
  33. </div>
  34. <van-field v-model="adminObj.name" name="password" :label="$t('merchantManage.fullNameLabel')"
  35. :placeholder="$t('merchantManage.fullNamePlaceholder')"
  36. :rules="[{ required: true, message: $t('merchantManage.fullNamePlaceholder') }]" />
  37. <van-field v-model="adminObj.password" name="password" type="password"
  38. :label="$t('merchantManage.passwordLabel')" :placeholder="$t('merchantManage.passwordPlaceholder')" />
  39. <span class="txt3">{{ $t('merchantManage.leavBlanToIndiNoModi') }}</span>
  40. <van-field v-model="adminObj.checkPassword" name="password" type="password"
  41. :label="$t('merchantManage.confirmPasswordLabel')"
  42. :placeholder="$t('merchantManage.confirmPasswordPlaceholder')" />
  43. <van-field v-model="adminObj.email" name="password" :label="$t('merchantManage.mailbox')"
  44. :placeholder="$t('merchantManage.mailboxPlaceholder')" />
  45. <van-field v-model="adminObj.phone" name="password" :label="$t('merchantManage.telephone')"
  46. :placeholder="$t('merchantManage.telephonePlaceholder')" />
  47. <van-field v-model="adminObj.tradeMerchantNo" name="password"
  48. :label="$t('merchantManage.merchantFilingNumberLabel')"
  49. :placeholder="$t('merchantManage.merchantFilingNumberPlaceholder')" />
  50. <div class="van-cell van-field">
  51. <div class="van-cell__title van-field__label"><span>{{ $t('merchantManage.domesticOrNot') }}:</span></div>
  52. <div class="van-cell__value van-field__value radioBox">
  53. <van-radio-group v-model="adminObj.ifForeign" direction="horizontal">
  54. <van-radio name="0" icon-size="18px">{{ $t('merchantManage.yes') }}</van-radio>
  55. <van-radio name="1" icon-size="18px">{{ $t('merchantManage.no') }}</van-radio>
  56. </van-radio-group>
  57. </div>
  58. </div>
  59. <div v-if="adminType === 0 || adminType === 1">
  60. <div class="van-cell van-field">
  61. <div class="van-cell__title van-field__label"><span>{{ $t('merchantManage.discountCode') }}</span>
  62. </div>
  63. <div class="van-cell__value van-field__value radioBox">
  64. <van-radio-group v-model="adminObj.promoCodeOpen" direction="horizontal">
  65. <van-radio name="0" icon-size="18px">{{ $t('merchantManage.yes') }}</van-radio>
  66. <van-radio name="1" icon-size="18px">{{ $t('merchantManage.no') }}</van-radio>
  67. </van-radio-group>
  68. </div>
  69. </div>
  70. <div class="van-cell van-field">
  71. <div class="van-cell__title van-field__label"><span>{{ $t('merchantManage.paymentPlatform') }}</span>
  72. </div>
  73. <div class="van-cell__value van-field__value radioBox">
  74. <van-radio-group v-model="adminObj.payPlatform" direction="horizontal">
  75. <van-radio name="0" icon-size="18px">{{ $t('merchantManage.convergence') }}</van-radio>
  76. <van-radio name="1" icon-size="18px">{{ $t('merchantManage.huifuPaymnt') }}</van-radio>
  77. </van-radio-group>
  78. </div>
  79. </div>
  80. </div>
  81. <van-row justify="space-around" style="padding: 1em;">
  82. <van-button span="5" round type="primary" style="height: 2em; padding: 0 2em;" native-type="submit">{{
  83. $t('merchantManage.modificationSubmission') }}
  84. </van-button>
  85. </van-row>
  86. </van-form>
  87. </div>
  88. <div v-if="tabType === '1'" class="tab2">
  89. <div class="kBordBott o-w o-pb-10">
  90. <span class="info3">{{ $t('merchantManage.merchantType') }}:{{ adminMchObj.altMerchantType == 10 ? "个人" :
  91. (adminMchObj.altMerchantType == 12 ? "企业" : "") }}</span>
  92. <span class="info4">{{ $t('merchantManage.contactName') }}:{{ adminMchObj.busiContactName }}</span>
  93. <span class="word4">{{ $t('merchantManage.cellPhone') }}:{{ adminMchObj.busiContactMobileNo }}</span>
  94. </div>
  95. <div class="kBordBott o-w o-pb-10">
  96. <span class="txt2">{{ $t('merchantManage.nameOfLegalPerson/Individual') }}:{{ adminMchObj.legalPerson
  97. }}</span>
  98. <span class="word5">{{ $t('merchantManage.phoneNumberOfLegalPerson/Individual') }}:{{ adminMchObj.phoneNo
  99. }}</span>
  100. <span class="word6">{{ $t('merchantManage.legalPerson/IndividualIDNumber') }}:{{ adminMchObj.idCardNo
  101. }}</span>
  102. <span class="txt3">{{ $t('merchantManage.validityOfIDCard') }}:{{ adminMchObj.idCardExpiry }}</span>
  103. <span v-if="adminMchObj.altMerchantType == 12" class="txt4">{{ $t('merchantManage.businessLicenseCode')
  104. }}:{{ adminMchObj.licenseNo }}</span>
  105. <span v-if="adminMchObj.altMerchantType == 12" class="word7">{{
  106. $t('merchantManage.validityOfBusinessLicense') }}:{{ adminMchObj.licenseExpiry
  107. }}</span>
  108. <span class="txt5">{{ $t('merchantManage.natureOfBusiness') }}:{{ adminMchObj.manageScope }}</span> <span
  109. class="word8">{{ $t('merchantManage.businessAddress') }}:{{ adminMchObj.manageAddr }}</span>
  110. </div>
  111. <div class="block5 flex-row justify-between">
  112. <span class="txt6">{{ $t('merchantManage.accountType') }}
  113. :{{ adminMchObj.bankAccountType === 1 ? $t('merchantManage.debitCard') : (adminMchObj.bankAccountType === 4
  114. ? $t('merchantManage.corporateAccount') : "") }}</span>
  115. <!-- <span class="word9"></span> -->
  116. </div>
  117. <span class="word10">{{ $t('merchantManage.bankAccountName') }}:{{ adminMchObj.bankAccountName }}</span>
  118. <span class="word11">{{ $t('merchantManage.bankAccount') }}:{{ adminMchObj.bankAccountNo }}</span>
  119. <span v-if="adminMchObj.bankAccountType == 4" class="word12">{{ $t('merchantManage.bankNo') }}:{{
  120. adminMchObj.bankChannelNo }}</span>
  121. <div v-if="adminType < 2">
  122. <span class="word12">{{ $t('merchantManage.joinpayMch') }}:{{ adminMchObj.signStatus == '签约成功' ?
  123. adminMchObj.signStatus : '未签约' }}</span>
  124. <span class="word12">{{ $t('merchantManage.huifuMch') }}:{{ huifuMchObj.status == '2' ? '签约成功' : '未签约' }}</span>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. </div>
  131. </template>
  132. <script>
  133. import { onMounted, ref } from "vue";
  134. import sHeader from "@/components/SimpleHeader";
  135. import { getAdmin, getAdminMch, updateAdmin, getHuifuMch } from "@/service/merchantManage";
  136. import { showFailToast, showSuccessToast } from "vant";
  137. import { useRoute } from "vue-router";
  138. import { getLoginUser, styleUrl } from "@/common/js/utils";
  139. import { useI18n } from "vue-i18n";
  140. export default {
  141. components: { sHeader },
  142. setup() {
  143. // 引入语言
  144. const { t } = useI18n();
  145. const tabType = ref('0');
  146. const user = getLoginUser();
  147. const adminType = ref(user.type);
  148. const route = useRoute();
  149. const merchantId = ref('');
  150. const adminObj = ref({});
  151. const adminMchObj = ref({});
  152. const huifuMchObj = ref({});
  153. const ifForeign = ref('0');
  154. onMounted(async () => {
  155. // 加载样式
  156. styleUrl('merchantManage');
  157. merchantId.value = route.query.merchantId;
  158. getAdminFun();
  159. console.log(ifForeign.value);
  160. getAdminMchFun();
  161. getHuifuMchFun();
  162. });
  163. const getAdminFun = async () => {
  164. const { data } = await getAdmin({ id: merchantId.value });
  165. if (data.code === "00000") {
  166. adminObj.value = data.data;
  167. adminObj.value.password = '';
  168. adminObj.value.checkPassword = '';
  169. if (data.data.payPlatform == null) {
  170. adminObj.value.payPlatform = '0';
  171. }
  172. if (data.data.promoCodeOpen == null) {
  173. adminObj.value.promoCodeOpen = '1';
  174. }
  175. ifForeign.value = data.data.ifForeign;
  176. } else { showFailToast(data.message); }
  177. console.log('getAdminFun', data);
  178. };
  179. const getAdminMchFun = async () => {
  180. const { data } = await getAdminMch({ id: merchantId.value });
  181. if (data.code === "00000") { adminMchObj.value = data.data; } else { showFailToast(data.message); }
  182. console.log('getAdminMchFun', data);
  183. console.log('adminMchObj', adminMchObj.value.signStatus);
  184. }
  185. const getHuifuMchFun = async () => {
  186. const { data } = await getHuifuMch({ adminId: merchantId.value });
  187. if (data.code === "00000") { huifuMchObj.value = data.data; } else { showFailToast(data.message); }
  188. console.log('getHuifuMchFun', data);
  189. }
  190. const onSubmit = async () => {
  191. const params = {
  192. id: adminObj.value.id,
  193. name: adminObj.value.name,
  194. username: adminObj.value.username,
  195. ifForeign: adminObj.value.ifForeign,
  196. phone: adminObj.value.phone,
  197. email: adminObj.value.email,
  198. tradeMerchantNo: adminObj.value.tradeMerchantNo,
  199. };
  200. if (adminType.value === 0 || adminType.value === 1) {
  201. params.promoCodeOpen = adminObj.value.promoCodeOpen;
  202. params.applyStartTime = adminObj.value.applyStartTime;
  203. params.applyEndTime = adminObj.value.applyEndTime;
  204. params.payPlatform = adminObj.value.payPlatform;
  205. }
  206. if (adminObj.value.password !== '') {
  207. if (adminObj.value.checkPassword === '') { showFailToast(t('merchantManage.confirmPasswordPlaceholder')); return; }
  208. if (adminObj.value.password === adminObj.value.checkPassword) {
  209. params.password = adminObj.value.password;
  210. } else {
  211. showFailToast(t('merchantManage.theTwoPasswordsAreDifferent'));
  212. }
  213. }
  214. const { data } = await updateAdmin(params);
  215. if (data.code === "00000") {
  216. showSuccessToast(t('merchantManage.modificationSucceeded'));
  217. setTimeout(() => {
  218. // router.go(0);
  219. getAdminFun();
  220. }, 1500);
  221. } else { showFailToast(data.message); }
  222. console.log('onSubmit', data);
  223. }
  224. return {
  225. tabType,
  226. adminType,
  227. adminObj,
  228. adminMchObj,
  229. huifuMchObj,
  230. onSubmit
  231. };
  232. },
  233. };
  234. </script>
  235. <style lang="less" scoped>
  236. @import "../../common/style/common.less";
  237. @import "../../styles/merchantManage/index.less";
  238. </style>