Fix:5808 【商城小程序】【商户入驻-文玩供应商】入驻详情页填写资料后返回商户入驻列表页,再次进入时已填写的店铺资料未自动保存
This commit is contained in:
+30
@@ -38,6 +38,18 @@ export function saveShop(hotelInfo, partnerId = '', promoterUid = '') {
|
||||
return request.post("/merchantApply/hotel/submit", param, {login: true})
|
||||
}
|
||||
|
||||
// 保存店铺入驻草稿
|
||||
export function saveHotelDraft(hotelInfo, partnerId = '', promoterUid = '') {
|
||||
let param = {hotelInfo, captcha: hotelInfo.captcha};
|
||||
if (partnerId && partnerId.length > 0) {
|
||||
param.partnerId = partnerId;
|
||||
}
|
||||
if (promoterUid && promoterUid.length > 0) {
|
||||
param.promoterUid = promoterUid;
|
||||
}
|
||||
return request.post("/merchantApply/hotel/saveDraft", param, {login: true})
|
||||
}
|
||||
|
||||
// 提交特产供应商入驻申请
|
||||
export function saveSupplier(hotelInfo, supplierInfo, partnerId = '', promoterUid = '') {
|
||||
let param = {hotelInfo, supplierInfo, captcha: supplierInfo.captcha};
|
||||
@@ -62,12 +74,30 @@ export function saveWenwanSupplier(hotelInfo, supplierInfo, partnerId = '', prom
|
||||
return request.post("/merchantApply/wenwanSupplier/submit", param, {login: true})
|
||||
}
|
||||
|
||||
// 保存供应商入驻草稿(特产/文玩共用)
|
||||
export function saveSupplierDraft(hotelInfo, supplierInfo, partnerId = '', promoterUid = '') {
|
||||
let param = {hotelInfo, supplierInfo, captcha: supplierInfo.captcha};
|
||||
if (partnerId && partnerId.length > 0) {
|
||||
param.partnerId = partnerId;
|
||||
}
|
||||
if (promoterUid && promoterUid.length > 0) {
|
||||
param.promoterUid = promoterUid;
|
||||
}
|
||||
return request.post("/merchantApply/supplier/saveDraft", param, {login: true})
|
||||
}
|
||||
|
||||
// 提交采购批发商入驻申请
|
||||
export function saveWholesaler(wholesalerInfo) {
|
||||
let param = {wholesalerInfo, captcha: wholesalerInfo.captcha};
|
||||
return request.post("/merchantApply/wholesaler/submit", param, {login: true})
|
||||
}
|
||||
|
||||
// 保存采购批发商入驻草稿
|
||||
export function saveWholesalerDraft(wholesalerInfo) {
|
||||
let param = {wholesalerInfo, captcha: wholesalerInfo.captcha};
|
||||
return request.post("/merchantApply/wholesaler/saveDraft", param, {login: true})
|
||||
}
|
||||
|
||||
export function saveExperienceStore(params) {
|
||||
return request.post("/merchantApply/experienceStore/submit", params, {login: true})
|
||||
}
|
||||
|
||||
+12
-31
@@ -474,6 +474,7 @@ import {
|
||||
getShopInfo,
|
||||
removeApply,
|
||||
saveShop,
|
||||
saveHotelDraft,
|
||||
getHotelInfo,
|
||||
getCountyFamousHotelType
|
||||
} from '@/api/join'
|
||||
@@ -631,39 +632,10 @@ export default {
|
||||
onLoad(options) {
|
||||
this.partnerId = options.partnerId || ''
|
||||
this.promoterUid = options.promoterUid || ''
|
||||
const local_form = uni.getStorageSync('merchantApplyHotel' + '_form') || {}
|
||||
this.quaPics = uni.getStorageSync('merchantApplyHotel' + '_quaPics') || []
|
||||
if(!local_form.serviceTime) {
|
||||
local_form.serviceTime = '00:00'
|
||||
}
|
||||
if(!local_form.serviceEndTime) {
|
||||
local_form.serviceEndTime = '23:59'
|
||||
}
|
||||
this.form = !this.reviewing ? local_form : {
|
||||
name: '',
|
||||
cover: '',
|
||||
coverVideo: '',
|
||||
coverType: 1, // coverType: 1-图片,2-视频
|
||||
logo: '',
|
||||
qualification: '',
|
||||
type: 0,
|
||||
typeText: '',
|
||||
isCountyFamous: 0,
|
||||
countyFamousHotelType: null,
|
||||
phone: '',
|
||||
captcha: '',
|
||||
area: '',
|
||||
address: '',
|
||||
position: '',
|
||||
content: '',
|
||||
serviceTime: '00:00',
|
||||
serviceEndTime: '23:59'
|
||||
}
|
||||
this.init()
|
||||
},
|
||||
onUnload() {
|
||||
uni.setStorageSync('merchantApplyHotel'+'_quaPics', this.quaPics)
|
||||
uni.setStorageSync('merchantApplyHotel' + '_form', this.form)
|
||||
this.saveDraft()
|
||||
},
|
||||
onReady() {
|
||||
this.$refs.shopForm.setRules(this.rules)
|
||||
@@ -1005,7 +977,7 @@ export default {
|
||||
changeAgree(event) {
|
||||
this.isAgree = event.detail.value.length > 0
|
||||
},
|
||||
save() {
|
||||
buildPostData() {
|
||||
this.form.pics = ''
|
||||
const picsLength = this.pics.length
|
||||
if (picsLength > 0) {
|
||||
@@ -1028,6 +1000,10 @@ export default {
|
||||
if (postData.coverType === 2) {
|
||||
postData.cover = postData.coverVideo
|
||||
}
|
||||
return postData
|
||||
},
|
||||
save() {
|
||||
const postData = this.buildPostData()
|
||||
saveShop(postData, this.partnerId, this.promoterUid).then(res => {
|
||||
if (res.status === 200) {
|
||||
uni.showToast({
|
||||
@@ -1048,6 +1024,11 @@ export default {
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
saveDraft() {
|
||||
if (this.reviewing) return
|
||||
const postData = this.buildPostData()
|
||||
saveHotelDraft(postData, this.partnerId, this.promoterUid)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+43
-73
@@ -578,7 +578,8 @@ import {
|
||||
getShopInfo,
|
||||
removeApply,
|
||||
saveSupplier,
|
||||
saveWenwanSupplier
|
||||
saveWenwanSupplier,
|
||||
saveSupplierDraft
|
||||
} from '@/api/join'
|
||||
import {getCity, registerVerify} from '@/api/user'
|
||||
import {
|
||||
@@ -715,7 +716,7 @@ export default {
|
||||
reviewing: false,
|
||||
pageKeyId: '',
|
||||
showUpload: false,
|
||||
draftKey: ''
|
||||
pageType: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -800,50 +801,8 @@ export default {
|
||||
this.partnerId = options.partnerId || ''
|
||||
this.promoterUid = options.promoterUid || ''
|
||||
const type = options.type
|
||||
this.draftKey = type
|
||||
const local = uni.getStorageSync(this.draftKey) || {}
|
||||
const local_form = uni.getStorageSync(this.draftKey + '_form') || {}
|
||||
this.quaPics = uni.getStorageSync(this.draftKey + '_quaPics') || []
|
||||
console.log(this.quaPics, 'this.quaPics');
|
||||
|
||||
if(!local_form.serviceTime) {
|
||||
local_form.serviceTime = '00:00'
|
||||
}
|
||||
if(!local_form.serviceEndTime) {
|
||||
local_form.serviceEndTime = '23:59'
|
||||
}
|
||||
this.form = !this.reviewing && local_form || {
|
||||
name: '',
|
||||
cover: '',
|
||||
coverVideo: '',
|
||||
// coverType: 1-图片,2-视频
|
||||
coverType: 1,
|
||||
logo: '',
|
||||
type: 0,
|
||||
typeText: '',
|
||||
phone: '',
|
||||
area: '',
|
||||
address: '',
|
||||
position: '',
|
||||
content: '',
|
||||
serviceTime: '00:00',
|
||||
serviceEndTime: '23:59'
|
||||
}
|
||||
this.formSupplier = !this.reviewing && local || {
|
||||
name: '',
|
||||
businessLicense: '',
|
||||
avatar: '',
|
||||
contact: '',
|
||||
phone: '',
|
||||
captcha: '',
|
||||
qualification: '',
|
||||
subType: '',
|
||||
area: '',
|
||||
address: '',
|
||||
position: ''
|
||||
}
|
||||
this.pageType = type
|
||||
this.formSupplier.subType = type
|
||||
|
||||
if (type === 'goods_supplier') {
|
||||
this.infoTitle = '特产'
|
||||
this.pageKeyId = 'merchantApplyGoodsSupplier'
|
||||
@@ -857,9 +816,7 @@ export default {
|
||||
this.init()
|
||||
},
|
||||
onUnload() {
|
||||
uni.setStorageSync(this.draftKey, this.formSupplier)
|
||||
uni.setStorageSync(this.draftKey + '_quaPics', this.quaPics)
|
||||
uni.setStorageSync(this.draftKey + '_form', this.form)
|
||||
this.saveDraft()
|
||||
},
|
||||
onReady() {
|
||||
this.$refs.shopForm.setRules(this.rules)
|
||||
@@ -978,7 +935,7 @@ export default {
|
||||
// 店铺图片
|
||||
this.pics = []
|
||||
this.form = data.hotelInfo
|
||||
const picsTemp = this.form.pics.split(',')
|
||||
const picsTemp = (this.form.pics || '').split(',')
|
||||
if (picsTemp.length > 0) {
|
||||
picsTemp.map(item => {
|
||||
if (item) {
|
||||
@@ -986,38 +943,40 @@ export default {
|
||||
}
|
||||
})
|
||||
}
|
||||
this.indexType = this.columnsType.findIndex(item => item.id === this.form.type)
|
||||
this.form.typeText = this.indexType > -1 ? this.columnsType[this.indexType].name : ''
|
||||
this.form.position = this.$forceToDecimal(this.form.longitude, 6) + ',' + this.$forceToDecimal(this.form.latitude, 6)
|
||||
this.form.area = `${this.form.provinceName || ''} ${this.form.cityName || ''} ${this.form.areaName || ''}`
|
||||
if (data.hotelInfo.coverType === 2) {
|
||||
this.form.coverVideo = data.hotelInfo.cover
|
||||
this.form.cover = ''
|
||||
}
|
||||
}
|
||||
if (data.supplierInfo) {
|
||||
// 仅在已提交且申请类型明确不匹配时跳过,草稿状态下正常回显
|
||||
if (data.isDraft !== 1 && data.applyType != null) {
|
||||
if (this.infoTitle === "特产" && data.applyType !== 1) return
|
||||
if (this.infoTitle === "文玩" && data.applyType !== 3) return
|
||||
}
|
||||
this.formSupplier = data.supplierInfo
|
||||
// 后端草稿可能未回传 subType,用当前页面类型补齐
|
||||
if (!this.formSupplier.subType) {
|
||||
this.formSupplier.subType = this.pageType
|
||||
}
|
||||
// 商家资质
|
||||
const quaPicsTemp = this.form.qualification && this.form.qualification.split(',') || []
|
||||
if (quaPicsTemp.length > 0) {
|
||||
console.log(quaPicsTemp, 'quaPicsTemp--------');
|
||||
|
||||
this.quaPics = []
|
||||
const quaPicsTemp = (this.formSupplier.qualification || '').split(',')
|
||||
if (quaPicsTemp.length > 0) {
|
||||
quaPicsTemp.map(item => {
|
||||
if (item) {
|
||||
this.quaPics.push({url: item})
|
||||
}
|
||||
})
|
||||
}
|
||||
this.indexType = this.columnsType.findIndex(item => item.id === this.form.type)
|
||||
this.form.typeText = this.columnsType[this.indexType].name
|
||||
this.form.position = this.$forceToDecimal(this.form.longitude, 6) + ',' + this.$forceToDecimal(this.form.latitude, 6)
|
||||
this.form.area = `${this.form.provinceName || ''} ${this.form.cityName || ''} ${this.form.areaName || ''}`
|
||||
console.log(this.form, 'form--------');
|
||||
if (data.hotelInfo.coverType === 2) {
|
||||
this.form.coverVideo = data.hotelInfo.cover
|
||||
this.form.cover = ''
|
||||
}
|
||||
}
|
||||
// console.log(data.supplierInfo, 'supplierInfo--------');
|
||||
if (data.supplierInfo) {
|
||||
if (this.infoTitle === "特产" && data.applyType !== 1) return
|
||||
if (this.infoTitle === "文玩" && data.applyType !== 3) return
|
||||
this.formSupplier = data.supplierInfo
|
||||
this.formSupplier.typeText = this.columnsSupplierType[this.indexSupplierType].value
|
||||
this.formSupplier.position = this.$forceToDecimal(this.formSupplier.longitude, 6) + ',' + this.$forceToDecimal(this.formSupplier.latitude, 6)
|
||||
this.formSupplier.area = `${this.formSupplier.provinceName || ''} ${this.formSupplier.cityName || ''} ${this.formSupplier.areaName || ''}` || ''
|
||||
this.indexSupplierType = this.columnsSupplierType.findIndex(item => item.key === this.formSupplier.subType)
|
||||
console.log(this.formSupplier);
|
||||
this.formSupplier.typeText = this.indexSupplierType > -1 ? this.columnsSupplierType[this.indexSupplierType].value : ''
|
||||
this.formSupplier.position = this.$forceToDecimal(this.formSupplier.longitude, 6) + ',' + this.$forceToDecimal(this.formSupplier.latitude, 6)
|
||||
this.formSupplier.area = `${this.formSupplier.provinceName || ''} ${this.formSupplier.cityName || ''} ${this.formSupplier.areaName || ''}`
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -1208,7 +1167,7 @@ export default {
|
||||
changeAgree(event) {
|
||||
this.isAgree = event.detail.value.length > 0
|
||||
},
|
||||
save() {
|
||||
buildPostData() {
|
||||
this.form.pics = ''
|
||||
const picsLength = this.pics.length
|
||||
if (picsLength > 0) {
|
||||
@@ -1231,6 +1190,10 @@ export default {
|
||||
if (postData.coverType === 2) {
|
||||
postData.cover = postData.coverVideo
|
||||
}
|
||||
return postData
|
||||
},
|
||||
save() {
|
||||
const postData = this.buildPostData()
|
||||
if (this.infoTitle === '特产') {
|
||||
saveSupplier(postData, this.formSupplier, this.partnerId, this.promoterUid).then(res => {
|
||||
if (res.status === 200) {
|
||||
@@ -1274,6 +1237,13 @@ export default {
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
saveDraft() {
|
||||
if (this.reviewing) return
|
||||
// 确保按当前入驻类型(特产/文玩)区分保存,避免共用同一份草稿
|
||||
this.formSupplier.subType = this.pageType
|
||||
const postData = this.buildPostData()
|
||||
saveSupplierDraft(postData, this.formSupplier, this.partnerId, this.promoterUid)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@
|
||||
|
||||
<script>
|
||||
import CitySelect from '@/components/CitySelect'
|
||||
import {getShopData, getWholesaler, removeApply, saveWholesaler} from '@/api/join'
|
||||
import {getShopData, getWholesaler, removeApply, saveWholesaler, saveWholesalerDraft} from '@/api/join'
|
||||
import {getCity, registerVerify} from '@/api/user'
|
||||
import {chooseImage, formatRichText} from '@/utils'
|
||||
import { pageListenMixins } from '@/mixins/pageListenMixins'
|
||||
@@ -366,6 +366,9 @@ export default {
|
||||
this.promoterUid = options.promoterUid || ''
|
||||
this.init()
|
||||
},
|
||||
onUnload() {
|
||||
this.saveDraft()
|
||||
},
|
||||
onReady() {
|
||||
this.$refs.wholesalerForm.setRules(this.rules)
|
||||
},
|
||||
@@ -558,6 +561,10 @@ export default {
|
||||
return
|
||||
}
|
||||
this.show = false
|
||||
},
|
||||
saveDraft() {
|
||||
if (this.reviewing) return
|
||||
saveWholesalerDraft(this.form)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user