二手车交易,缓存问题解决
This commit is contained in:
@ -137,7 +137,6 @@ export default {
|
||||
status:'',
|
||||
supplierName:'',
|
||||
supplierCode:'',
|
||||
homePage:false,
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
@ -145,7 +144,6 @@ export default {
|
||||
this.type=this.$route.query.type || urlParams.get('type');
|
||||
this.id=this.$route.query.id || urlParams.get('id');
|
||||
this.queryType=this.$route.query.queryType || urlParams.get('queryType');
|
||||
this.homePage=this.$route.query.homePage
|
||||
if( this.id){
|
||||
let res = await carInfoDetail({
|
||||
id:this.id,
|
||||
@ -164,23 +162,27 @@ export default {
|
||||
this.ortherReason=res[1]
|
||||
}
|
||||
}
|
||||
if(this.$route.params.form){
|
||||
this.form={...this.$route.params.form}
|
||||
}
|
||||
if(this.$route.params.radio){
|
||||
this.radio=this.$route.params.radio
|
||||
let wantBuyFormInfo=localStorage.getItem("wantBuyFormInfo") ? JSON.parse(localStorage.getItem("wantBuyFormInfo")) : ''
|
||||
if(!wantBuyFormInfo){
|
||||
return
|
||||
}
|
||||
this.form={...wantBuyFormInfo.form}
|
||||
this.radio=wantBuyFormInfo.radio
|
||||
this.ortherReason=wantBuyFormInfo.ortherReason
|
||||
},
|
||||
methods:{
|
||||
clearStorageFormInfo(){
|
||||
localStorage.setItem("wantBuyFormInfo",'')
|
||||
},
|
||||
backHandle(){
|
||||
if(this.$route.query.homePage){//返回列表
|
||||
this.$router.push({ name: "indexList"})
|
||||
}else{//返回我的发布
|
||||
this.$router.push({ name: "mineRelease"})
|
||||
}
|
||||
this.clearStorageFormInfo();
|
||||
},
|
||||
viewPrivacy(){
|
||||
// let host = window.location.host
|
||||
let url='';
|
||||
if (window.location.href.includes('www.sinoassist.com')) {
|
||||
url = 'https://www.sinoassist.com'
|
||||
@ -193,43 +195,18 @@ export default {
|
||||
// url = 'http://localhost:8080'
|
||||
}
|
||||
let urls=url + '/h5/supplier/dispatch/res/privacy.html'
|
||||
this.$router.push({ name: "privacyComponent", query: {url:urls,type:2,homePage:this.homePage},params: { form: this.form,radio:this.radio } })
|
||||
},
|
||||
closeParentDialog() {
|
||||
if (window.parent) {
|
||||
// 检查是否有父组件监听 'closeDialog' 事件
|
||||
const hasListener = window.parent.dispatchEvent(new Event('checkCloseDialog'));
|
||||
if (hasListener) {
|
||||
// 如果有监听器,向父组件发送消息以请求关闭 dialog
|
||||
window.parent.postMessage('closeDialog', '*');
|
||||
} else {
|
||||
// 如果没有监听器,则执行 history.back()
|
||||
window.history.back();
|
||||
}
|
||||
}
|
||||
let data={form:this.form,radio:this.radio,ortherReason:this.ortherReason}
|
||||
localStorage.setItem("wantBuyFormInfo",JSON.stringify(data))
|
||||
this.$router.push({ name: "privacyComponent", query: {url:urls}})
|
||||
},
|
||||
|
||||
// 审核操作
|
||||
async auditHandle(type){
|
||||
if (!type && !this.auditReason){
|
||||
this.$toast('请填写不通过原因')
|
||||
return
|
||||
}
|
||||
let flag=this.validateHandle()
|
||||
if(flag){
|
||||
this.$toast(flag)
|
||||
return
|
||||
}
|
||||
if (this.form.vehicleType=='拖车' && !this.form.boardType) {
|
||||
this.$toast('落板方式不能为空')
|
||||
return
|
||||
}else if(this.form.vehicleType !=='拖车'){
|
||||
this.form.boardType=''
|
||||
}
|
||||
let rule=this.validationRules.find(item=>!item.value)
|
||||
if(rule){
|
||||
this.$toast(rule.name)
|
||||
return
|
||||
}
|
||||
await this.commonMethods()
|
||||
try {
|
||||
await auditCarInfo({
|
||||
id: this.id,
|
||||
@ -238,6 +215,7 @@ export default {
|
||||
...this.form,
|
||||
vehicleType: this.ortherReason ? (this.form.vehicleType+','+this.ortherReason) : this.form.vehicleType
|
||||
})
|
||||
this.clearStorageFormInfo()
|
||||
setTimeout(()=>{
|
||||
this.closeParentDialog()
|
||||
},1000)
|
||||
@ -249,12 +227,7 @@ export default {
|
||||
}
|
||||
|
||||
},
|
||||
// 发布求购
|
||||
async submitHandle(){
|
||||
if (!this.radio) {
|
||||
this.$toast('请勾选我已阅读并同意')
|
||||
return
|
||||
}
|
||||
commonMethods() {
|
||||
let flag=this.validateHandle()
|
||||
if(flag){
|
||||
this.$toast(flag)
|
||||
@ -271,11 +244,20 @@ export default {
|
||||
this.$toast(rule.name)
|
||||
return
|
||||
}
|
||||
},
|
||||
// 发布求购
|
||||
async submitHandle(){
|
||||
if (!this.radio) {
|
||||
this.$toast('请勾选我已阅读并同意')
|
||||
return
|
||||
}
|
||||
await this.commonMethods()
|
||||
try {
|
||||
let res = await publishCarInfo({
|
||||
...this.form,
|
||||
vehicleType: this.ortherReason ? (this.form.vehicleType+','+this.ortherReason) : this.form.vehicleType
|
||||
})
|
||||
this.clearStorageFormInfo()
|
||||
if(res.code == 200 && !res.msg){
|
||||
this.$toast('发布成功')
|
||||
if(this.isWebFunc()){
|
||||
|
Reference in New Issue
Block a user