调整远端暂存记录

This commit is contained in:
唐明明
2023-02-16 13:31:31 +08:00
parent ade6bd53c2
commit 70028925cc
4 changed files with 62 additions and 39 deletions

View File

@@ -10,8 +10,8 @@ import router from '../router'
// 基础配置
const config = {
apiUrl : 'https://douhuo.douhuofalv.com/api/',
// apiUrl : 'https://api.douhuotest.douhuofalv.com/api/', //测试环境
// apiUrl : 'https://douhuo.douhuofalv.com/api/',
apiUrl : 'https://api.douhuotest.douhuofalv.com/api/', //测试环境
timeout : 60000
}

View File

@@ -98,6 +98,22 @@ const updBaseBase = (baseId, data) => {
})
}
// 获取缓存机构资料
const cacheBank = id => {
return request({
url: 'business/' + id + '/cache/bank',
})
}
// 存储缓存机构资料
const setCacheBank = (id, data) => {
return request({
url: 'business/' + id + '/cache/bank',
method: 'POST',
data
})
}
// 待补差价订单
const ordersDiffs = data => {
return request({
@@ -213,6 +229,8 @@ export {
updPerfectBase,
baseBase,
updBaseBase,
cacheBank,
setCacheBank,
ordersDiffs,
ordersEditorders,
orderSign,

View File

@@ -120,7 +120,6 @@
this.payType = this.$Route.query.paytype
uni.hideLoading()
}).catch(err => {
console.log(err)
uni.showToast({
title: err.message,
icon : 'none'

View File

@@ -60,6 +60,7 @@
<uni-icons v-if="item.reason.description" class="from-icon" type="info" size="18" color="red" @click="modifyToast(item.reason.description)"></uni-icons>
</label>
<radio-group @change="item.value = $event.detail.value">
<label class="from-radio-labe" v-for="(radioItem, radioIndex) in item.options" :key="radioIndex">
<radio :value="radioIndex" :checked="item.value === radioIndex" color="#446EFE" /><text>{{radioItem}}</text>
</label>
@@ -114,7 +115,7 @@
</template>
<script>
import { baseBase, updBaseBase, historyBank } from '@/apis/interfaces/order.js'
import { baseBase, updBaseBase, historyBank, cacheBank, setCacheBank } from '@/apis/interfaces/order.js'
export default {
data() {
return {
@@ -157,33 +158,37 @@
})
baseBase(this.$Route.query.itemId).then(res => {
let { item, params, business_order_user_bank_id } = res;
uni.getStorage({
key : 'institutions' + this.$Route.query.itemId,
success : StorageRes => {
let { data } = StorageRes
let storageParams = []
storageParams = params.map(val => {
if(val.type == 'checkbox' && data[val.key].length > 0){
val.value = data[val.key]
return val
}
val.value = data[val.key]
return val
})
this.params = storageParams
},
fail : StorageErr => {
this.params = params
},
complete: () => {
this.baseInfo = {
cover: item.institution.cover,
title: item.institution.title,
type : item.business_type.title
}
this.submitId = business_order_user_bank_id
uni.hideLoading()
cacheBank(business_order_user_bank_id).then(StorageRes => {
this.baseInfo = {
cover: item.institution.cover,
title: item.institution.title,
type : item.business_type.title
}
this.submitId = business_order_user_bank_id
uni.hideLoading()
if(StorageRes === ''){
this.params = params
return
}
let storageParams = []
storageParams = params.map(val => {
if(val.type == 'checkbox' && StorageRes[val.key].length > 0){
val.value = StorageRes[val.key]
return val
}
if(val.type == 'select' && StorageRes[val.key] === null){
val.value = 0
return val
}
val.value = StorageRes[val.key] === null ? "" : StorageRes[val.key]
return val;
})
this.params = storageParams
}).catch(StorageErr => {
uni.showToast({
title: StorageErr.message,
icon : 'none'
})
})
}).catch(err => {
uni.showToast({
@@ -206,15 +211,16 @@
} else subData[val.key] = val.value
}
if(type === 'local'){
uni.setStorage({
key : 'institutions' + this.$Route.query.itemId,
data : subData,
success : res => {
uni.showToast({
title: '机构信息已暂存',
icon : 'none'
})
}
setCacheBank(this.submitId, subData).then(res => {
uni.showToast({
title: '机构信息已暂存',
icon : 'none'
})
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
return
}