settled.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174
  1. <template>
  2. <view>
  3. <cu-custom :bgColor="title == '申请入驻' ? 'bg-gradual-blue1' : 'bg-fff'" :isBack="true">
  4. <block slot="content">{{ title }}</block>
  5. </cu-custom>
  6. <view class="progress" v-if="title == '申请入驻'">
  7. <view class="progress-style progress-bag">
  8. <view v-if="tab == 1" class="progress-icon"></view>
  9. <view v-if="tab == 2" class="progress-style progress-bag1">
  10. <view class="progress-icon1"></view>
  11. </view>
  12. <view v-if="tab == 3" class="progress-style progress-bag2">
  13. <view class="progress-icon1"></view>
  14. </view>
  15. </view>
  16. <view class="progress-title flex justify-between">
  17. <view :class="tab == '1' ? 'color' : ''">账户信息</view>
  18. <view :class="tab == '2' ? 'color' : ''">提交资料</view>
  19. <view :class="tab == '3' ? 'color' : ''">门店信息</view>
  20. </view>
  21. </view>
  22. <status v-else :status="form.status" :updateTime="form.updateTime" :remark="form.remark"></status>
  23. <view v-if="tab == 1" :class="title == '申请入驻'?'tab-top':''">
  24. <form>
  25. <view class="borderRadiu" v-if="title == '申请入驻' && loginType == 3">
  26. <view class="flex cu-form-group margin-top1 ">
  27. <view class="content ">
  28. <text class="text-bold">推荐人邀请码</text>
  29. <i class="text-bg "></i>
  30. </view>
  31. </view>
  32. <view class=" cu-form-group ">
  33. <view class="title"> <span>*</span> 邀请码</view>
  34. <input placeholder="输入邀请码(选填)" v-model="form.referenceCode" name="input"
  35. :disabled="referenceCodeDisable"></input>
  36. </view>
  37. </view>
  38. <view class="borderRadiu" style="height: 67vh;overflow-y: auto;">
  39. <view class="flex cu-form-group margin-top1">
  40. <view class="content ">
  41. <text class="text-bold">提交经营主体资料</text>
  42. <i class="text-bg"></i>
  43. </view>
  44. </view>
  45. <view class="customize">
  46. <view class="title" style="text-align: center;">营业执照</view>
  47. <view style="border-bottom: 1px solid #EEEEEE;">
  48. <view class="business-img flex align-center">
  49. <image :src="businessLicenseImg ? businessLicenseImg : '/static/login/yingyezhizhao.png'" mode=""
  50. @click="businessChange('businessLicense')">
  51. </image>
  52. </view>
  53. </view>
  54. <view class="business-prompt">
  55. 请上传营业执照照片或复印件,复印件需加盖公司公章,仅支持jpg、png格式;图片需清晰、完整、无反光、无PS、无不相关水印、非拍屏
  56. </view>
  57. </view>
  58. <view class=" cu-form-group">
  59. <view class="title">主体类型</view>
  60. <view style="display: flex;width: 74%;justify-content: space-between;" @click="showSelectLocality = true">
  61. <view style="font-size: 30rpx;">
  62. <text v-if="typeLabel"> {{ typeLabel }}</text>
  63. <text v-else style="color: grey">请选择主体类型</text>
  64. </view>
  65. <u-icon name="arrow-right" style="margin-left: 17rpx;color: #C7C6CA"></u-icon>
  66. </view>
  67. <!-- <u-select v-model="showSelectLocality" :list="selectLocality" @confirm="confirmLocality"></u-select> -->
  68. </view>
  69. <view class="cu-form-group">
  70. <view class="title">公司名称</view>
  71. <input placeholder="请输入公司名称" v-model="form.corporateName" name="input"></input>
  72. </view>
  73. <view class="cu-form-group">
  74. <view class="title">统一代码</view>
  75. <input placeholder="请输入统一社会信用代码" v-model="form.creditCode" name="input"></input>
  76. </view>
  77. <view class="cu-form-group">
  78. <view class="title">证件期限 </view>
  79. <!-- <uni-data-checkbox v-model="form.lifespan" :localdata="lifespanOption"></uni-data-checkbox> -->
  80. <radio-group @change="typeChang($event, 'lifespanType')" v-model="form.lifespanType">
  81. <label class="margin-left-sm">
  82. <radio :class="form.lifespanType == '1' ? 'checked blue' : ''"
  83. :checked="form.lifespanType == '1' ? true : false" value="1"></radio>
  84. <!-- <checkbox class=' blue' :class="form.type?'checked':''" :checked="form.type?true:false" value="1"></checkbox> -->
  85. <text class="margin-left-sm">长期有效</text>
  86. </label>
  87. <label class="margin-left-sm">
  88. <radio :class="form.lifespanType == '2' ? 'checked blue' : ''"
  89. :checked="form.lifespanType == '2' ? true : false" value="2"></radio>
  90. <text class="margin-left-sm">固定期限</text>
  91. </label>
  92. </radio-group>
  93. </view>
  94. <view class="cu-form-group" v-if="form.lifespanType == 2">
  95. <view class="title">有效期起</view>
  96. <view style="display: flex;width: 74%;justify-content: space-between;" @click="selectDate">
  97. <view style="font-size: 30rpx;">
  98. <text v-if="form.lifespanBegin"> {{ form.lifespanBegin }}--{{form.lifespanEnd}}</text>
  99. <text v-else style="color: grey">请选择</text>
  100. </view>
  101. <u-icon name="arrow-right" style="margin-left: 17rpx;color: #C7C6CA"></u-icon>
  102. </view>
  103. <rangTime ref="rangTime" :mode="mode" @onSubmit="onEndTimeChange" />
  104. </view>
  105. <view class="cu-form-group" style="display: block;">
  106. <view class="title">经营范围</view>
  107. <view class="scope" style="width: 100%;height: auto;">
  108. <u-input v-model="form.businessScope" type="textarea"
  109. style="width: 100%;min-height: 165rpx;max-height: 300rpx; background-color:#F7F8FC;padding: 0 16rpx;margin: 0;overflow-y: auto;" />
  110. </view>
  111. </view>
  112. </view>
  113. </form>
  114. </view>
  115. <view v-if="tab == 2" :class="title=='申请入驻'?'tab-top':''" :style="title == '店铺信息' ? 'margin-top: 120upx' : ''">
  116. <form>
  117. <view class="borderRadiu">
  118. <view class="flex cu-form-group margin-top1 ">
  119. <view class="content ">
  120. <text class="text-bold">法人信息</text>
  121. <i class="text-bg "></i>
  122. </view>
  123. </view>
  124. <view class="cu-form-group ">
  125. <view class="title">法人姓名</view>
  126. <input placeholder="请输入法人姓名" v-model="form.legalPerson" name="input"></input>
  127. </view>
  128. <view class="cu-form-group">
  129. <view class="title">法人证件号</view>
  130. <input placeholder="请输入法人证件号" v-model="form.legalPersonCode" name="input"></input>
  131. </view>
  132. <view class="customize">
  133. <view class="title">法人证件照片</view>
  134. <view style="padding: 16upx 0;border-bottom: 1px solid #EEEEEE;">
  135. <view class="flex upload justify-between">
  136. <view class="imgOcr-border">
  137. <image :src="identityOneImg ? identityOneImg : '/static/login/code1.png'" mode=""
  138. @click="businessChange('identityOne')"></image>
  139. </view>
  140. <view class="imgOcr-border">
  141. <image :src="identityTwoImg ? identityTwoImg : '/static/login/code2.png'" mode=""
  142. @click="businessChange('identityTwo')"></image>
  143. </view>
  144. </view>
  145. </view>
  146. <view class="business-prompt">
  147. <view>请上传中国大陆公民.身份证照片,仅支持jpg、png格式</view>
  148. <view>1、需提供与主体证照上一致的法人证件照片</view>
  149. <view>2、图片需清晰、完整、无反光、无PS、无不相关水印、非拍屏</view>
  150. <view>3、证件未过期</view>
  151. </view>
  152. </view>
  153. </view>
  154. </form>
  155. </view>
  156. <view v-if="tab == 3" :class="title == '申请入驻'?'tab-top':''" :style="title == '店铺信息' ? 'margin-top: 120upx' : ''">
  157. <form>
  158. <view class="borderRadiu">
  159. <view class="flex cu-form-group margin-top1">
  160. <view class="content ">
  161. <text class="text-bold">提交门店信息</text>
  162. <i class="text-bg "></i>
  163. </view>
  164. </view>
  165. <view class="cu-form-group">
  166. <view class="title">门店名称</view>
  167. <input placeholder="请输入门店名称" v-model="form.storeName" name="input"></input>
  168. </view>
  169. <view class="cu-form-group">
  170. <view class="title">所在地区</view>
  171. <view style="display: flex;width: 74%;justify-content: space-between;" @click="$refs.picker.show()">
  172. <view style="font-size: 30rpx;">
  173. <text v-if="form.locality"> {{ form.locality }}</text>
  174. <text v-else style="color: grey">请选择所在地区</text>
  175. </view>
  176. <u-icon name="arrow-right" style="margin-left: 17rpx;color: #C7C6CA"></u-icon>
  177. </view>
  178. </view>
  179. <view class="cu-form-group">
  180. <view class="title">门店地址</view>
  181. <input placeholder="请输入门店地址详细地址" v-model="form.address" name="input"></input>
  182. </view>
  183. <view class="cu-form-group">
  184. <view class="title">店铺面积</view>
  185. <input placeholder="请输入店铺面积" style="width: 200rpx !important;" v-model="form.storeExtent"
  186. name="input"></input>㎡
  187. </view>
  188. <view class=" booder-top" style="padding-bottom: 16upx" :style="{ display: mapIsHidden }"
  189. @click="selectAddress">
  190. <tdmap :allowSelection="false" :showCoordinates="false" :key="mapKey"></tdmap>
  191. </view>
  192. </view>
  193. <view class="borderRadiu">
  194. <view class="flex cu-form-group margin-top1">
  195. <view class="content ">
  196. <text class="text-bold">提交门店负责人信息</text>
  197. <i class="text-bg "></i>
  198. </view>
  199. </view>
  200. <view class="cu-form-group">
  201. <view class="title">姓名</view>
  202. <input placeholder="门店负责人姓名" v-model="form.leaderName" name="input"></input>
  203. </view>
  204. <view class="cu-form-group">
  205. <view class="title">手机号</view>
  206. <input placeholder="门店负责人手机号" v-model="form.leaderPhone" name="input"></input>
  207. </view>
  208. </view>
  209. </form>
  210. </view>
  211. <view v-if="tab == 1" class="padding flex flex-direction sub-bottom">
  212. <button class="cu-btn bg-blue round " @click="tab = 2">下一步</button>
  213. </view>
  214. <view v-if="tab == 2 && title == '申请入驻'" class="padding flex sub-bottom">
  215. <button class="cu-btn round line-blue shadow" @click="tab = 1">上一步</button>
  216. <button style="margin-left: 12upx;width:77%" class="cu-btn bg-blue round " @click="tab = 3">下一步</button>
  217. </view>
  218. <view v-if="tab == 2 && title == '店铺信息'" class="padding flex sub-bottom" style="justify-content: space-around;">
  219. <!-- <button class="cu-btn line-gray shadow" style="width: 40%;"
  220. @click="$Router.push({ name: 'settings' })">取消</button> -->
  221. <button class="cu-btn round line-blue shadow" style="width: 48%;" @click="tab = 1">上一页</button>
  222. <button style="margin-left: 12upx;width:48%" class="cu-btn line-blue round shadow" @click="tab = 3">下一页</button>
  223. <!-- <button style="margin-left: 12upx;width:40%" class="cu-btn bg-blue " @click="sumbit">提交审核</button> -->
  224. </view>
  225. <view v-if="tab == 3" class="padding flex sub-bottom">
  226. <button class="cu-btn round line-blue shadow" @click="tab = 2">{{ title == '申请入驻' ? '上一步' : '上一页' }}</button>
  227. <button style="margin-left: 12upx;width:77%" class="cu-btn bg-blue round " @click="sumbit">提交审核</button>
  228. </view>
  229. <view class="cu-load load-modal" v-if="lodingshow">
  230. <image src="/static/logo.png" mode="aspectFit"></image>
  231. <view class="gray-text">加载中...</view>
  232. </view>
  233. <w-picker class="picker-style" :visible.sync="visible" ref="picker" mode="region" :value="form.locality"
  234. @confirm="onConfirm($event, 'region')"></w-picker>
  235. <selectType v-if="showSelectLocality" @transmitType="confirmLocality" @cutPopup="showSelectLocality = false">
  236. </selectType>
  237. </view>
  238. </template>
  239. <script>
  240. import {
  241. watch
  242. } from 'vue'
  243. import configService from '../../common/service/config.service'
  244. import regionPicker from "../../components/w-picker/region-picker.vue"
  245. import selectType from "../../components/selectType.vue"
  246. // import aMap from "./map.vue"
  247. import status from "../store/components/status.vue"
  248. import {
  249. ACCESS_TOKEN,
  250. USER_INFO
  251. } from "@/common/util/constants";
  252. import * as $p from "@/uni_modules/uni-easyinput/components/uni-easyinput/common";
  253. import rangTime from '../../components/dengrq-datetime-picker/dateSelector/index.vue'
  254. import tdmap from "@/pages/store/tdtuMap.vue"
  255. export default {
  256. components: {
  257. regionPicker,
  258. status,
  259. rangTime,
  260. selectType,
  261. // aMap
  262. tdmap
  263. },
  264. data() {
  265. return {
  266. imageList: [],
  267. mapIsHidden: false,
  268. latitude: 37.827066,
  269. longitude: 112.34988,
  270. // latitude: null, // 默认中心纬度(例如北京)
  271. // longitude: null, // 默认中心经度
  272. marker: [], // 初始为空数组
  273. title: '申请入驻',
  274. lodingshow: false,
  275. form: {
  276. name: null,
  277. type: 1,
  278. corporateName: null,
  279. creditCode: null,
  280. lifespanType: 1,
  281. lifespanBegin: this.timestampToTime(),
  282. lifespanEnd: '9999-12-31',
  283. lifespanBegin: null,
  284. lifespanEnd: null,
  285. businessLicense: null,
  286. legalPerson: null,
  287. legalPersonCode: null,
  288. storeName: null,
  289. country: null,
  290. locality: '',
  291. address: null,
  292. headPhoto: '',
  293. passWord: uni.getStorageSync('password'),
  294. phone: uni.getStorageSync('phone'),
  295. ordinaryUserId: null,
  296. storeExtent: null,
  297. address: '',
  298. longitude: '',
  299. latitude: '',
  300. typeLabel: null,
  301. businessScope: null
  302. },
  303. formName: {
  304. // name: '姓名',
  305. type: '主体类型',
  306. corporateName: '公司名称',
  307. creditCode: '统一代码',
  308. lifespanType: '有效期',
  309. // headPhoto: '门头照片',
  310. legalPerson: '法人姓名',
  311. legalPersonCode: '法人证件号',
  312. storeName: '门店名称',
  313. locality: '所在地区',
  314. address: '门店地址',
  315. businessLicense: '营业执照',
  316. businessScope: '经营范围',
  317. leaderName: '负责人姓名',
  318. leaderPhone: '负责人手机号',
  319. storeExtent: '店铺面积',
  320. typeLabel: '主体类型'
  321. },
  322. tab: 1,
  323. supplierOption: [],
  324. businessLicenseImg: '',
  325. identityOneImg: '',
  326. identityTwoImg: '',
  327. visible: false,
  328. index: -1,
  329. // markers:[{
  330. // latitude: 37.827066,
  331. // longitude: 112.34988,
  332. // iconPath: '../../static/avatar_girl.png'
  333. // }]
  334. markers: [],
  335. headPhotoImg: [],
  336. loginType: '',
  337. showSelectLocality: false, //选择主体类型弹窗显隐
  338. mode: 1,
  339. typeLabel: '',
  340. referenceCodeDisable: false,
  341. mapKey: 1,
  342. }
  343. },
  344. watch: {
  345. visible(val) {
  346. if (!val) {
  347. this.mapIsHidden = 'block'
  348. }
  349. }
  350. },
  351. computed() {
  352. },
  353. onShow() {
  354. this.getCurrentLocation();
  355. this.markers = uni.getStorageSync('address') ? [Object.assign(uni.getStorageSync('address'), {
  356. iconPath: '../../static/boiaoji.png'
  357. })] : []
  358. let storageData = uni.getStorageSync('address');
  359. // this.form.address = storageData.address
  360. this.form.latitude = storageData.lat
  361. this.form.longitude = storageData.lng
  362. },
  363. async onLoad(data) {
  364. if (data.loginType) {
  365. // data.loginType =2 需要根据merchantId查询商户临时数据
  366. // data.loginType =3 不需要回显
  367. this.loginType = data.loginType;
  368. if (data.loginType === '3') {
  369. this.form.ordinaryUserId = data.ordinaryUserId;
  370. this.form.name = (data.name == null || data.name == 'null') ? "" : data.name,
  371. this.form.passWord = data.passWord;
  372. this.form.phone = data.phone;
  373. }
  374. //邀请入驻商家完善信息
  375. else if (data.loginType == 2) {
  376. this.merchantId = uni.getStorageSync(USER_INFO).merchantId;
  377. let res = await this.$http.get("/merchant/localMerchantInfo/queryAppInfoById?id=" + this.merchantId)
  378. console.log(res.data)
  379. let obj = res.data.result
  380. if (res.data.success) {
  381. this.title = '店铺信息'
  382. this.tab = 1
  383. obj.lifespanType = obj.lifespanType ? obj.lifespanType : '1'
  384. this.markers = this.form.longitude && this.form.latitude ? [{
  385. longitude: this.form.longitude,
  386. latitude: this.form.latitude,
  387. iconPath: '../../static/boiaoji.png'
  388. }] : []
  389. this.businessLicenseImg = obj.businessLicense
  390. this.identityOneImg = obj.identityOne
  391. this.identityTwoImg = obj.identityTwo
  392. this.headPhotoImg = obj.headPhoto ? obj.headPhoto.split(',').filter(id => id !== '') : []
  393. obj.headPhoto = obj.headPhoto ? obj.headPhoto.split(',').filter(id => id !== '') : []
  394. obj.locality = obj.locality ? obj.locality : ''
  395. this.switchType(obj.type)
  396. this.form = obj
  397. uni.setStorageSync('address', {
  398. lng: obj.longitude,
  399. lat: obj.latitude,
  400. address: obj.address
  401. });
  402. uni.setStorageSync('currentAddress', {
  403. name: obj.address
  404. });
  405. } else {
  406. this.$tip.toast(obj.data.message);
  407. }
  408. this.loginType = data.loginType
  409. }
  410. } else {
  411. if (data.params) {
  412. let obj = JSON.parse(decodeURIComponent(data.params));
  413. this.title = '店铺信息'
  414. this.tab = 1
  415. obj.lifespanType = obj.lifespanType ? obj.lifespanType : '1'
  416. this.markers = this.form.longitude && this.form.latitude ? [{
  417. longitude: this.form.longitude,
  418. latitude: this.form.latitude,
  419. iconPath: '../../static/boiaoji.png'
  420. }] : []
  421. this.businessLicenseImg = obj.businessLicense
  422. this.identityOneImg = obj.identityOne
  423. this.identityTwoImg = obj.identityTwo
  424. this.headPhotoImg = obj.headPhoto ? obj.headPhoto.split(',').filter(id => id !== '') : []
  425. obj.headPhoto = obj.headPhoto ? obj.headPhoto.split(',').filter(id => id !== '') : []
  426. obj.locality = obj.locality ? obj.locality : ''
  427. this.switchType(obj.type)
  428. this.form = obj
  429. }
  430. }
  431. },
  432. methods: {
  433. switchType(type) {
  434. const selectLocality = [{
  435. value: 1,
  436. label: '个人独资'
  437. },
  438. {
  439. value: 2,
  440. label: '个体工商户'
  441. },
  442. {
  443. value: 3,
  444. label: '有限责任公司'
  445. },
  446. {
  447. value: 4,
  448. label: '股份责任公司'
  449. },
  450. {
  451. value: 5,
  452. label: '合伙企业'
  453. }
  454. ];
  455. const item = selectLocality.find(item => item.value == type);
  456. if (item) {
  457. this.typeLabel = item.label;
  458. }
  459. },
  460. //选择位置
  461. selectAddress() {
  462. uni.navigateTo({
  463. url: '/pages/store/selectTdMap?url=' + '/pages/store/editStore'
  464. })
  465. },
  466. //选择主题类型
  467. confirmLocality(data) {
  468. console.log(data)
  469. this.form.type = data.value
  470. this.typeLabel = data.label
  471. this.showSelectLocality = false
  472. },
  473. //选择证件有效时间
  474. onEndTimeChange(val) {
  475. console.log(val)
  476. this.form.lifespanBegin = val.startDate
  477. this.form.lifespanEnd = val.endDate
  478. this.$forceUpdate(); // 强制刷新视图
  479. },
  480. //选择时间显示
  481. selectDate() {
  482. // this.isSelectDate = true
  483. this.$refs.rangTime.open()
  484. },
  485. getCurrentLocation() {
  486. uni.getStorage({
  487. key: 'currentAddress',
  488. success: (res) => {
  489. if (res.data && res.data.location) {
  490. let temp = res.data.location.split(',');
  491. this.latitude = temp[1];
  492. this.longitude = temp[0];
  493. this.marker = [{
  494. id: 0,
  495. latitude: temp[1],
  496. longitude: temp[0],
  497. title: res.data.name || '当前位置',
  498. iconPath: '../../static/boiaoji.png',
  499. width: 30,
  500. height: 30,
  501. callout: { // 添加标注说明
  502. content: res.data.name || '当前位置',
  503. color: '#000',
  504. fontSize: 12,
  505. borderRadius: 10,
  506. bgColor: '#fff',
  507. padding: 5,
  508. display: 'ALWAYS'
  509. }
  510. }];
  511. this.$forceUpdate();
  512. }
  513. },
  514. fail: () => {
  515. // 如果没有存储的位置,可以设置默认位置
  516. this.setDefaultLocation();
  517. }
  518. });
  519. },
  520. setDefaultLocation() {
  521. let that = this
  522. uni.getLocation({
  523. type: 'gcj02',
  524. success: function(res) {
  525. that.latitude = res.latitude;
  526. that.longitude = res.longitude;
  527. that.marker = [{
  528. id: 0,
  529. latitude: that.latitude,
  530. longitude: that.longitude,
  531. title: '默认位置',
  532. iconPath: '../../static/boiaoji.png',
  533. width: 30,
  534. height: 30
  535. }];
  536. },
  537. fail() {
  538. }
  539. });
  540. },
  541. handleMarkerTap() {
  542. const queryString = uni.getStorageSync('address') ? encodeURIComponent(JSON.stringify(uni.getStorageSync(
  543. 'address'))) : ''
  544. uni.navigateTo({
  545. url: `/pages/login/map?position=${queryString}`
  546. // url:'/pages/login/map'
  547. })
  548. },
  549. getFile(e) {
  550. let path = ''
  551. uni.uploadFile({
  552. url: configService.apiUrl + '/sys/common/upload',
  553. filePath: e,
  554. name: "file",
  555. formData: {
  556. 'biz': 'temp',
  557. },
  558. success: (files) => {
  559. let data = JSON.parse(files.data);
  560. if (data.success) {
  561. path = res.tempFilePaths
  562. }
  563. }
  564. })
  565. console.log(path, 88);
  566. return path
  567. },
  568. uploadAll() {
  569. if (this.imageList.length === 0) {
  570. uni.showToast({
  571. title: '请先选择图片',
  572. icon: 'none'
  573. });
  574. return;
  575. }
  576. uni.showLoading({
  577. title: '上传中...',
  578. mask: true
  579. });
  580. const uploadPromises = this.imageList.map((path, index) => {
  581. return new Promise((resolve, reject) => {
  582. uni.uploadFile({
  583. url: configService.apiUrl + '/sys/common/upload', // 替换为实际接口
  584. filePath: path,
  585. formData: {
  586. 'biz': 'temp',
  587. },
  588. name: 'file',
  589. success: (files) => {
  590. resolve(configService.apiUrl + '/' + JSON.parse(files.data).message)
  591. },
  592. fail: reject
  593. });
  594. });
  595. });
  596. Promise.all(uploadPromises)
  597. .then(results => {
  598. uni.hideLoading();
  599. this.imageList = []; // 清空已上传列表
  600. this.headPhotoImg = this.headPhotoImg.concat(results)
  601. this.form.headPhoto = this.form.headPhoto.concat(results)
  602. })
  603. .catch(error => {
  604. uni.hideLoading();
  605. });
  606. },
  607. ChooseImage() {
  608. uni.chooseImage({
  609. count: 5 - Number(this.headPhotoImg.length),
  610. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  611. sourceType: ['album'], //从相册选择
  612. success: (res) => {
  613. if (res) {
  614. this.imageList = [...this.imageList, ...res.tempFilePaths];
  615. this.uploadAll()
  616. }
  617. }
  618. });
  619. },
  620. ViewImage(e) {
  621. uni.previewImage({
  622. urls: this.headPhotoImg,
  623. current: e.currentTarget.dataset.url
  624. });
  625. },
  626. DelImg(e) {
  627. uni.showModal({
  628. title: '提示',
  629. content: '确定要删除?',
  630. cancelText: '取消',
  631. confirmText: '确定',
  632. success: res => {
  633. if (res.confirm) {
  634. this.headPhotoImg.splice(e.currentTarget.dataset.index, 1)
  635. this.form.headPhoto.splice(e.currentTarget.dataset.index, 1)
  636. }
  637. }
  638. })
  639. },
  640. onConfirm(e) {
  641. this.mapIsHidden = false
  642. this.form.locality = e.result
  643. this.form.country = e.value[e.value.length - 1]
  644. },
  645. PickerChange(e) {
  646. this.form.purveyorId = this.supplierOption[e.detail.value].id
  647. },
  648. typeChang(e, val) {
  649. this.form[val] = e.detail.value
  650. },
  651. async businessChange(type) {
  652. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  653. count: 1,
  654. sizeType: ['compressed']
  655. });
  656. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  657. if (!size) {
  658. this.$refs.uToast.show({
  659. title: '上传图片大小不能超过 5MB!',
  660. type: 'error',
  661. })
  662. return false
  663. }
  664. if (chooseImageRes) {
  665. this.lodingshow = true;
  666. // this.$tip.loading()
  667. this[type + 'Img'] = chooseImageRes.tempFilePaths[0];
  668. uni.uploadFile({
  669. url: configService.apiUrl + '/sys/common/upload',
  670. filePath: chooseImageRes.tempFilePaths[0],
  671. name: "file",
  672. formData: {
  673. 'biz': 'temp',
  674. },
  675. success: (files) => {
  676. let data = JSON.parse(files.data);
  677. if (data.success) {
  678. this.form[type] = data.message
  679. if (type == 'businessLicense' || type == 'identityOne') {
  680. uni.uploadFile({
  681. url: configService.apiUrl +
  682. `${type == 'businessLicense' ? '/order/identify/businessLicense' : '/order/identify/idCard'}`,
  683. filePath: chooseImageRes.tempFilePaths[0],
  684. name: "image1",
  685. success: (uploadFileRes) => {
  686. let data1 = JSON.parse(uploadFileRes.data).result;
  687. let obj = {}
  688. if (type == 'businessLicense') {
  689. obj = {
  690. corporateName: data1.company ? data1.company : '', //公司名称
  691. creditCode: data1.socialCreditCode ? data1.socialCreditCode : '', //统一社会信用代码
  692. businessScope: data1.businessScope ? data1.businessScope : '', //经营范围
  693. lifespanBegin: data1.registerDate ? data1.registerDate.substr(0,
  694. 4) + '-' + data1.registerDate.substr(5, 2) + '-' + data1.registerDate
  695. .substr(8, 2) : '',
  696. lifespanEnd: data1.effectiveDate && data1.effectiveDate.includes('年') ? data1
  697. .effectiveDate.substr(0,
  698. 4) + '-' + data1.effectiveDate.substr(5, 2) + '-' + data1.effectiveDate
  699. .substr(8, 2) : '9999-12-31',
  700. lifespanType: data1.registerDate || data1.effectiveDate ? '2' : '1',
  701. }
  702. } else {
  703. obj = {
  704. legalPerson: data1.customerInfo.name ? data1.customerInfo.name : '', //法人姓名
  705. legalPersonCode: data1.customerInfo.identifyNumber ? data1.customerInfo
  706. .identifyNumber : '', //法人证件号
  707. }
  708. }
  709. this.$nextTick(() => {
  710. this.form = {
  711. ...this.form,
  712. ...obj,
  713. }
  714. // this.$set(this.form, obj);
  715. // this.form=Object.assign(this.form,obj)
  716. console.log(obj, this.form, 88888);
  717. })
  718. this.lodingshow = false;
  719. }
  720. });
  721. } else {
  722. this.lodingshow = false;
  723. }
  724. }
  725. }
  726. });
  727. } else {
  728. this.lodingshow = false;
  729. }
  730. },
  731. timestampToTime(timestamp) {
  732. // let date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  733. let date = new Date(new Date()); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
  734. let Y = date.getFullYear() + '-';
  735. let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
  736. let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
  737. return Y + M + D;
  738. },
  739. sumbit() {
  740. if (this.title == '申请入驻') {
  741. if (this.loginType) {
  742. if (this.loginType === '3') {
  743. //普通用户没有商户新增
  744. for (let j in this.form) {
  745. if (!this.form[j]) {
  746. if (this.form['lifespanType'] == 2 && (this.form['lifespanBegin'] == null || this.form[
  747. 'lifespanEnd'] ==
  748. null)) {
  749. // this.$tip.alert('请选择日期!')
  750. uni.showToast({
  751. icon: 'none',
  752. title: '请选择日期!'
  753. })
  754. return
  755. }
  756. if (this.form['businessLicense'] == null) {
  757. // this.$tip.alert('请上传营业执照!')
  758. uni.showToast({
  759. icon: 'none',
  760. title: '请上传营业执照!'
  761. })
  762. return
  763. }
  764. if (this.formName[j]) {
  765. // this.$tip.alert(`请填写${this.formName[j]}!`)
  766. uni.showToast({
  767. icon: 'none',
  768. title: `请填写${this.formName[j]}!`
  769. })
  770. return
  771. }
  772. }
  773. }
  774. const isHttpOrHttpsone = /^https?:\/\//.test(this.form.identityOne)
  775. const isHttpOrHttpstwo = /^https?:\/\//.test(this.form.identityOne)
  776. const isbusinessLicense = /^https?:\/\//.test(this.form.businessLicense)
  777. if (!isHttpOrHttpsone) {
  778. this.form.identityOne = configService.apiUrl + '/' + this.form.identityOne
  779. }
  780. if (!isHttpOrHttpstwo) {
  781. this.form.identityTwo = configService.apiUrl + '/' + this.form.identityTwo
  782. }
  783. if (!isbusinessLicense) {
  784. this.form.businessLicense = configService.apiUrl + '/' + this.form.businessLicense
  785. }
  786. this.form.address = uni.getStorageSync('address').address
  787. this.form.latitude = uni.getStorageSync('address').lat
  788. this.form.longitude = uni.getStorageSync('address').lng
  789. let data = {
  790. ...this.form,
  791. source: 2,
  792. // headPhoto: Array.isArray(this.form.headPhoto) ? this.form.headPhoto.join(',') : this.form.headPhoto,
  793. longitude: this.markers.length > 0 ? this.markers[0].longitude : '',
  794. latitude: this.markers.length > 0 ? this.markers[0].latitude : ''
  795. }
  796. this.$http.post('/merchant/app/add', data).then(res => {
  797. if (res.data.code == 200) {
  798. //放入session
  799. const result = res.data.result
  800. const userInfo = result.userInfo
  801. uni.setStorageSync(ACCESS_TOKEN, result.token);
  802. uni.setStorageSync(USER_INFO, userInfo);
  803. this.$store.commit('SET_TOKEN', result.token)
  804. this.$store.commit('SET_NAME', {
  805. username: userInfo.username,
  806. realname: userInfo.realname
  807. })
  808. this.$store.commit('SET_AVATAR', userInfo.avatar)
  809. // #ifdef APP-PLUS
  810. uni.switchTab({
  811. url: '/pages/index/index'
  812. })
  813. // #endif
  814. // #ifndef APP-PLUS
  815. // this.$tip.success('登录成功!')
  816. uni.showToast({
  817. icon: 'none',
  818. title: '登录成功'
  819. })
  820. this.$Router.replaceAll({
  821. name: 'index'
  822. })
  823. // #endif
  824. } else {
  825. // this.$tip.error(res.data.message);
  826. uni.showToast({
  827. icon: 'none',
  828. title: res.data.message
  829. })
  830. }
  831. })
  832. } else if (this.loginType == 2) {
  833. const isHttpOrHttpsone = /^https?:\/\//.test(this.form.identityOne)
  834. const isHttpOrHttpstwo = /^https?:\/\//.test(this.form.identityOne)
  835. const isbusinessLicense = /^https?:\/\//.test(this.form.businessLicense)
  836. if (!isHttpOrHttpsone) {
  837. this.form.identityOne = configService.apiUrl + '/' + this.form.identityOne
  838. }
  839. if (!isHttpOrHttpstwo) {
  840. this.form.identityTwo = configService.apiUrl + '/' + this.form.identityTwo
  841. }
  842. if (!isbusinessLicense) {
  843. this.form.businessLicense = configService.apiUrl + '/' + this.form.businessLicense
  844. }
  845. this.form.address = uni.getStorageSync('address').address
  846. this.form.latitude = uni.getStorageSync('address').lat
  847. this.form.longitude = uni.getStorageSync('address').lng
  848. let data = {
  849. ...this.form,
  850. source: 2,
  851. id: uni.getStorageSync('login_user_info').merchantId
  852. // headPhoto: Array.isArray(this.form.headPhoto) ? this.form.headPhoto.join(',') : this.form.headPhoto,
  853. // longitude: this.markers.length > 0 ? this.markers[0].longitude : '',
  854. // latitude: this.markers.length > 0 ? this.markers[0].latitude : ''
  855. }
  856. // this.$http.post('/merchant/localMerchantInfo/edit', data).then(res => {
  857. this.$http.post('/merchant/localMerchantInfo/editMerchantInfo', data).then(res => {
  858. if (res.data.success) {
  859. // this.$tip.success(res.data.result || '成功')
  860. uni.showToast({
  861. icon: 'none',
  862. title: res.data.result || '成功'
  863. })
  864. uni.navigateBack({
  865. delta: 1 // 返回的页面数,默认为1
  866. })
  867. } else {
  868. // this.$tip.error(res.data.message);
  869. uni.showToast({
  870. icon: 'none',
  871. title: res.data.message
  872. })
  873. }
  874. })
  875. }
  876. }
  877. } else {
  878. // this.form.identityOne = configService.apiUrl+'/'+this.form.identityOne
  879. // this.form.identityTwo = configService.apiUrl+'/'+this.form.identityTwo
  880. const isHttpOrHttpsone = /^https?:\/\//.test(this.form.identityOne)
  881. const isHttpOrHttpstwo = /^https?:\/\//.test(this.form.identityOne)
  882. const isbusinessLicense = /^https?:\/\//.test(this.form.businessLicense)
  883. if (!isHttpOrHttpsone) {
  884. this.form.identityOne = configService.apiUrl + '/' + this.form.identityOne
  885. }
  886. if (!isHttpOrHttpstwo) {
  887. this.form.identityTwo = configService.apiUrl + '/' + this.form.identityTwo
  888. }
  889. if (!isbusinessLicense) {
  890. this.form.businessLicense = configService.apiUrl + '/' + this.form.businessLicense
  891. }
  892. this.form.address = uni.getStorageSync('address').address
  893. this.form.latitude = uni.getStorageSync('address').lat
  894. this.form.longitude = uni.getStorageSync('address').lng
  895. let data = {
  896. ...this.form,
  897. source: 2,
  898. headPhoto: Array.isArray(this.form.headPhoto) ? this.form.headPhoto.join(',') : this.form.headPhoto,
  899. // longitude: this.markers.length > 0 ? this.markers[0].longitude : '',
  900. // latitude: this.markers.length > 0 ? this.markers[0].latitude : ''
  901. }
  902. // this.$http.post('/merchant/localMerchantInfo/edit', data).then(res => {
  903. this.$http.post('/merchant/localMerchantInfo/editMerchantInfo', data).then(res => {
  904. console.log(res)
  905. if (res.data.success) {
  906. // this.$tip.success(res.data.result || '成功')
  907. uni.showToast({
  908. icon: 'none',
  909. title: res.data.result || '成功'
  910. })
  911. uni.navigateBack({
  912. delta: 1 // 返回的页面数,默认为1
  913. })
  914. } else {
  915. // this.$tip.error(res.data.message);
  916. uni.showToast({
  917. icon: 'none',
  918. title: res.data.message
  919. })
  920. }
  921. })
  922. }
  923. }
  924. }
  925. }
  926. </script>
  927. <style scoped lang="scss">
  928. page {
  929. background: #F8F8FA;
  930. }
  931. .cu-form-group .title {
  932. width: 154rpx;
  933. padding: 0;
  934. span {
  935. color: red;
  936. }
  937. }
  938. .cu-bg {
  939. background: linear-gradient(180deg, #D6E9FF 0%, #FFFFFF 100%);
  940. }
  941. .tab-top {
  942. margin-top: 78upx;
  943. padding: 26upx;
  944. }
  945. .borderRadiu {
  946. height: auto;
  947. border-radius: 8px;
  948. padding-bottom: 10px;
  949. background-color: #ffffff;
  950. // border-bottom: 1px solid #eee;
  951. }
  952. .sub-bottom {
  953. position: fixed;
  954. width: 100%;
  955. bottom: 0;
  956. background: #FFFFFF;
  957. border-top: 1px solid #EEEEEE;
  958. }
  959. .progress-status {
  960. position: fixed;
  961. width: 100%;
  962. z-index: 9999;
  963. padding: 26upx 42upx;
  964. background: #FFFFFF;
  965. .status {
  966. font-size: 38upx;
  967. color: #F6863E;
  968. font-weight: 500;
  969. margin-bottom: 10upx;
  970. text {
  971. margin-left: 5upx
  972. }
  973. image {
  974. vertical-align: text-top;
  975. width: 42upx;
  976. height: 42upx;
  977. }
  978. }
  979. }
  980. .progress {
  981. position: fixed;
  982. height: 96upx;
  983. width: 100%;
  984. z-index: 9999;
  985. background: #FFFFFF;
  986. padding: 20upx 30upx;
  987. .progress-title {
  988. margin-top: 16upx;
  989. font-size: 24upx;
  990. color: #999999;
  991. .color {
  992. color: #333333;
  993. }
  994. }
  995. .progress-style {
  996. width: 100%;
  997. height: 10upx;
  998. border-radius: 5px 5px 5px 5px;
  999. }
  1000. .progress-bag {
  1001. position: relative;
  1002. background: rgba(68, 154, 255, 0.05);
  1003. .progress-icon {
  1004. position: absolute;
  1005. margin-top: -1px;
  1006. width: 12upx;
  1007. height: 12upx;
  1008. background: #449AFF;
  1009. border-radius: 50%;
  1010. box-shadow: 0px 0px 0px 7upx rgba(68, 154, 255, 0.3);
  1011. }
  1012. .progress-icon1 {
  1013. position: absolute;
  1014. margin-top: -1px;
  1015. width: 12upx;
  1016. height: 12upx;
  1017. background: #449AFF;
  1018. border-radius: 50%;
  1019. left: 99%;
  1020. box-shadow: 0px 0px 0px 7upx rgba(68, 154, 255, 0.3);
  1021. }
  1022. .progress-bag1 {
  1023. width: 50%;
  1024. position: absolute;
  1025. background: rgba(68, 154, 255, 0.8);
  1026. }
  1027. .progress-bag2 {
  1028. position: absolute;
  1029. background: rgba(68, 154, 255, 0.8);
  1030. }
  1031. }
  1032. }
  1033. .customize {
  1034. background-color: #fff;
  1035. // border-top: 0.5px solid #eee;
  1036. margin: 16upx 18upx;
  1037. .title {
  1038. font-size: 30upx;
  1039. // padding: 10px;
  1040. }
  1041. .business-img {
  1042. height: 218upx;
  1043. width: 360upx;
  1044. padding: 16upx;
  1045. // padding-bottom: 16upx;
  1046. background: url('/static/login/yingye2.png');
  1047. margin: 16upx auto;
  1048. background-size: cover;
  1049. image {
  1050. width: 100%;
  1051. height: 100%;
  1052. }
  1053. }
  1054. .business-prompt {
  1055. padding-top: 16upx;
  1056. font-size: 20upx;
  1057. color: #999999;
  1058. }
  1059. }
  1060. .booder-top {
  1061. border-bottom: 1px solid rgb(238, 238, 238);
  1062. padding-top: 7px;
  1063. }
  1064. .img-border {
  1065. padding: 15px 20px;
  1066. }
  1067. .upload {
  1068. width: 100%;
  1069. height: 188upx;
  1070. // padding: 15px 20px;
  1071. background-color: white;
  1072. .imgOcr-border {
  1073. position: relative;
  1074. width: 48%;
  1075. height: 100%;
  1076. padding: 12upx;
  1077. // background-color: #fff;
  1078. background: url('/static/login/code3.png');
  1079. background-size: cover;
  1080. // box-shadow: 0px 4px 10px 0px #DAE3F4;
  1081. image {
  1082. width: 100%;
  1083. // border-radius: 4px;
  1084. height: 100%;
  1085. }
  1086. }
  1087. }
  1088. .picker-style {
  1089. .w-picker-cnt .visible {
  1090. position: absolute;
  1091. z-index: 100000;
  1092. }
  1093. }
  1094. ::v-deep .cu-form-group uni-textarea {
  1095. margin: 0;
  1096. }
  1097. </style>