details.vue 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019
  1. <template>
  2. <view class="">
  3. <uni-section title="基本信息" style="padding: 0 62rpx;" titleColor="5F5F5F" titleFontSize="28rpx">
  4. <uni-forms ref="form1" :modelValue="form" :border="true" label-width="80">
  5. <uni-forms-item name="cname" label="店铺名称" required>
  6. <uni-easyinput v-model="form.cname" class="right-align" placeholder-class="placeholder-right"
  7. placeholder="请输入内容" :inputBorder="false" :clearable="false" :disabled="form.enableOrNot==1">
  8. </uni-easyinput>
  9. </uni-forms-item>
  10. <uni-forms-item name="corpsFilesList" label="店面照片" required>
  11. <view style="display: flex;align-items: center;">
  12. <uni-file-picker :value="form.corpsFilesList.filter(item=>item.isDeleted==0)"
  13. return-type="array" limit="9" :imageStyles="imageStyles" :auto-upload="false"
  14. @select="corpsfileSelect" @delete="fileDelete" :del-icon="!(form.enableOrNot==1)"
  15. :disabled="form.enableOrNot==1"></uni-file-picker>
  16. </view>
  17. </uni-forms-item>
  18. <uni-forms-item name="businessLicense" label="营业执照">
  19. <view style="display: flex;align-items: center;">
  20. <uni-file-picker v-model="form.businessLicense" return-type="object" limit="1"
  21. :imageStyles="imageStyles" file-mediatype="image" @select="businessLicenseSelect"
  22. :del-icon="!(form.enableOrNot==1)" :disabled="form.enableOrNot==1">
  23. </uni-file-picker>
  24. </view>
  25. </uni-forms-item>
  26. <uni-forms-item name="contacts" label="联系人" required>
  27. <uni-easyinput v-model="form.contacts" class="right-align" placeholder-class="placeholder-right"
  28. placeholder="请输入内容" :inputBorder="false" :clearable="false"
  29. :disabled="form.enableOrNot==1"></uni-easyinput>
  30. </uni-forms-item>
  31. <uni-forms-item name="contactsPhone" label="电话" required>
  32. <uni-easyinput v-model="form.contactsPhone" class="right-align" type="number"
  33. placeholder-class="placeholder-right" placeholder="请输入内容" :inputBorder="false"
  34. :clearable="false" :disabled="form.enableOrNot==1" maxlength="11"
  35. @change="photoChange"></uni-easyinput>
  36. </uni-forms-item>
  37. <uni-forms-item name="salesmanName" label="业务员" required>
  38. <view style="display: flex;align-items: center;height: 36px;">
  39. <view @click="getSalerList();form.enableOrNot!=1?salesmanShow=true:null"
  40. style="width: 100%;text-align: right;"
  41. :style="form.salesmanName?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
  42. {{form.salesmanName||'请选择'}}
  43. </view>
  44. <uni-icons v-if="!form.salesmanName" type="down" size="14" color='#BCBCBC'
  45. @click="getSalerList();form.enableOrNot!=1?salesmanShow=true:null"></uni-icons>
  46. </view>
  47. <u-picker :show="salesmanShow" :columns="salesmanList" keyName="name" @confirm="salesmanConfirm"
  48. @cancel="salesmanShow=false" @close="salesmanShow=false" closeOnClickOverlay></u-picker>
  49. </uni-forms-item>
  50. <uni-forms-item name="deliveryWarehouseName" label="发货仓库" required>
  51. <view style="display: flex;align-items: center;height: 36px;">
  52. <view @click="getStorageList();form.enableOrNot!=1?deliveryWarehouseShow=true:null"
  53. style="width: 100%;text-align: right;"
  54. :style="form.deliveryWarehouseName?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
  55. {{form.deliveryWarehouseName||'请选择'}}
  56. </view>
  57. <uni-icons v-if="!form.deliveryWarehouseName" type="down" size="14" color='#BCBCBC'
  58. @click="getStorageList();form.enableOrNot!=1?deliveryWarehouseShow=true:null"></uni-icons>
  59. </view>
  60. <u-picker :show="deliveryWarehouseShow" :columns="deliveryWarehouseList" keyName="cname"
  61. @confirm="deliveryWarehouseConfirm" @cancel="deliveryWarehouseShow=false"
  62. @close="deliveryWarehouseShow=false" closeOnClickOverlay></u-picker>
  63. </uni-forms-item>
  64. <uni-forms-item name="priceSystem" label="商城价格" required>
  65. <view style="display: flex;align-items: center;height: 36px;">
  66. <view @click="form.enableOrNot!=1?priceSystemShow=true:null"
  67. style="width: 100%;text-align: right;"
  68. :style="form.priceSystem?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
  69. {{form.priceSystem||'请选择'}}
  70. </view>
  71. <uni-icons v-if="!form.priceSystem" type="down" size="14" color='#BCBCBC'
  72. @click="form.enableOrNot!=1?priceSystemShow=true:null"></uni-icons>
  73. </view>
  74. <u-picker :show="priceSystemShow" :columns="priceSystemList" keyName="dictValue"
  75. @confirm="priceSystemConfirm" @cancel="priceSystemShow=false" @close="priceSystemShow=false"
  76. closeOnClickOverlay></u-picker>
  77. </uni-forms-item>
  78. <uni-forms-item name="brandName" label="品牌">
  79. <view>
  80. <view style="display: flex;align-items: center;height: 36px;">
  81. <view class="slot-box" @click="brandPopup">
  82. <view v-for="(item,index) in sliceArray(form.brandName)" :key="index"
  83. class="slot-content-item">
  84. {{item}}
  85. </view>
  86. <view v-if="form.brandName.length > 2" class="slot-content-item">
  87. +{{form.brandName.length - 2}}</view>
  88. <view v-if="form.brandName.length == 0" style="color:#B5B4B4;font-size: 24rpx;">
  89. 请选择
  90. </view>
  91. </view>
  92. <uni-icons v-if="!form.brandName.length" type="down" size="14" color='#BCBCBC'
  93. @click="brandPopup"></uni-icons>
  94. </view>
  95. <uni-popup ref="brand" type="bottom" @change="popupChange">
  96. <view class="popup-content">
  97. <view class="popup-content-checkbox">
  98. <scroll-view scroll-y="true" style="height: 600rpx;" :show-scrollbar="false">
  99. <uni-data-checkbox mode="tag" multiple v-model="form.brandName"
  100. :localdata="brandList" @change="brandChange" selectedColor='#03803B'
  101. :map="brandObject" />
  102. </scroll-view>
  103. </view>
  104. <debounce-button class="confirm-btn" @click="brandConfirm">确认</debounce-button>
  105. </view>
  106. </uni-popup>
  107. </view>
  108. </uni-forms-item>
  109. <uni-forms-item name="address" label="所属区域" required>
  110. <!-- <uni-data-picker v-model="form.address" :localdata="addressData" popup-title="请选择所属区域"
  111. :map="mapObject" :inputBorder="false" :clear-icon="false"
  112. :readonly="form.enableOrNot==1"></uni-data-picker> -->
  113. <view style="display: flex;align-items: center;height: 36px;">
  114. <view @click="openMap" style="width: 100%;text-align: right;"
  115. :style="form.address?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
  116. {{form.address||'请选择'}}
  117. </view>
  118. <uni-icons v-if="!form.address" type="location" size="24" color='#03803B'
  119. @click="openMap"></uni-icons>
  120. </view>
  121. </uni-forms-item>
  122. <uni-forms-item name="detailedAddress" label="详细地址" required>
  123. <uni-easyinput v-model="form.detailedAddress" type="textarea" autoHeight class="right-align"
  124. placeholder-class="placeholder-right" placeholder="请输入内容" :inputBorder="false"
  125. :clearable="false" :disabled="form.enableOrNot==1"></uni-easyinput>
  126. </uni-forms-item>
  127. </uni-forms>
  128. </uni-section>
  129. <uni-section title="店面分类" style="padding: 0 62rpx;margin-top: 30rpx;" titleColor="5F5F5F" titleFontSize="28rpx">
  130. <uni-forms ref="form2" :modelValue="form" :border="true" label-width="80">
  131. <uni-forms-item name="corpsTypeName" label="店面分类" required>
  132. <view style="display: flex;align-items: center;height: 36px;">
  133. <view @click="getSelectType();form.enableOrNot!=1?corpsTypeShow=true:null"
  134. style="width: 100%;text-align: right;"
  135. :style="form.corpsTypeName?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
  136. {{form.corpsTypeName||'请选择'}}
  137. </view>
  138. <uni-icons v-if="!form.corpsTypeName" type="down" size="14" color='#BCBCBC'
  139. @click="getSelectType();form.enableOrNot!=1?corpsTypeShow=true:null"></uni-icons>
  140. </view>
  141. <u-picker :show="corpsTypeShow" :columns="corpsTypeList" keyName="cname" @confirm="corpsTypeConfirm"
  142. @cancel="corpsTypeShow=false" @close="corpsTypeShow=false" closeOnClickOverlay></u-picker>
  143. </uni-forms-item>
  144. <uni-forms-item name="storeAttributes" label="店面属性">
  145. <view>
  146. <view style="display: flex;align-items: center;height: 36px;">
  147. <view @click="form.enableOrNot!=1?storeAttributesShow=true:null"
  148. style="width: 100%;text-align: right;"
  149. :style="form.storeAttributes?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
  150. {{form.storeAttributes||'请选择'}}
  151. </view>
  152. <uni-icons v-if="!form.storeAttributes" type="down" size="14" color='#BCBCBC'
  153. @click="form.enableOrNot!=1?storeAttributesShow=true:null"></uni-icons>
  154. </view>
  155. <u-picker :show="storeAttributesShow" :columns="storeAttributesList" keyName="dictValue"
  156. @confirm="storeAttributesConfirm" @cancel="storeAttributesShow=false"
  157. @close="storeAttributesShow=false" closeOnClickOverlay></u-picker>
  158. </view>
  159. </uni-forms-item>
  160. <uni-forms-item name="chainAttribute" label="连锁属性">
  161. <view>
  162. <view style="display: flex;align-items: center;height: 36px;">
  163. <view @click="form.enableOrNot!=1?chainAttributeShow=true:null"
  164. style="width: 100%;text-align: right;"
  165. :style="form.chainAttribute?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
  166. {{form.chainAttribute||'请选择'}}
  167. </view>
  168. <uni-icons v-if="!form.chainAttribute" type="down" size="14" color='#BCBCBC'
  169. @click="form.enableOrNot!=1?chainAttributeShow=true:null"></uni-icons>
  170. </view>
  171. <u-picker :show="chainAttributeShow" :columns="chainAttributeList" keyName="dictValue"
  172. @confirm="chainAttributeConfirm" @cancel="chainAttributeShow=false"
  173. @close="chainAttributeShow=false" closeOnClickOverlay></u-picker>
  174. </view>
  175. </uni-forms-item>
  176. <uni-forms-item name="label" label="店面标签">
  177. <view>
  178. <view style="display: flex;align-items: center;height: 36px;">
  179. <view class="slot-box" @click="openPopup">
  180. <view v-for="(item,index) in sliceArray(form.label)" :key="index"
  181. class="slot-content-item">
  182. {{item}}
  183. </view>
  184. <view v-if="form.label.length > 2" class="slot-content-item">
  185. +{{form.label.length - 2}}</view>
  186. <view v-if="form.label.length == 0" style="color:#B5B4B4;font-size: 24rpx;">
  187. 请选择
  188. </view>
  189. </view>
  190. <uni-icons v-if="!form.label.length" type="down" size="14" color='#BCBCBC'
  191. @click="openPopup"></uni-icons>
  192. </view>
  193. <uni-popup ref="popup" type="bottom" @change="popupChange">
  194. <view class="popup-content">
  195. <view class="popup-content-checkbox">
  196. <scroll-view scroll-y="true" style="height: 600rpx;" :show-scrollbar="false">
  197. <uni-data-checkbox mode="tag" multiple v-model="form.label"
  198. :localdata="labelList" @change="onChange" selectedColor='#03803B'
  199. :map="labelObject" />
  200. </scroll-view>
  201. </view>
  202. <debounce-button class="confirm-btn" @click="labelConfirm">确认</debounce-button>
  203. </view>
  204. </uni-popup>
  205. </view>
  206. </uni-forms-item>
  207. </uni-forms>
  208. </uni-section>
  209. <uni-section title="商务政策" style="padding: 0 62rpx;margin-top: 30rpx;" titleColor="5F5F5F" titleFontSize="28rpx">
  210. <uni-forms ref="form3" :modelValue="form" :border="true" label-width="80">
  211. <uni-forms-item name="signingLevel" label="签约级别">
  212. <!-- <uni-data-select v-model="form.signingLevel" :localdata="signingLevelList">
  213. </uni-data-select> -->
  214. <view>
  215. <view style="display: flex;align-items: center;height: 36px;">
  216. <view @click="form.enableOrNot!=1?signingLevelShow=true:null"
  217. style="width: 100%;text-align: right;"
  218. :style="form.signingLevel?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
  219. {{form.signingLevel||'请选择'}}
  220. </view>
  221. <uni-icons v-if="!form.signingLevel" type="down" size="14" color='#BCBCBC'
  222. @click="form.enableOrNot!=1?signingLevelShow=true:null"></uni-icons>
  223. </view>
  224. <u-picker :show="signingLevelShow" :columns="signingLevelList" keyName="dictValue"
  225. @confirm="signingLevelConfirm" @cancel="signingLevelShow=false"
  226. @close="signingLevelShow=false" closeOnClickOverlay></u-picker>
  227. </view>
  228. </uni-forms-item>
  229. <uni-forms-item name="signingNumber" label="签约条数">
  230. <uni-easyinput v-model="form.signingNumber" class="right-align"
  231. placeholder-class="placeholder-right" placeholder="请输入内容" :inputBorder="false"
  232. :clearable="false" :disabled="form.enableOrNot==1" type="number"
  233. @blur="intBlur('signingNumber',form.signingNumber)"></uni-easyinput>
  234. </uni-forms-item>
  235. <uni-forms-item name="signingPeriodEnd" label="签约期限">
  236. <uni-datetime-picker v-model="form.signingPeriodEnd" type="date" :clear-icon="false" :border="false"
  237. placeholder="请选择签约期限" :disabled="form.enableOrNot==1"></uni-datetime-picker>
  238. </uni-forms-item>
  239. <uni-forms-item name="checkStatus" label="门店状态">
  240. <view style="display: flex;justify-content: flex-end;align-items: center;height: 70rpx;">
  241. <text v-if="form.checkStatus=='录入'" style="color:#e6a23c">
  242. 录入
  243. </text>
  244. <text v-if="form.checkStatus=='提交'" style="color:#409EFF">
  245. 提交
  246. </text>
  247. <text v-if="form.checkStatus=='审核通过'" style="color:#67c23a">
  248. 审核通过
  249. </text>
  250. <text v-if="form.checkStatus=='审核驳回'" style="color:#f56c6c">
  251. 审核驳回
  252. </text>
  253. </view>
  254. </uni-forms-item>
  255. </uni-forms>
  256. </uni-section>
  257. <!--<view v-if="form.enableOrNot!=1" style="padding:30rpx 20rpx;">
  258. <view>
  259. <debounce-button bgColor="#03803B" @click="submit">保存</debounce-button>
  260. </view>
  261. </view> -->
  262. <view v-if="form.enableOrNot!=1" class="nav-bottom-height">
  263. </view>
  264. <view v-if="form.enableOrNot!=1&&!popupShow" class="goods-nav-bottom">
  265. <uni-goods-nav v-if="form.checkStatus=='录入'||form.checkStatus=='审核驳回'" :fill="true" :options="[]"
  266. :buttonGroup="buttonGroup" @buttonClick="buttonClick" />
  267. <uni-goods-nav v-if="!(form.checkStatus=='录入'||form.checkStatus=='审核驳回')" :fill="true" :options="[]"
  268. :buttonGroup="buttonGroup2" @buttonClick="buttonClick2" />
  269. </view>
  270. </view>
  271. </template>
  272. <script>
  273. import http from '@/http/api.js'
  274. import {
  275. clientId,
  276. clientSecret
  277. } from '@/common/setting'
  278. import {
  279. submit,
  280. getDetail,
  281. review,
  282. selectType,
  283. selectLabel,
  284. fileRemove,
  285. salerList,
  286. storageList,
  287. brandDesc
  288. } from '@/api/home/store.js'
  289. import {
  290. contrastObj
  291. } from '@/utils/contrastData.js'
  292. export default {
  293. data() {
  294. return {
  295. popupShow: false,
  296. buttonGroup: [{
  297. text: '通过',
  298. backgroundColor: '#18bc37',
  299. color: '#fff'
  300. },
  301. {
  302. text: '驳回',
  303. backgroundColor: '#e64340',
  304. color: '#fff'
  305. }
  306. ],
  307. buttonGroup2: [{
  308. text: '保存',
  309. backgroundColor: '#03803B',
  310. color: '#fff'
  311. }],
  312. corpsTypeShow: false,
  313. storeAttributesShow: false,
  314. chainAttributeShow: false,
  315. signingLevelShow: false,
  316. salesmanShow: false,
  317. deliveryWarehouseShow: false,
  318. priceSystemShow: false,
  319. form: {
  320. corpsTypeId: null,
  321. corpsTypeName: null,
  322. storeAttributes: null,
  323. chainAttribute: null,
  324. signingLevel: null,
  325. dimension: null,
  326. longitude: null,
  327. address: null,
  328. detailedAddress: null,
  329. label: [],
  330. brandName: [],
  331. corpsFilesList: [],
  332. businessLicense: {}
  333. },
  334. oldForm: {
  335. corpsTypeId: null,
  336. corpsTypeName: null,
  337. storeAttributes: null,
  338. chainAttribute: null,
  339. signingLevel: null,
  340. dimension: null,
  341. longitude: null,
  342. address: null,
  343. detailedAddress: null,
  344. label: [],
  345. brandName: [],
  346. corpsFilesList: [],
  347. businessLicense: {}
  348. },
  349. imageStyles: {
  350. width: 46,
  351. height: 46
  352. },
  353. mapObject: {
  354. text: 'name',
  355. value: 'code',
  356. children: 'children'
  357. },
  358. labelObject: {
  359. text: 'label',
  360. value: 'label',
  361. },
  362. brandObject: {
  363. text: 'cname',
  364. value: 'cname',
  365. },
  366. addressData: [],
  367. labelList: [],
  368. corpsTypeList: [],
  369. storeAttributesList: [],
  370. chainAttributeList: [],
  371. signingLevelList: [],
  372. salesmanList: [],
  373. brandList: [],
  374. deliveryWarehouseList: [],
  375. priceSystemList: [],
  376. mapData: {},
  377. errData: {},
  378. }
  379. },
  380. onLoad(option) {
  381. uni.$on('commitCheck', (data) => {
  382. this.form.address = (data.province ? data.province : '') + (data.city ? "," + data.city :
  383. '') + (data.district ? "," + data.district : '')
  384. this.form.detailedAddress = data.name
  385. this.form.longitude = data.location ? data.location.split(',')[0] : null
  386. this.form.dimension = data.location ? data.location.split(',')[1] : null
  387. });
  388. this.getSelectType()
  389. this.getLabel()
  390. this.getSalerList()
  391. this.getStorageList()
  392. this.getDictionary()
  393. this.getBrandlist()
  394. if (option && option.id) {
  395. this.getDetail(option.id)
  396. }
  397. },
  398. onUnload() {
  399. uni.$off();
  400. },
  401. methods: {
  402. popupChange(e) {
  403. console.log(e)
  404. this.popupShow = e.show
  405. },
  406. buttonClick(e) {
  407. if (e.index == 0) {
  408. this.approval(1)
  409. }
  410. if (e.index == 1) {
  411. this.approval(2)
  412. }
  413. },
  414. buttonClick2(e) {
  415. if (e.index == 0) {
  416. this.submit()
  417. }
  418. },
  419. openMap() {
  420. if (this.form.enableOrNot != 1) {
  421. if (this.form.longitude && this.form.dimension) {
  422. uni.navigateTo({
  423. url: `/pages/home/store/map/index?longitude=${this.form.longitude}&latitude=${this.form.dimension}`
  424. });
  425. } else {
  426. uni.navigateTo({
  427. url: `/pages/home/store/map/index`
  428. });
  429. }
  430. }
  431. },
  432. photoChange(val) {
  433. if (val) {
  434. if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(val)) {
  435. uni.showToast({
  436. title: '请输入正确电话',
  437. icon: 'none'
  438. });
  439. return;
  440. }
  441. }
  442. },
  443. intBlur(name, value) {
  444. if (!this.form[name]) return
  445. // 使用toFixed处理小数位
  446. try {
  447. const num = parseFloat(this.form[name])
  448. if (!isNaN(num)) {
  449. this.form[name] = Math.floor(num).toFixed(0)
  450. }
  451. } catch (e) {
  452. console.error('格式化错误', e)
  453. }
  454. },
  455. openPopup() {
  456. if (this.form.enableOrNot != 1) {
  457. this.getLabel()
  458. this.$refs.popup.open()
  459. }
  460. },
  461. brandPopup() {
  462. if (this.form.enableOrNot != 1) {
  463. this.getBrandlist()
  464. this.$refs.brand.open()
  465. }
  466. },
  467. onChange(e) {
  468. console.log('当前选中:', e.detail.value)
  469. },
  470. brandChange(e) {
  471. console.log('当前选中:', e.detail)
  472. let ids = []
  473. e.detail.data.forEach(item => {
  474. ids.push(item.id)
  475. })
  476. this.form.brandId = ids.join(',')
  477. },
  478. labelConfirm() {
  479. this.$refs.popup.close()
  480. // 提交选中值逻辑...
  481. },
  482. brandConfirm() {
  483. this.$refs.brand.close()
  484. // 提交选中值逻辑...
  485. },
  486. clear(name) {
  487. if (name == 'corpsTypeName') {
  488. this.form.corpsTypeId = null
  489. this.form.corpsTypeName = null
  490. }
  491. if (name == 'salesmanName') {
  492. this.form.salesmanId = null
  493. this.form.salesmanName = null
  494. }
  495. if (name == 'deliveryWarehouseName') {
  496. this.form.deliveryWarehouseId = null
  497. this.form.deliveryWarehouseName = null
  498. }
  499. },
  500. salesmanConfirm(row) {
  501. this.form.salesmanId = row.value[0].id
  502. this.form.salesmanName = row.value[0].name
  503. this.salesmanShow = false
  504. },
  505. deliveryWarehouseConfirm(row) {
  506. this.form.deliveryWarehouseId = row.value[0].id
  507. this.form.deliveryWarehouseName = row.value[0].cname
  508. this.deliveryWarehouseShow = false
  509. },
  510. priceSystemConfirm(row) {
  511. this.form.priceSystem = row.value[0].dictValue
  512. this.priceSystemShow = false
  513. },
  514. corpsTypeConfirm(row) {
  515. this.form.corpsTypeId = row.value[0].id
  516. this.form.corpsTypeName = row.value[0].cname
  517. this.corpsTypeShow = false
  518. },
  519. storeAttributesConfirm(row) {
  520. this.form.storeAttributes = row.value[0].dictValue
  521. this.storeAttributesShow = false
  522. },
  523. chainAttributeConfirm(row) {
  524. this.form.chainAttribute = row.value[0].dictValue
  525. this.chainAttributeShow = false
  526. },
  527. signingLevelConfirm(row) {
  528. this.form.signingLevel = row.value[0].dictValue
  529. this.signingLevelShow = false
  530. },
  531. getDictionary() {
  532. this.$u.api.dictionary('storeAttributes').then(res => {
  533. this.storeAttributesList = [res.data]
  534. })
  535. this.$u.api.dictionary('chainAttribute').then(res => {
  536. this.chainAttributeList = [res.data]
  537. })
  538. this.$u.api.dictionary('signingLevel').then(res => {
  539. this.signingLevelList = [res.data]
  540. })
  541. this.$u.api.dictionary('mall_price').then(res => {
  542. this.priceSystemList = [res.data]
  543. })
  544. },
  545. sliceArray(ls) {
  546. if (Array.isArray(ls)) {
  547. return ls.slice(0, 2)
  548. }
  549. return ls
  550. },
  551. getSelectType() {
  552. selectType().then(res => {
  553. this.corpsTypeList = [res.data]
  554. })
  555. },
  556. getLabel() {
  557. selectLabel().then(res => {
  558. this.labelList = res.data
  559. })
  560. },
  561. getSalerList() {
  562. salerList().then(res => {
  563. this.salesmanList = [res.data]
  564. })
  565. },
  566. getStorageList() {
  567. storageList().then(res => {
  568. this.deliveryWarehouseList = [res.data]
  569. })
  570. },
  571. getBrandlist() {
  572. brandDesc().then(res => {
  573. this.brandList = res.data
  574. })
  575. },
  576. getFileExtension(filename) {
  577. return filename.slice(((filename.lastIndexOf(".") - 1) >>> 0) + 2);
  578. },
  579. businessLicenseSelect(files) {
  580. files.tempFiles.forEach(file => {
  581. uni.showLoading({
  582. title: '加载中',
  583. mask: true
  584. });
  585. uni.uploadFile({
  586. url: http.config.baseURL +
  587. '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
  588. filePath: file.path,
  589. header: {
  590. // 客户端认证参数
  591. 'Authorization': 'Basic ' + Base64.encode(clientId + ':' + clientSecret),
  592. 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
  593. },
  594. name: 'file',
  595. success: (res) => {
  596. const data = JSON.parse(res.data).data
  597. this.form.businessLicense = {
  598. url: data.link,
  599. name: data.originalName,
  600. extname: this.getFileExtension(data.originalName)
  601. }
  602. this.form.businessLicenseUrl = data.link
  603. uni.showToast({
  604. title: '上传成功',
  605. icon: 'none'
  606. });
  607. },
  608. fail: (err) => {
  609. uni.showToast({
  610. title: '上传失败',
  611. icon: 'none'
  612. });
  613. },
  614. complete: () => {
  615. uni.hideLoading()
  616. }
  617. })
  618. })
  619. },
  620. fileDelete(row) {
  621. uni.showToast({
  622. title: '删除成功',
  623. icon: 'none'
  624. });
  625. this.form.corpsFilesList.filter(item => item.isDeleted == 0)[row.index].isDeleted = 1
  626. },
  627. corpsfileSelect(files) {
  628. uni.showLoading({
  629. title: '加载中',
  630. mask: true
  631. });
  632. files.tempFiles.forEach(file => {
  633. uni.uploadFile({
  634. url: http.config.baseURL +
  635. '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
  636. filePath: file.path,
  637. header: {
  638. // 客户端认证参数
  639. 'Authorization': 'Basic ' + Base64.encode(clientId + ':' + clientSecret),
  640. 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
  641. },
  642. name: 'file',
  643. success: (res) => {
  644. const data = JSON.parse(res.data).data
  645. this.form.corpsFilesList.push({
  646. url: data.link,
  647. name: data.originalName,
  648. extname: this.getFileExtension(data.originalName),
  649. isDeleted: 0
  650. })
  651. uni.showToast({
  652. title: '上传成功',
  653. icon: 'none'
  654. });
  655. },
  656. fail: (err) => {
  657. uni.showToast({
  658. title: '上传失败',
  659. icon: 'none'
  660. });
  661. },
  662. complete: () => {
  663. uni.hideLoading()
  664. }
  665. })
  666. })
  667. },
  668. async submit() {
  669. if (!this.form.cname) {
  670. uni.showToast({
  671. title: '请输入店铺名称',
  672. icon: 'none'
  673. });
  674. return
  675. }
  676. if (this.form.corpsFilesList.filter(item => item.isDeleted == 0).length == 0) {
  677. uni.showToast({
  678. title: '请上传店面照片',
  679. icon: 'none'
  680. });
  681. return
  682. }
  683. if (!this.form.contacts) {
  684. uni.showToast({
  685. title: '请输入联系人',
  686. icon: 'none'
  687. });
  688. return
  689. }
  690. if (!this.form.contactsPhone) {
  691. uni.showToast({
  692. title: '请输入电话',
  693. icon: 'none'
  694. });
  695. return
  696. }
  697. if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.form.contactsPhone)) {
  698. uni.showToast({
  699. title: '请输入正确电话',
  700. icon: 'none'
  701. });
  702. return;
  703. }
  704. if (!this.form.salesmanName) {
  705. uni.showToast({
  706. title: '请选择业务员',
  707. icon: 'none'
  708. });
  709. return
  710. }
  711. if (!this.form.deliveryWarehouseName) {
  712. uni.showToast({
  713. title: '请选择发货仓库',
  714. icon: 'none'
  715. });
  716. return
  717. }
  718. if (!this.form.priceSystem) {
  719. uni.showToast({
  720. title: '请选择商城价格',
  721. icon: 'none'
  722. });
  723. return
  724. }
  725. if (!this.form.address) {
  726. uni.showToast({
  727. title: '请选择所属区域',
  728. icon: 'none'
  729. });
  730. return
  731. }
  732. if (!this.form.detailedAddress) {
  733. uni.showToast({
  734. title: '请输入详细地址',
  735. icon: 'none'
  736. });
  737. return
  738. }
  739. if (!this.form.corpsTypeId) {
  740. uni.showToast({
  741. title: '请选择店面分类',
  742. icon: 'none'
  743. });
  744. return
  745. }
  746. let obj = await this.convertData(this.$deepClone(this.form))
  747. uni.showLoading({
  748. title: '加载中',
  749. mask: true
  750. });
  751. submit(obj).then(res => {
  752. setTimeout(() => {
  753. uni.showToast({
  754. title: '保存成功',
  755. icon: 'none',
  756. });
  757. }, 10);
  758. uni.setStorageSync('isUpdate', true)
  759. this.getDetail(res.data.id)
  760. })
  761. .catch(() => {
  762. uni.hideLoading()
  763. });
  764. },
  765. getDetail(id) {
  766. let obj = {
  767. id: id
  768. }
  769. uni.showLoading({
  770. title: '加载中',
  771. mask: true
  772. });
  773. getDetail(obj).then(res => {
  774. if (res.data.corpsFilesList.length) {
  775. res.data.corpsFilesList.forEach(item => {
  776. item.name = item.fileName
  777. })
  778. }
  779. if (res.data.businessLicense) {
  780. res.data.businessLicense = JSON.parse(res.data.businessLicense)
  781. }
  782. res.data.label = res.data.label ? res.data.label.split(",") : []
  783. res.data.brandName = res.data.brandName ? res.data.brandName.split(",") : []
  784. this.form = res.data
  785. this.oldForm = res.data
  786. })
  787. .finally(() => {
  788. uni.hideLoading()
  789. });
  790. },
  791. async approval(type) {
  792. if (!this.form.cname) {
  793. uni.showToast({
  794. title: '请输入店铺名称',
  795. icon: 'none'
  796. });
  797. return
  798. }
  799. if (this.form.corpsFilesList.filter(item => item.isDeleted == 0).length == 0) {
  800. uni.showToast({
  801. title: '请上传店面照片',
  802. icon: 'none'
  803. });
  804. return
  805. }
  806. if (!this.form.contacts) {
  807. uni.showToast({
  808. title: '请输入联系人',
  809. icon: 'none'
  810. });
  811. return
  812. }
  813. if (!this.form.contactsPhone) {
  814. uni.showToast({
  815. title: '请输入电话',
  816. icon: 'none'
  817. });
  818. return
  819. }
  820. if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.form.contactsPhone)) {
  821. uni.showToast({
  822. title: '请输入正确电话',
  823. icon: 'none'
  824. });
  825. return;
  826. }
  827. if (!this.form.salesmanName) {
  828. uni.showToast({
  829. title: '请选择业务员',
  830. icon: 'none'
  831. });
  832. return
  833. }
  834. if (!this.form.deliveryWarehouseName) {
  835. uni.showToast({
  836. title: '请选择发货仓库',
  837. icon: 'none'
  838. });
  839. return
  840. }
  841. if (!this.form.priceSystem) {
  842. uni.showToast({
  843. title: '请选择商城价格',
  844. icon: 'none'
  845. });
  846. return
  847. }
  848. if (!this.form.address) {
  849. uni.showToast({
  850. title: '请选择所属区域',
  851. icon: 'none'
  852. });
  853. return
  854. }
  855. if (!this.form.detailedAddress) {
  856. uni.showToast({
  857. title: '请输入详细地址',
  858. icon: 'none'
  859. });
  860. return
  861. }
  862. if (!this.form.corpsTypeId) {
  863. uni.showToast({
  864. title: '请选择店面分类',
  865. icon: 'none'
  866. });
  867. return
  868. }
  869. let obj = await this.convertData(this.$deepClone(this.form))
  870. console.log(obj)
  871. let _this = this
  872. uni.showModal({
  873. title: '提示',
  874. content: type == 1 ? '是否通过审核?' : '是否驳回审核?',
  875. success: function(res) {
  876. if (res.confirm) {
  877. obj.type = type
  878. uni.showLoading({
  879. title: '加载中',
  880. mask: true
  881. });
  882. submit(obj).then(res => {
  883. review(obj).then(res => {
  884. uni.showToast({
  885. title: '操作成功',
  886. icon: 'none',
  887. duration: 2000
  888. });
  889. _this.getDetail(res.data.id)
  890. })
  891. .catch(() => {
  892. uni.hideLoading()
  893. });
  894. }).catch(() => {
  895. uni.hideLoading()
  896. })
  897. }
  898. }
  899. });
  900. },
  901. async convertData(obj) {
  902. if (obj.corpsFilesList.length) {
  903. obj.corpsFilesList.filter(item => item.isDeleted == 0).forEach((item, index) => {
  904. if (index == 0) {
  905. item.mainImage = 1
  906. }
  907. item.fileName = item.name
  908. })
  909. }
  910. if (obj.businessLicense) {
  911. obj.businessLicense = JSON.stringify(obj.businessLicense)
  912. }
  913. obj.label = obj.label ? obj.label.join(",") : null
  914. obj.brandName = obj.brandName ? obj.brandName.join(",") : null
  915. if (obj.signingPeriodEnd) {
  916. obj.signingPeriodEnd = obj.signingPeriodEnd.slice(0, 10) + ' 00:00:00'
  917. }
  918. return obj
  919. }
  920. }
  921. }
  922. </script>
  923. <style lang="scss" scoped>
  924. .right-align {
  925. text-align: right;
  926. }
  927. .photo {
  928. margin-left: 20rpx;
  929. width: 38rpx;
  930. height: 32rpx;
  931. }
  932. ::v-deep .uni-section .uni-section-header {
  933. font-weight: bold !important;
  934. padding: 12px 0px !important;
  935. border-bottom: 2px solid #F6F6F6;
  936. }
  937. ::v-deep .uni-file-picker__container {
  938. justify-content: flex-end !important;
  939. }
  940. ::v-deep .uni-file-picker .file-picker__box-content {
  941. overflow: revert;
  942. z-index: 9;
  943. }
  944. ::v-deep .icon-del-box {
  945. height: 26rpx;
  946. width: 26rpx;
  947. top: -2rpx;
  948. right: -8rpx;
  949. z-index: 999;
  950. }
  951. ::v-deep .icon-del {
  952. width: 14rpx;
  953. height: 2rpx;
  954. }
  955. .slot-content-item {
  956. border-radius: 13rpx;
  957. border: 2rpx solid #03803B;
  958. padding: 1rpx 5rpx;
  959. color: #03803B;
  960. }
  961. .slot-content-item-placeholder {
  962. font-weight: 400 !important;
  963. font-size: 28rpx !important;
  964. height: 38rpx !important;
  965. color: #B5B4B4 !important;
  966. }
  967. .slot-box {
  968. gap: 5px;
  969. display: flex;
  970. flex-wrap: wrap;
  971. justify-content: flex-end;
  972. width: 100%;
  973. }
  974. .popup-content {
  975. background: #fff;
  976. padding: 40rpx 20rpx;
  977. border-radius: 24rpx 24rpx 0 0;
  978. }
  979. .popup-content-checkbox {
  980. height: 600rpx;
  981. }
  982. .confirm-btn {
  983. margin-top: 30rpx;
  984. color: #ffffff;
  985. background: #03803B;
  986. width: 400rpx;
  987. }
  988. ::v-deep .icon-add {
  989. width: 36px !important;
  990. }
  991. ::v-deep .uni-date-x .uni-icons {
  992. color: #03803B !important;
  993. }
  994. </style>