123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914 |
- <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"
- :readonly="form.enableOrNot==1"></uni-file-picker>
- <image class="photo" src="@/static/images/home/store/photo.png" />
- </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" :del-icon="false"
- disable-preview :imageStyles="imageStyles" file-mediatype="image"
- @select="businessLicenseSelect" :readonly="form.enableOrNot==1">
- </uni-file-picker>
- <image class="photo" src="@/static/images/home/store/photo.png" />
- </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"
- placeholder-class="placeholder-right" placeholder="请输入内容" :inputBorder="false"
- :clearable="false" :disabled="form.enableOrNot==1"></uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="salesmanName" label="业务员" required>
- <view style="display: flex;align-items: center;height: 36px;">
- <view @click="form.enableOrNot!=1?salesmanShow=true:null" style="width: 100%;text-align: right;"
- :style="form.salesmanName?'color:#000;':'color:#B5B4B4;'">
- {{form.salesmanName||'请选择'}}
- </view>
- <uni-icons v-if="!form.salesmanName" type="down" size="14" color='#999999'
- @click="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="form.enableOrNot!=1?deliveryWarehouseShow=true:null" style="width: 100%;text-align: right;"
- :style="form.deliveryWarehouseName?'color:#000;':'color:#B5B4B4;'">
- {{form.deliveryWarehouseName||'请选择'}}
- </view>
- <uni-icons v-if="!form.deliveryWarehouseName" type="down" size="14" color='#999999'
- @click="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="priceSystemShow=true" style="width: 100%;text-align: right;"
- :style="form.priceSystem?'color:#000;':'color:#B5B4B4;'">
- {{form.priceSystem||'请选择'}}
- </view>
- <uni-icons v-if="!form.priceSystem" type="down" size="14" color='#999999'
- @click="priceSystemShow=true"></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;">
- 请选择
- </view>
- </view>
- <uni-icons v-if="!form.brandName.length" type="down" size="14" color='#999999'
- @click="brandPopup"></uni-icons>
- </view>
- <uni-popup ref="brand" type="bottom">
- <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>
- <button class="confirm-btn" @click="brandConfirm">确认</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>
- </uni-forms-item>
- <uni-forms-item name="detailedAddress" label="详细地址" required>
- <uni-easyinput v-model="form.detailedAddress" 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="form.enableOrNot!=1?corpsTypeShow=true:null" style="width: 100%;text-align: right;"
- :style="form.corpsTypeName?'color:#000;':'color:#B5B4B4;'">
- {{form.corpsTypeName||'请选择'}}
- </view>
- <uni-icons v-if="!form.corpsTypeName" type="down" size="14" color='#999999'
- @click="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;'">
- {{form.storeAttributes||'请选择'}}
- </view>
- <uni-icons v-if="!form.storeAttributes" type="down" size="14" color='#999999'
- @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;'">
- {{form.chainAttribute||'请选择'}}
- </view>
- <uni-icons v-if="!form.chainAttribute" type="down" size="14" color='#999999'
- @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;">
- 请选择
- </view>
- </view>
- <uni-icons v-if="!form.label.length" type="down" size="14" color='#999999'
- @click="openPopup"></uni-icons>
- </view>
- <uni-popup ref="popup" type="bottom">
- <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>
- <button class="confirm-btn" @click="labelConfirm">确认</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">
- <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;'">
- {{form.signingLevel||'请选择'}}
- </view>
- <uni-icons v-if="!form.signingLevel" type="down" size="14" color='#999999'
- @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 v-if="form.checkStatus=='录入'||form.checkStatus=='审核驳回'"
- style="display: flex;margin-bottom: 20rpx;justify-content: space-between;">
- <button style="color:#ffffff;backgroundColor:#18bc37;width: 260rpx;" @click="approval(1)">通过</button>
- <button type="warn" style="color:#ffffff;width: 260rpx;" @click="approval(2)">驳回</button>
- </view>
- <view class="">
- <button style="color:#ffffff;backgroundColor:#03803B;" @click="submit">保存</button>
- </view>
- </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 {
- 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,
- 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: []
- }
- },
- onLoad(option) {
- this.addressData = JSON.parse(uni.getStorageSync("addressData"))
- this.getSelectType()
- this.getLabel()
- this.getSalerList()
- this.getStorageList()
- this.getDictionary()
- this.getBrandlist()
- if (option && option.id) {
- this.getDetail(option.id)
- }
- },
- methods: {
- 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(2)
- }
- } catch (e) {
- console.error('格式化错误', e)
- }
- },
- openPopup() {
- if (this.form.enableOrNot != 1) {
- this.$refs.popup.open()
- }
- },
- brandPopup() {
- if (this.form.enableOrNot != 1) {
- 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) {
- // if (row.tempFile.id) {
- // uni.showLoading({
- // title: '加载中',
- // mask: true
- // });
- // fileRemove(row.tempFile.id).then(res => {
- // uni.showToast({
- // title: '删除成功',
- // icon: 'none'
- // });
- // this.form.corpsFilesList.splice(row.index, 1)
- // }).finally(() => {
- // uni.hideLoading()
- // });
- // } else {
- // this.form.corpsFilesList.splice(row.index, 1)
- // }
- 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
- })
- console.log(this.form.corpsFilesList)
- 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);
- this.getDetail(res.data.id)
- })
- .finally(() => {
- 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))
- submit(obj)
- let _this = this
- uni.showModal({
- title: '提示',
- content: type == 1 ? '是否通过审批?' : '是否驳回审批?',
- success: function(res) {
- if (res.confirm) {
- obj.type = type
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- review(obj).then(res => {
- uni.showToast({
- title: '操作成功',
- icon: 'none',
- duration: 2000
- });
- _this.getDetail(res.data.id)
- })
- .finally(() => {
- 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;
- }
- </style>
|