| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000 |
- <template>
- <view class="">
- <uni-section title="基本信息" style="padding: 0 62rpx;" titleColor="5F5F5F" titleFontSize="28rpx">
- <uni-forms ref="form1" :modelValue="form" :border="true" label-width="80">
- <uni-forms-item name="cname" label="店铺名称" required>
- <uni-easyinput v-model="form.cname" class="right-align" placeholder-class="placeholder-right"
- placeholder="请输入内容" :inputBorder="false" :clearable="false" :disabled="form.enableOrNot==1">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="corpsFilesList" label="店面照片" required>
- <view style="display: flex;align-items: center;">
- <uni-file-picker :value="form.corpsFilesList.filter(item=>item.isDeleted==0)"
- return-type="array" limit="9" :imageStyles="imageStyles" :auto-upload="false"
- @select="corpsfileSelect" @delete="fileDelete" :del-icon="!(form.enableOrNot==1)"
- :disabled="form.enableOrNot==1"></uni-file-picker>
- </view>
- </uni-forms-item>
- <uni-forms-item name="businessLicense" label="营业执照">
- <view style="display: flex;align-items: center;">
- <uni-file-picker v-model="form.businessLicense" return-type="object" limit="1"
- :imageStyles="imageStyles" file-mediatype="image" @select="businessLicenseSelect"
- :del-icon="!(form.enableOrNot==1)" :disabled="form.enableOrNot==1">
- </uni-file-picker>
- </view>
- </uni-forms-item>
- <uni-forms-item name="contacts" label="联系人" required>
- <uni-easyinput v-model="form.contacts" class="right-align" placeholder-class="placeholder-right"
- placeholder="请输入内容" :inputBorder="false" :clearable="false"
- :disabled="form.enableOrNot==1"></uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="contactsPhone" label="电话" required>
- <uni-easyinput v-model="form.contactsPhone" class="right-align" type="number"
- placeholder-class="placeholder-right" placeholder="请输入内容" :inputBorder="false"
- :clearable="false" :disabled="form.enableOrNot==1" maxlength="11"
- @change="photoChange"></uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="salesmanName" label="业务员" required>
- <view style="display: flex;align-items: center;height: 36px;">
- <view @click="getSalerList();form.enableOrNot!=1?salesmanShow=true:null"
- style="width: 100%;text-align: right;"
- :style="form.salesmanName?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
- {{form.salesmanName||'请选择'}}
- </view>
- <uni-icons v-if="!form.salesmanName" type="down" size="14" color='#BCBCBC'
- @click="getSalerList();form.enableOrNot!=1?salesmanShow=true:null"></uni-icons>
- </view>
- <u-picker :show="salesmanShow" :columns="salesmanList" keyName="name" @confirm="salesmanConfirm"
- @cancel="salesmanShow=false" @close="salesmanShow=false" closeOnClickOverlay></u-picker>
- </uni-forms-item>
- <uni-forms-item name="deliveryWarehouseName" label="发货仓库" required>
- <view style="display: flex;align-items: center;height: 36px;">
- <view @click="getStorageList();form.enableOrNot!=1?deliveryWarehouseShow=true:null"
- style="width: 100%;text-align: right;"
- :style="form.deliveryWarehouseName?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
- {{form.deliveryWarehouseName||'请选择'}}
- </view>
- <uni-icons v-if="!form.deliveryWarehouseName" type="down" size="14" color='#BCBCBC'
- @click="getStorageList();form.enableOrNot!=1?deliveryWarehouseShow=true:null"></uni-icons>
- </view>
- <u-picker :show="deliveryWarehouseShow" :columns="deliveryWarehouseList" keyName="cname"
- @confirm="deliveryWarehouseConfirm" @cancel="deliveryWarehouseShow=false"
- @close="deliveryWarehouseShow=false" closeOnClickOverlay></u-picker>
- </uni-forms-item>
- <uni-forms-item name="priceSystem" label="商城价格" required>
- <view style="display: flex;align-items: center;height: 36px;">
- <view @click="form.enableOrNot!=1?priceSystemShow=true:null"
- style="width: 100%;text-align: right;"
- :style="form.priceSystem?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
- {{form.priceSystem||'请选择'}}
- </view>
- <uni-icons v-if="!form.priceSystem" type="down" size="14" color='#BCBCBC'
- @click="form.enableOrNot!=1?priceSystemShow=true:null"></uni-icons>
- </view>
- <u-picker :show="priceSystemShow" :columns="priceSystemList" keyName="dictValue"
- @confirm="priceSystemConfirm" @cancel="priceSystemShow=false" @close="priceSystemShow=false"
- closeOnClickOverlay></u-picker>
- </uni-forms-item>
- <uni-forms-item name="brandName" label="品牌">
- <view>
- <view style="display: flex;align-items: center;height: 36px;">
- <view class="slot-box" @click="brandPopup">
- <view v-for="(item,index) in sliceArray(form.brandName)" :key="index"
- class="slot-content-item">
- {{item}}
- </view>
- <view v-if="form.brandName.length > 2" class="slot-content-item">
- +{{form.brandName.length - 2}}</view>
- <view v-if="form.brandName.length == 0" style="color:#B5B4B4;font-size: 24rpx;">
- 请选择
- </view>
- </view>
- <uni-icons v-if="!form.brandName.length" type="down" size="14" color='#BCBCBC'
- @click="brandPopup"></uni-icons>
- </view>
- <uni-popup ref="brand" type="bottom" @change="popupChange">
- <view class="popup-content">
- <view class="popup-content-checkbox">
- <scroll-view scroll-y="true" style="height: 600rpx;" :show-scrollbar="false">
- <uni-data-checkbox mode="tag" multiple v-model="form.brandName"
- :localdata="brandList" @change="brandChange" selectedColor='#03803B'
- :map="brandObject" />
- </scroll-view>
- </view>
- <debounce-button class="confirm-btn" @click="brandConfirm">确认</debounce-button>
- </view>
- </uni-popup>
- </view>
- </uni-forms-item>
- <uni-forms-item name="address" label="所属区域" required>
- <!-- <uni-data-picker v-model="form.address" :localdata="addressData" popup-title="请选择所属区域"
- :map="mapObject" :inputBorder="false" :clear-icon="false"
- :readonly="form.enableOrNot==1"></uni-data-picker> -->
- <view style="display: flex;align-items: center;height: 36px;">
- <view @click="openMap" style="width: 100%;text-align: right;"
- :style="form.address?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
- {{form.address||'请选择'}}
- </view>
- <uni-icons v-if="!form.address" type="location" size="24" color='#03803B'
- @click="openMap"></uni-icons>
- </view>
- </uni-forms-item>
- <uni-forms-item name="detailedAddress" label="详细地址" required>
- <uni-easyinput v-model="form.detailedAddress" type="textarea" autoHeight class="right-align"
- placeholder-class="placeholder-right" placeholder="请输入内容" :inputBorder="false"
- :clearable="false" :disabled="form.enableOrNot==1"></uni-easyinput>
- </uni-forms-item>
- </uni-forms>
- </uni-section>
- <uni-section title="店面分类" style="padding: 0 62rpx;margin-top: 30rpx;" titleColor="5F5F5F" titleFontSize="28rpx">
- <uni-forms ref="form2" :modelValue="form" :border="true" label-width="80">
- <uni-forms-item name="corpsTypeName" label="店面分类" required>
- <view style="display: flex;align-items: center;height: 36px;">
- <view @click="getSelectType();form.enableOrNot!=1?corpsTypeShow=true:null"
- style="width: 100%;text-align: right;"
- :style="form.corpsTypeName?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
- {{form.corpsTypeName||'请选择'}}
- </view>
- <uni-icons v-if="!form.corpsTypeName" type="down" size="14" color='#BCBCBC'
- @click="getSelectType();form.enableOrNot!=1?corpsTypeShow=true:null"></uni-icons>
- </view>
- <u-picker :show="corpsTypeShow" :columns="corpsTypeList" keyName="cname" @confirm="corpsTypeConfirm"
- @cancel="corpsTypeShow=false" @close="corpsTypeShow=false" closeOnClickOverlay></u-picker>
- </uni-forms-item>
- <uni-forms-item name="storeAttributes" label="店面属性">
- <view>
- <view style="display: flex;align-items: center;height: 36px;">
- <view @click="form.enableOrNot!=1?storeAttributesShow=true:null"
- style="width: 100%;text-align: right;"
- :style="form.storeAttributes?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
- {{form.storeAttributes||'请选择'}}
- </view>
- <uni-icons v-if="!form.storeAttributes" type="down" size="14" color='#BCBCBC'
- @click="form.enableOrNot!=1?storeAttributesShow=true:null"></uni-icons>
- </view>
- <u-picker :show="storeAttributesShow" :columns="storeAttributesList" keyName="dictValue"
- @confirm="storeAttributesConfirm" @cancel="storeAttributesShow=false"
- @close="storeAttributesShow=false" closeOnClickOverlay></u-picker>
- </view>
- </uni-forms-item>
- <uni-forms-item name="chainAttribute" label="连锁属性">
- <view>
- <view style="display: flex;align-items: center;height: 36px;">
- <view @click="form.enableOrNot!=1?chainAttributeShow=true:null"
- style="width: 100%;text-align: right;"
- :style="form.chainAttribute?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
- {{form.chainAttribute||'请选择'}}
- </view>
- <uni-icons v-if="!form.chainAttribute" type="down" size="14" color='#BCBCBC'
- @click="form.enableOrNot!=1?chainAttributeShow=true:null"></uni-icons>
- </view>
- <u-picker :show="chainAttributeShow" :columns="chainAttributeList" keyName="dictValue"
- @confirm="chainAttributeConfirm" @cancel="chainAttributeShow=false"
- @close="chainAttributeShow=false" closeOnClickOverlay></u-picker>
- </view>
- </uni-forms-item>
- <uni-forms-item name="label" label="店面标签">
- <view>
- <view style="display: flex;align-items: center;height: 36px;">
- <view class="slot-box" @click="openPopup">
- <view v-for="(item,index) in sliceArray(form.label)" :key="index"
- class="slot-content-item">
- {{item}}
- </view>
- <view v-if="form.label.length > 2" class="slot-content-item">
- +{{form.label.length - 2}}</view>
- <view v-if="form.label.length == 0" style="color:#B5B4B4;font-size: 24rpx;">
- 请选择
- </view>
- </view>
- <uni-icons v-if="!form.label.length" type="down" size="14" color='#BCBCBC'
- @click="openPopup"></uni-icons>
- </view>
- <uni-popup ref="popup" type="bottom" @change="popupChange">
- <view class="popup-content">
- <view class="popup-content-checkbox">
- <scroll-view scroll-y="true" style="height: 600rpx;" :show-scrollbar="false">
- <uni-data-checkbox mode="tag" multiple v-model="form.label"
- :localdata="labelList" @change="onChange" selectedColor='#03803B'
- :map="labelObject" />
- </scroll-view>
- </view>
- <debounce-button class="confirm-btn" @click="labelConfirm">确认</debounce-button>
- </view>
- </uni-popup>
- </view>
- </uni-forms-item>
- </uni-forms>
- </uni-section>
- <uni-section title="商务政策" style="padding: 0 62rpx;margin-top: 30rpx;" titleColor="5F5F5F" titleFontSize="28rpx">
- <uni-forms ref="form3" :modelValue="form" :border="true" label-width="80">
- <uni-forms-item name="signingLevel" label="签约级别">
- <!-- <uni-data-select v-model="form.signingLevel" :localdata="signingLevelList">
- </uni-data-select> -->
- <view>
- <view style="display: flex;align-items: center;height: 36px;">
- <view @click="form.enableOrNot!=1?signingLevelShow=true:null"
- style="width: 100%;text-align: right;"
- :style="form.signingLevel?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
- {{form.signingLevel||'请选择'}}
- </view>
- <uni-icons v-if="!form.signingLevel" type="down" size="14" color='#BCBCBC'
- @click="form.enableOrNot!=1?signingLevelShow=true:null"></uni-icons>
- </view>
- <u-picker :show="signingLevelShow" :columns="signingLevelList" keyName="dictValue"
- @confirm="signingLevelConfirm" @cancel="signingLevelShow=false"
- @close="signingLevelShow=false" closeOnClickOverlay></u-picker>
- </view>
- </uni-forms-item>
- <uni-forms-item name="signingNumber" label="签约条数">
- <uni-easyinput v-model="form.signingNumber" class="right-align"
- placeholder-class="placeholder-right" placeholder="请输入内容" :inputBorder="false"
- :clearable="false" :disabled="form.enableOrNot==1" type="number"
- @blur="intBlur('signingNumber',form.signingNumber)"></uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="signingPeriodEnd" label="签约期限">
- <uni-datetime-picker v-model="form.signingPeriodEnd" type="date" :clear-icon="false" :border="false"
- placeholder="请选择签约期限" :disabled="form.enableOrNot==1"></uni-datetime-picker>
- </uni-forms-item>
- <uni-forms-item name="checkStatus" label="门店状态">
- <view style="display: flex;justify-content: flex-end;align-items: center;height: 70rpx;">
- <text v-if="form.checkStatus=='录入'" style="color:#e6a23c">
- 录入
- </text>
- <text v-if="form.checkStatus=='提交'" style="color:#409EFF">
- 提交
- </text>
- <text v-if="form.checkStatus=='审核通过'" style="color:#67c23a">
- 审核通过
- </text>
- <text v-if="form.checkStatus=='审核驳回'" style="color:#f56c6c">
- 审核驳回
- </text>
- </view>
- </uni-forms-item>
- </uni-forms>
- </uni-section>
- <!--<view v-if="form.enableOrNot!=1" style="padding:30rpx 20rpx;">
- <view>
- <debounce-button bgColor="#03803B" @click="submit">保存</debounce-button>
- </view>
- </view> -->
- <view v-if="form.enableOrNot!=1" class="nav-bottom-height">
- </view>
- <view v-if="form.enableOrNot!=1&&!popupShow" class="goods-nav-bottom">
- <uni-goods-nav v-if="form.checkStatus=='录入'||form.checkStatus=='审核驳回'" :fill="true" :options="[]" :buttonGroup="buttonGroup"
- @buttonClick="buttonClick" />
- <uni-goods-nav v-if="!(form.checkStatus=='录入'||form.checkStatus=='审核驳回')" :fill="true" :options="[]" :buttonGroup="buttonGroup2"
- @buttonClick="buttonClick2" />
- </view>
- </view>
- </template>
- <script>
- import http from '@/http/api.js'
- import {
- clientId,
- clientSecret
- } from '@/common/setting'
- import {
- submit,
- getDetail,
- review,
- selectType,
- selectLabel,
- fileRemove,
- salerList,
- storageList,
- brandDesc
- } from '@/api/home/store.js'
- export default {
- data() {
- return {
- popupShow:false,
- buttonGroup: [{
- text: '通过',
- backgroundColor: '#18bc37',
- color: '#fff'
- },
- {
- text: '驳回',
- backgroundColor: '#e64340',
- color: '#fff'
- }
- ],
- buttonGroup2: [{
- text: '保存',
- backgroundColor: '#03803B',
- color: '#fff'
- }],
- corpsTypeShow: false,
- storeAttributesShow: false,
- chainAttributeShow: false,
- signingLevelShow: false,
- salesmanShow: false,
- deliveryWarehouseShow: false,
- priceSystemShow: false,
- form: {
- corpsTypeId: null,
- corpsTypeName: null,
- storeAttributes: null,
- chainAttribute: null,
- signingLevel: null,
- dimension: null,
- longitude: null,
- address: null,
- detailedAddress: null,
- label: [],
- brandName: [],
- corpsFilesList: [],
- businessLicense: {}
- },
- imageStyles: {
- width: 46,
- height: 46
- },
- mapObject: {
- text: 'name',
- value: 'code',
- children: 'children'
- },
- labelObject: {
- text: 'label',
- value: 'label',
- },
- brandObject: {
- text: 'cname',
- value: 'cname',
- },
- addressData: [],
- labelList: [],
- corpsTypeList: [],
- storeAttributesList: [],
- chainAttributeList: [],
- signingLevelList: [],
- salesmanList: [],
- brandList: [],
- deliveryWarehouseList: [],
- priceSystemList: [],
- mapData: {},
- errData: {},
- }
- },
- onLoad(option) {
- uni.$on('commitCheck', (data) => {
- this.form.address = (data.province ? data.province : '') + (data.city ? "," + data.city :
- '') + (data.district ? "," + data.district : '')
- this.form.detailedAddress = data.name
- this.form.longitude = data.location ? data.location.split(',')[0] : null
- this.form.dimension = data.location ? data.location.split(',')[1] : null
- });
- this.getSelectType()
- this.getLabel()
- this.getSalerList()
- this.getStorageList()
- this.getDictionary()
- this.getBrandlist()
- if (option && option.id) {
- this.getDetail(option.id)
- }
- },
- onUnload() {
- uni.$off();
- },
- methods: {
- popupChange(e){
- console.log(e)
- this.popupShow=e.show
- },
- buttonClick(e) {
- if (e.index == 0) {
- this.approval(1)
- }
- if (e.index == 1) {
- this.approval(2)
- }
- },
- buttonClick2(e) {
- if (e.index == 0) {
- this.submit()
- }
- },
- openMap() {
- if (this.form.enableOrNot != 1) {
- if (this.form.longitude && this.form.dimension) {
- uni.navigateTo({
- url: `/pages/home/store/map/index?longitude=${this.form.longitude}&latitude=${this.form.dimension}`
- });
- } else {
- uni.navigateTo({
- url: `/pages/home/store/map/index`
- });
- }
- }
- },
- photoChange(val) {
- if (val) {
- if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(val)) {
- uni.showToast({
- title: '请输入正确电话',
- icon: 'none'
- });
- return;
- }
- }
- },
- intBlur(name, value) {
- if (!this.form[name]) return
- // 使用toFixed处理小数位
- try {
- const num = parseFloat(this.form[name])
- if (!isNaN(num)) {
- this.form[name] = Math.floor(num).toFixed(0)
- }
- } catch (e) {
- console.error('格式化错误', e)
- }
- },
- openPopup() {
- if (this.form.enableOrNot != 1) {
- this.getLabel()
- this.$refs.popup.open()
- }
- },
- brandPopup() {
- if (this.form.enableOrNot != 1) {
- this.getBrandlist()
- this.$refs.brand.open()
- }
- },
- onChange(e) {
- console.log('当前选中:', e.detail.value)
- },
- brandChange(e) {
- console.log('当前选中:', e.detail)
- let ids = []
- e.detail.data.forEach(item => {
- ids.push(item.id)
- })
- this.form.brandId = ids.join(',')
- },
- labelConfirm() {
- this.$refs.popup.close()
- // 提交选中值逻辑...
- },
- brandConfirm() {
- this.$refs.brand.close()
- // 提交选中值逻辑...
- },
- clear(name) {
- if (name == 'corpsTypeName') {
- this.form.corpsTypeId = null
- this.form.corpsTypeName = null
- }
- if (name == 'salesmanName') {
- this.form.salesmanId = null
- this.form.salesmanName = null
- }
- if (name == 'deliveryWarehouseName') {
- this.form.deliveryWarehouseId = null
- this.form.deliveryWarehouseName = null
- }
- },
- salesmanConfirm(row) {
- this.form.salesmanId = row.value[0].id
- this.form.salesmanName = row.value[0].name
- this.salesmanShow = false
- },
- deliveryWarehouseConfirm(row) {
- this.form.deliveryWarehouseId = row.value[0].id
- this.form.deliveryWarehouseName = row.value[0].cname
- this.deliveryWarehouseShow = false
- },
- priceSystemConfirm(row) {
- this.form.priceSystem = row.value[0].dictValue
- this.priceSystemShow = false
- },
- corpsTypeConfirm(row) {
- this.form.corpsTypeId = row.value[0].id
- this.form.corpsTypeName = row.value[0].cname
- this.corpsTypeShow = false
- },
- storeAttributesConfirm(row) {
- this.form.storeAttributes = row.value[0].dictValue
- this.storeAttributesShow = false
- },
- chainAttributeConfirm(row) {
- this.form.chainAttribute = row.value[0].dictValue
- this.chainAttributeShow = false
- },
- signingLevelConfirm(row) {
- this.form.signingLevel = row.value[0].dictValue
- this.signingLevelShow = false
- },
- getDictionary() {
- this.$u.api.dictionary('storeAttributes').then(res => {
- this.storeAttributesList = [res.data]
- })
- this.$u.api.dictionary('chainAttribute').then(res => {
- this.chainAttributeList = [res.data]
- })
- this.$u.api.dictionary('signingLevel').then(res => {
- this.signingLevelList = [res.data]
- })
- this.$u.api.dictionary('mall_price').then(res => {
- this.priceSystemList = [res.data]
- })
- },
- sliceArray(ls) {
- if (Array.isArray(ls)) {
- return ls.slice(0, 2)
- }
- return ls
- },
- getSelectType() {
- selectType().then(res => {
- this.corpsTypeList = [res.data]
- })
- },
- getLabel() {
- selectLabel().then(res => {
- this.labelList = res.data
- })
- },
- getSalerList() {
- salerList().then(res => {
- this.salesmanList = [res.data]
- })
- },
- getStorageList() {
- storageList().then(res => {
- this.deliveryWarehouseList = [res.data]
- })
- },
- getBrandlist() {
- brandDesc().then(res => {
- this.brandList = res.data
- })
- },
- getFileExtension(filename) {
- return filename.slice(((filename.lastIndexOf(".") - 1) >>> 0) + 2);
- },
- businessLicenseSelect(files) {
- files.tempFiles.forEach(file => {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- uni.uploadFile({
- url: http.config.baseURL +
- '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
- filePath: file.path,
- header: {
- // 客户端认证参数
- 'Authorization': 'Basic ' + Base64.encode(clientId + ':' + clientSecret),
- 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
- },
- name: 'file',
- success: (res) => {
- const data = JSON.parse(res.data).data
- this.form.businessLicense = {
- url: data.link,
- name: data.originalName,
- extname: this.getFileExtension(data.originalName)
- }
- this.form.businessLicenseUrl = data.link
- uni.showToast({
- title: '上传成功',
- icon: 'none'
- });
- },
- fail: (err) => {
- uni.showToast({
- title: '上传失败',
- icon: 'none'
- });
- },
- complete: () => {
- uni.hideLoading()
- }
- })
- })
- },
- fileDelete(row) {
- uni.showToast({
- title: '删除成功',
- icon: 'none'
- });
- this.form.corpsFilesList.filter(item => item.isDeleted == 0)[row.index].isDeleted = 1
- },
- corpsfileSelect(files) {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- files.tempFiles.forEach(file => {
- uni.uploadFile({
- url: http.config.baseURL +
- '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
- filePath: file.path,
- header: {
- // 客户端认证参数
- 'Authorization': 'Basic ' + Base64.encode(clientId + ':' + clientSecret),
- 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
- },
- name: 'file',
- success: (res) => {
- const data = JSON.parse(res.data).data
- this.form.corpsFilesList.push({
- url: data.link,
- name: data.originalName,
- extname: this.getFileExtension(data.originalName),
- isDeleted: 0
- })
- uni.showToast({
- title: '上传成功',
- icon: 'none'
- });
- },
- fail: (err) => {
- uni.showToast({
- title: '上传失败',
- icon: 'none'
- });
- },
- complete: () => {
- uni.hideLoading()
- }
- })
- })
- },
- async submit() {
- if (!this.form.cname) {
- uni.showToast({
- title: '请输入店铺名称',
- icon: 'none'
- });
- return
- }
- if (this.form.corpsFilesList.filter(item => item.isDeleted == 0).length == 0) {
- uni.showToast({
- title: '请上传店面照片',
- icon: 'none'
- });
- return
- }
- if (!this.form.contacts) {
- uni.showToast({
- title: '请输入联系人',
- icon: 'none'
- });
- return
- }
- if (!this.form.contactsPhone) {
- uni.showToast({
- title: '请输入电话',
- icon: 'none'
- });
- return
- }
- if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.form.contactsPhone)) {
- uni.showToast({
- title: '请输入正确电话',
- icon: 'none'
- });
- return;
- }
- if (!this.form.salesmanName) {
- uni.showToast({
- title: '请选择业务员',
- icon: 'none'
- });
- return
- }
- if (!this.form.deliveryWarehouseName) {
- uni.showToast({
- title: '请选择发货仓库',
- icon: 'none'
- });
- return
- }
- if (!this.form.priceSystem) {
- uni.showToast({
- title: '请选择商城价格',
- icon: 'none'
- });
- return
- }
- if (!this.form.address) {
- uni.showToast({
- title: '请选择所属区域',
- icon: 'none'
- });
- return
- }
- if (!this.form.detailedAddress) {
- uni.showToast({
- title: '请输入详细地址',
- icon: 'none'
- });
- return
- }
- if (!this.form.corpsTypeId) {
- uni.showToast({
- title: '请选择店面分类',
- icon: 'none'
- });
- return
- }
- let obj = await this.convertData(this.$deepClone(this.form))
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- submit(obj).then(res => {
- setTimeout(() => {
- uni.showToast({
- title: '保存成功',
- icon: 'none',
- });
- }, 10);
- uni.setStorageSync('isUpdate', true)
- this.getDetail(res.data.id)
- })
- .catch(() => {
- uni.hideLoading()
- });
- },
- getDetail(id) {
- let obj = {
- id: id
- }
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- getDetail(obj).then(res => {
- if (res.data.corpsFilesList.length) {
- res.data.corpsFilesList.forEach(item => {
- item.name = item.fileName
- })
- }
- if (res.data.businessLicense) {
- res.data.businessLicense = JSON.parse(res.data.businessLicense)
- }
- res.data.label = res.data.label ? res.data.label.split(",") : []
- res.data.brandName = res.data.brandName ? res.data.brandName.split(",") : []
- this.form = res.data
- })
- .finally(() => {
- uni.hideLoading()
- });
- },
- async approval(type) {
- if (!this.form.cname) {
- uni.showToast({
- title: '请输入店铺名称',
- icon: 'none'
- });
- return
- }
- if (this.form.corpsFilesList.filter(item => item.isDeleted == 0).length == 0) {
- uni.showToast({
- title: '请上传店面照片',
- icon: 'none'
- });
- return
- }
- if (!this.form.contacts) {
- uni.showToast({
- title: '请输入联系人',
- icon: 'none'
- });
- return
- }
- if (!this.form.contactsPhone) {
- uni.showToast({
- title: '请输入电话',
- icon: 'none'
- });
- return
- }
- if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.form.contactsPhone)) {
- uni.showToast({
- title: '请输入正确电话',
- icon: 'none'
- });
- return;
- }
- if (!this.form.salesmanName) {
- uni.showToast({
- title: '请选择业务员',
- icon: 'none'
- });
- return
- }
- if (!this.form.deliveryWarehouseName) {
- uni.showToast({
- title: '请选择发货仓库',
- icon: 'none'
- });
- return
- }
- if (!this.form.priceSystem) {
- uni.showToast({
- title: '请选择商城价格',
- icon: 'none'
- });
- return
- }
- if (!this.form.address) {
- uni.showToast({
- title: '请选择所属区域',
- icon: 'none'
- });
- return
- }
- if (!this.form.detailedAddress) {
- uni.showToast({
- title: '请输入详细地址',
- icon: 'none'
- });
- return
- }
- if (!this.form.corpsTypeId) {
- uni.showToast({
- title: '请选择店面分类',
- icon: 'none'
- });
- return
- }
- let obj = await this.convertData(this.$deepClone(this.form))
- console.log(obj)
- let _this = this
- uni.showModal({
- title: '提示',
- content: type == 1 ? '是否通过审核?' : '是否驳回审核?',
- success: function(res) {
- if (res.confirm) {
- obj.type = type
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- submit(obj).then(res => {
- review(obj).then(res => {
- uni.showToast({
- title: '操作成功',
- icon: 'none',
- duration: 2000
- });
- _this.getDetail(res.data.id)
- })
- .catch(() => {
- uni.hideLoading()
- });
- }).catch(() => {
- uni.hideLoading()
- })
- }
- }
- });
- },
- async convertData(obj) {
- if (obj.corpsFilesList.length) {
- obj.corpsFilesList.filter(item => item.isDeleted == 0).forEach((item, index) => {
- if (index == 0) {
- item.mainImage = 1
- }
- item.fileName = item.name
- })
- }
- if (obj.businessLicense) {
- obj.businessLicense = JSON.stringify(obj.businessLicense)
- }
- obj.label = obj.label ? obj.label.join(",") : null
- obj.brandName = obj.brandName ? obj.brandName.join(",") : null
- if (obj.signingPeriodEnd) {
- obj.signingPeriodEnd = obj.signingPeriodEnd.slice(0, 10) + ' 00:00:00'
- }
- return obj
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .right-align {
- text-align: right;
- }
- .photo {
- margin-left: 20rpx;
- width: 38rpx;
- height: 32rpx;
- }
- ::v-deep .uni-section .uni-section-header {
- font-weight: bold !important;
- padding: 12px 0px !important;
- border-bottom: 2px solid #F6F6F6;
- }
- ::v-deep .uni-file-picker__container {
- justify-content: flex-end !important;
- }
- ::v-deep .uni-file-picker .file-picker__box-content {
- overflow: revert;
- z-index: 9;
- }
- ::v-deep .icon-del-box {
- height: 26rpx;
- width: 26rpx;
- top: -2rpx;
- right: -8rpx;
- z-index: 999;
- }
- ::v-deep .icon-del {
- width: 14rpx;
- height: 2rpx;
- }
- .slot-content-item {
- border-radius: 13rpx;
- border: 2rpx solid #03803B;
- padding: 1rpx 5rpx;
- color: #03803B;
- }
- .slot-content-item-placeholder {
- font-weight: 400 !important;
- font-size: 28rpx !important;
- height: 38rpx !important;
- color: #B5B4B4 !important;
- }
- .slot-box {
- gap: 5px;
- display: flex;
- flex-wrap: wrap;
- justify-content: flex-end;
- width: 100%;
- }
- .popup-content {
- background: #fff;
- padding: 40rpx 20rpx;
- border-radius: 24rpx 24rpx 0 0;
- }
- .popup-content-checkbox {
- height: 600rpx;
- }
- .confirm-btn {
- margin-top: 30rpx;
- color: #ffffff;
- background: #03803B;
- width: 400rpx;
- }
- ::v-deep .icon-add {
- width: 36px !important;
- }
- ::v-deep .uni-date-x .uni-icons {
- color: #03803B !important;
- }
- </style>
|