details.vue 28 KB

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