调整远端暂存记录

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 = { const config = {
apiUrl : 'https://douhuo.douhuofalv.com/api/', // apiUrl : 'https://douhuo.douhuofalv.com/api/',
// apiUrl : 'https://api.douhuotest.douhuofalv.com/api/', //测试环境 apiUrl : 'https://api.douhuotest.douhuofalv.com/api/', //测试环境
timeout : 60000 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 => { const ordersDiffs = data => {
return request({ return request({
@@ -213,6 +229,8 @@ export {
updPerfectBase, updPerfectBase,
baseBase, baseBase,
updBaseBase, updBaseBase,
cacheBank,
setCacheBank,
ordersDiffs, ordersDiffs,
ordersEditorders, ordersEditorders,
orderSign, orderSign,

View File

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