刷新s_token

This commit is contained in:
zmj 2024-05-22 23:13:57 +08:00
parent e11005391b
commit e9a6377e26
9 changed files with 48 additions and 43 deletions

View File

@ -396,12 +396,10 @@
/*供应商tabbar,token,引导页相关*/ /*供应商tabbar,token,引导页相关*/
isSupplierFn() { isSupplierFn() {
if (!this.isLogin || uni.getStorageSync('LOGIN_STATUS_STOKEN')) return; if (!this.isLogin || uni.getStorageSync('LOGIN_STATUS_STOKEN')) return;
getSTokenApi({ getSTokenApi().then(res => {
jg_register_id: uni.getStorageSync('jg_id') || ''
}).then(res => {
if (res.data?.token) { if (res.data?.token) {
uni.setStorageSync('LOGIN_STATUS_STOKEN', (res.data?.token || '')) uni.setStorageSync('LOGIN_STATUS_STOKEN', (res.data?.token || ''))
console.log("获取了token") this.$store.commit('SET_STOKEN', res.data?.token);
} }
}).catch(err => { }).catch(err => {
console.log("获取报错", err) console.log("获取报错", err)

View File

@ -701,11 +701,10 @@
/*供应商tabbar,token,引导页相关*/ /*供应商tabbar,token,引导页相关*/
isSupplierFn() { isSupplierFn() {
if (!this.isLogin || uni.getStorageSync('LOGIN_STATUS_STOKEN')) return; if (!this.isLogin || uni.getStorageSync('LOGIN_STATUS_STOKEN')) return;
getSTokenApi({ getSTokenApi().then(res => {
jg_register_id: uni.getStorageSync('jg_id') || ''
}).then(res => {
if (res.data?.token) { if (res.data?.token) {
uni.setStorageSync('LOGIN_STATUS_STOKEN', (res.data?.token || '')) uni.setStorageSync('LOGIN_STATUS_STOKEN', (res.data?.token || ''))
this.$store.commit('SET_STOKEN', res.data?.token);
} }
}).catch(err => { }).catch(err => {
console.log("获取报错", err) console.log("获取报错", err)

View File

@ -365,12 +365,10 @@
/*供应商tabbar,token,引导页相关*/ /*供应商tabbar,token,引导页相关*/
isSupplierFn() { isSupplierFn() {
if (!this.isLogin || uni.getStorageSync('LOGIN_STATUS_STOKEN')) return; if (!this.isLogin || uni.getStorageSync('LOGIN_STATUS_STOKEN')) return;
getSTokenApi({ getSTokenApi().then(res => {
jg_register_id: uni.getStorageSync('jg_id') || ''
}).then(res => {
if (res.data?.token) { if (res.data?.token) {
uni.setStorageSync('LOGIN_STATUS_STOKEN', (res.data?.token || '')) uni.setStorageSync('LOGIN_STATUS_STOKEN', (res.data?.token || ''))
console.log("获取了token") this.$store.commit('SET_STOKEN', res.data?.token);
} }
}).catch(err => { }).catch(err => {
console.log("获取报错", err) console.log("获取报错", err)
@ -403,7 +401,8 @@
let that = this; let that = this;
getUserInfo().then(res => { getUserInfo().then(res => {
that.userInfo = res.data; that.userInfo = res.data;
if (res.data.mer_info.mer_settlement_agree_status && this.tabsArr.length == 1) this.tabsArr if (res.data.mer_info.mer_settlement_agree_status && this.tabsArr.length == 1) this
.tabsArr
.push({ .push({
name: '商户购物车', name: '商户购物车',
val: 2 val: 2
@ -531,7 +530,8 @@
if (res.data.attr.length == 0) return Toast('此商品为单规格商品'); if (res.data.attr.length == 0) return Toast('此商品为单规格商品');
const sku = {}; const sku = {};
res.data.attrValue.forEach((itemn) => { res.data.attrValue.forEach((itemn) => {
if (this.tabsCurr == 2) itemn.price = itemn.wholesale_price; // if (this.tabsCurr == 2) itemn.price = itemn
.wholesale_price; //
sku[itemn.sku] = itemn; sku[itemn.sku] = itemn;
}) })
goods.attr = res.data.attr; goods.attr = res.data.attr;
@ -661,8 +661,9 @@
} }
}, },
attrVal(val) { attrVal(val) {
this.$set(this.attr.productAttr[val.indexw], 'index', this.attr.productAttr[val.indexw].attr_values[val this.$set(this.attr.productAttr[val.indexw], 'index', this.attr.productAttr[val.indexw]
.indexn]); .attr_values[val
.indexn]);
}, },
/** /**
* 属性变动赋值 * 属性变动赋值
@ -885,7 +886,8 @@
// // // //
el.list.forEach(e => { el.list.forEach(e => {
if (e.check) { if (e.check) {
totalMoney = this.$util.$h.Add(totalMoney, this.$util.$h.Mul(e.productAttr totalMoney = this.$util.$h.Add(totalMoney, this.$util.$h.Mul(e
.productAttr
.price, e.cart_num)) .price, e.cart_num))
totalNum += e.cart_num totalNum += e.cart_num
} }

View File

@ -5,7 +5,7 @@
提现至 提现至
</view> </view>
<view style="font-weight: bold;"> <view style="font-weight: bold;">
{{form.is_own?'对公账户':'个人账户'}} {{form.is_own?'对公账户':'个人账户'}} {{form.is_own}}
</view> </view>
<view style="display: flex;align-items: center;color: #20B128;" @click="showPop1=true"> <view style="display: flex;align-items: center;color: #20B128;" @click="showPop1=true">
<text>账户类型</text> <u-icon color="#20B128" name="arrow-right"></u-icon> <text>账户类型</text> <u-icon color="#20B128" name="arrow-right"></u-icon>
@ -93,22 +93,10 @@
"is_own": 0, "is_own": 0,
phone: '', phone: '',
"id_card": "", "id_card": "",
// "mer_id": userStore?.userInfo?.merchant?.mer_id,
// supplier_id: userStore?.userInfo?.supplier?.id,
user_type: '2' user_type: '2'
}, },
// form: {
// "is_own": 0,
// "bank_name": "",
// "bank_id": 1,
// "name": "",
// "bank_code": "6213362109985515778",
// "bank_branch": "",
// "id_card": "513701200012105613",
// "phone": "19130550023",
// user_type: '2'
// },
showPop: false, showPop: false,
bankList: [], bankList: [],
hasBindAccount: [], hasBindAccount: [],
@ -127,10 +115,15 @@
this.form = res.data.bank_list[0] || {} this.form = res.data.bank_list[0] || {}
}, },
getFormData(form, target) { getFormData(form, target) {
console.log(target)
if (!target) { if (!target) {
form.value = {} for (let key in form) {
form[key] = ''
}
console.log('return', form)
return return
} }
console.log('除了来了')
form.name = target.name || '' form.name = target.name || ''
form.bank_id = target.bank_id || '' form.bank_id = target.bank_id || ''
form.bank_name = target.bank_name || '' form.bank_name = target.bank_name || ''
@ -141,7 +134,8 @@
form.is_own = target.is_own form.is_own = target.is_own
}, },
choseAccount(type) { choseAccount(type) {
this.getFormData(this.form, this.hasBindAccount[type]) let index = this.hasBindAccount.findIndex(item => item.is_own == type)
this.form = this.hasBindAccount[index] || {}
this.form.is_own = type this.form.is_own = type
this.showPop1 = false this.showPop1 = false
}, },
@ -158,7 +152,7 @@
}, },
async submit() { async submit() {
await Modal('温馨提示', "确定信息无误,提交绑定") await Modal('温馨提示', "确定信息无误,提交绑定")
this.form.is_own = this.form.is_own || 1 this.form.is_own === 1 ? '' : this.form.is_own = 0
await bindCradApi({ await bindCradApi({
...this.form ...this.form
}) })
@ -173,6 +167,10 @@
uni.showTabBar() uni.showTabBar()
this.getHasBindBankList() this.getHasBindBankList()
this.getBankList() this.getBankList()
},
onPullDownRefresh() {
this.getHasBindBankList()
uni.stopPullDownRefresh()
} }
} }
</script> </script>

View File

@ -320,6 +320,11 @@
uni.showTabBar() uni.showTabBar()
this.getList() this.getList()
this.getAmount() this.getAmount()
},
onPullDownRefresh() {
this.getList()
this.getAmount()
uni.stopPullDownRefresh()
} }
} }
</script> </script>

View File

@ -99,13 +99,12 @@
}) })
}, },
choseAccount(type) { choseAccount(type) {
this.target_bank = this.hasBindAccount[type] || {} let index = this.hasBindAccount.findIndex(item => item.is_own == type)
this.target_bank = this.hasBindAccount[index] || {}
this.target_bank.is_own = type this.target_bank.is_own = type
this.showPop1 = false this.showPop1 = false
}, },
async getHasBindBankList() { async getHasBindBankList() {
// this.target_bank = this.hasBindAccount[0]
// return
let res = await amountAccountApi({}) let res = await amountAccountApi({})
this.balance = res.data.balance this.balance = res.data.balance
this.hasBindAccount = res.data.bank_list this.hasBindAccount = res.data.bank_list
@ -133,6 +132,10 @@
uni.showTabBar() uni.showTabBar()
this.getHasBindBankList() this.getHasBindBankList()
},
onPullDownRefresh() {
this.getHasBindBankList()
uni.stopPullDownRefresh()
} }
} }
</script> </script>

View File

@ -533,12 +533,10 @@
/*供应商tabbar,token,引导页相关*/ /*供应商tabbar,token,引导页相关*/
isSupplierFn() { isSupplierFn() {
if (!this.isLogin || uni.getStorageSync('LOGIN_STATUS_STOKEN')) return; if (!this.isLogin || uni.getStorageSync('LOGIN_STATUS_STOKEN')) return;
getSTokenApi({ getSTokenApi().then(res => {
jg_register_id: uni.getStorageSync('jg_id') || ''
}).then(res => {
if (res.data?.token) { if (res.data?.token) {
uni.setStorageSync('LOGIN_STATUS_STOKEN', (res.data?.token || '')) uni.setStorageSync('LOGIN_STATUS_STOKEN', (res.data?.token || ''))
console.log("获取了token") this.$store.commit('SET_STOKEN', res.data?.token);
} }
}).catch(err => { }).catch(err => {
console.log("获取报错", err) console.log("获取报错", err)

View File

@ -389,11 +389,10 @@
/*供应商tabbar,token,引导页相关*/ /*供应商tabbar,token,引导页相关*/
isSupplierFn() { isSupplierFn() {
if (!this.isLogin || uni.getStorageSync('LOGIN_STATUS_STOKEN')) return; if (!this.isLogin || uni.getStorageSync('LOGIN_STATUS_STOKEN')) return;
getSTokenApi({ getSTokenApi().then(res => {
jg_register_id: uni.getStorageSync('jg_id') || ''
}).then(res => {
if (res.data?.token) { if (res.data?.token) {
uni.setStorageSync('LOGIN_STATUS_STOKEN', (res.data?.token || '')) uni.setStorageSync('LOGIN_STATUS_STOKEN', (res.data?.token || ''))
this.$store.commit('SET_STOKEN', res.data?.token);
} }
}).catch(err => { }).catch(err => {
console.log("获取报错", err) console.log("获取报错", err)

View File

@ -54,6 +54,9 @@ const mutations = {
Cache.set(LOGIN_STATUS, opt.token, opt.time); Cache.set(LOGIN_STATUS, opt.token, opt.time);
uni.removeStorageSync('auth_token'); uni.removeStorageSync('auth_token');
}, },
SET_STOKEN(state, s_token) {
state.s_token = s_token
},
SET_USERINFO(state, opt) { SET_USERINFO(state, opt) {
state.userInfo = opt; state.userInfo = opt;
Cache.set(USER_INFO, opt); Cache.set(USER_INFO, opt);