From 15ba1ce3c6205070e8533c300d8b2f02e7189661 Mon Sep 17 00:00:00 2001
From: H <30830569@qq.com>
Date: Thu, 8 Sep 2022 10:13:22 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=94=E5=88=A9=E7=8A=B6?=
=?UTF-8?q?=E6=80=81=EF=BC=8C=E8=A7=86=E9=A2=91=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pageB/comm_rec/index.vue | 26 +-
src/pages/product_details/index.vue | 805 +++++++++++++---------------
src/store/modules/user.js | 104 +++-
3 files changed, 476 insertions(+), 459 deletions(-)
diff --git a/src/pageB/comm_rec/index.vue b/src/pageB/comm_rec/index.vue
index e51e8d1..6b5f3d8 100644
--- a/src/pageB/comm_rec/index.vue
+++ b/src/pageB/comm_rec/index.vue
@@ -1,17 +1,19 @@
-
+
时间
返利
状态
-
+
-
+
{{item.created_at*1000 | date('yyyy-mm-dd')}}
{{item.money}}
- {{item.status |StatusText}}
+
+ {{item.status_text}}
@@ -37,8 +39,8 @@
dataList: [], //获取到的数据
};
},
- filters:{
- StatusText(value){
+ filters: {
+ StatusText(value) {
const status = [{
value: 0,
label: '待付款'
@@ -56,7 +58,7 @@
return obj?.label ?? value
}
},
- computed:{
+ computed: {
height() {
const {
windowHeight,
@@ -81,7 +83,7 @@
}).then(res => {
this.mescroll.endSuccess(res.data.length)
if (page.num == 1) this.dataList = [];
- this.dataList = this.dataList.concat(res.data,);
+ this.dataList = this.dataList.concat(res.data, );
}).catch(err => {
this.mescroll.endErr()
})
@@ -91,7 +93,7 @@
diff --git a/src/pages/product_details/index.vue b/src/pages/product_details/index.vue
index 0c0320f..4065549 100644
--- a/src/pages/product_details/index.vue
+++ b/src/pages/product_details/index.vue
@@ -29,43 +29,24 @@
-->
-
+
-
-
+
+
-
@@ -74,9 +55,8 @@
{{ detail.name }}
- 成长值:{{ detail.sales_value }}
+ 成长值:{{ detail.sales_value }}
@@ -88,12 +68,8 @@
-
+
收藏
@@ -103,7 +79,8 @@
-
+
{{ activeSkuText }}
@@ -179,26 +156,19 @@
+ class="rounded-full w-90rpx h-90rpx bg-hex-cacaca border border-4rpx border-hex-fff box-content flex items-center justify-center">
-
+
- 邀请好友
+ 邀请好友
@@ -263,7 +233,7 @@
-
+
@@ -280,25 +250,26 @@
- 兑换
+ 兑换
-
+
-
+
{{ cartList.length }}
购物车
-
+
@@ -306,7 +277,8 @@
-
- 加入购物车
- 立即购买
+ 加入购物车
+ 立即购买
@@ -345,20 +316,10 @@
-
+
@@ -366,368 +327,372 @@
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 787dcfe..46d959b 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -10,11 +10,12 @@ const ALLACCOUNTS = "app_accounts"
const getDefaultState = () => {
return {
token: uni.getStorageSync(TOKEN),
- user: null,//用户信息
- news_num: 0,//消息数
- order_count: null,//订单数量
- history: uni.getStorageSync(HISTORY) || [],//历史搜索
- allaccounts: uni.getStorageSync(ALLACCOUNTS) || [],//所有账号
+ // token: '1104|nAMfPQH3HTnb4Y6p06mgIbPjPNC9Hqb24sbglwfQ',
+ user: null, //用户信息
+ news_num: 0, //消息数
+ order_count: null, //订单数量
+ history: uni.getStorageSync(HISTORY) || [], //历史搜索
+ allaccounts: uni.getStorageSync(ALLACCOUNTS) || [], //所有账号
}
}
@@ -26,16 +27,16 @@ const mutations = {
Object.assign(state, getDefaultState())
},
async LOGIN(state, value) {
- await this.commit('user/SET_TOKEN',value)
- await this.dispatch('user/getUserInfo',false)
- },
- LOGOUT(){
+ await this.commit('user/SET_TOKEN', value)
+ await this.dispatch('user/getUserInfo', false)
+ },
+ LOGOUT() {
return this.dispatch('user/resetToken')
},
// 登录
async SET_TOKEN(state, value) {
state.token = value
- await uni.setStorageSync(TOKEN, value);
+ await uni.setStorageSync(TOKEN, value);
},
//获取用户信息
SET_USERINFO(state, value) {
@@ -52,7 +53,9 @@ const mutations = {
if (state.history.length == 0) {
state.history.unshift(value)
} else {
- let Index = state.history.findIndex(item => { return item == value })
+ let Index = state.history.findIndex(item => {
+ return item == value
+ })
if (Index == -1) {
state.history.unshift(value)
}
@@ -71,7 +74,9 @@ const mutations = {
},
//修改资料后改变用户信息
SET_REFRESH(state, value) {
- let Index = state.allaccounts.findIndex(item => { return item.phone == value.phone })
+ let Index = state.allaccounts.findIndex(item => {
+ return item.phone == value.phone
+ })
if (Index != -1) {
state.allaccounts[Index].phone = value.phone
state.allaccounts[Index].avatar = value.avatar
@@ -97,7 +102,10 @@ const actions = {
commit,
state,
dispatch
- }, { form, switchAllaccounts }) {
+ }, {
+ form,
+ switchAllaccounts
+ }) {
return new Promise((resolve, reject) => {
http.post('/v1/login', form, {
@@ -107,12 +115,15 @@ const actions = {
}).then(({
token
}) => {
- if(switchAllaccounts && state.allaccounts.length==0){
+ if (switchAllaccounts && state.allaccounts.length == 0) {
const tempUserInfo = {
- ...Object.assign({},state.user),
- token:state.token,
+ ...Object.assign({}, state.user),
+ token: state.token,
}
- dispatch('getAccounts', { info:tempUserInfo, switchAllaccounts })
+ dispatch('getAccounts', {
+ info: tempUserInfo,
+ switchAllaccounts
+ })
}
resolve(token)
commit('SET_TOKEN', token)
@@ -150,7 +161,11 @@ const actions = {
},
//获取用户信息
- getUserInfo({ commit, state, dispatch }, switchAllaccounts) {
+ getUserInfo({
+ commit,
+ state,
+ dispatch
+ }, switchAllaccounts) {
return new Promise((resolve, reject) => {
if (!state.token) return
@@ -158,16 +173,29 @@ const actions = {
custom: {
silence: true
}
- }).then(({ phone, user_info, is_vip, wallet, balance,vip_expired }) => {
+ }).then(({
+ phone,
+ user_info,
+ is_vip,
+ wallet,
+ balance,
+ vip_expired
+ }) => {
let user = user_info
user.phone = phone
user.is_vip = is_vip
user.wallet = wallet
user.balance = balance
- user.vip_expired=vip_expired
+ user.vip_expired = vip_expired
commit('SET_USERINFO', user)
dispatch('bindCid')
- dispatch('getAccounts', { info: { ...user, token: state.token }, switchAllaccounts })
+ dispatch('getAccounts', {
+ info: {
+ ...user,
+ token: state.token
+ },
+ switchAllaccounts
+ })
resolve(user)
}).catch(err => {
reject(err)
@@ -175,7 +203,13 @@ const actions = {
})
},
- getAccounts({ commit, state }, { info, switchAllaccounts = false }) {
+ getAccounts({
+ commit,
+ state
+ }, {
+ info,
+ switchAllaccounts = false
+ }) {
const obj = {
avatar: info.avatar,
@@ -194,7 +228,9 @@ const actions = {
}
commit('SET_ACCOUNTS', all)
},
- resetToken({ commit }) {
+ resetToken({
+ commit
+ }) {
return new Promise(resolve => {
uni.removeStorageSync(TOKEN);
commit('RESET_STATE')
@@ -204,19 +240,30 @@ const actions = {
bindCid() {
// #ifdef APP-PLUS
const cid = plus.push.getClientInfo()?.clientid
- http.post('/v1/push-bind-uni', { cid }, { custom: { toast: false } })
+ http.post('/v1/push-bind-uni', {
+ cid
+ }, {
+ custom: {
+ toast: false
+ }
+ })
// #endif
},
//异步获取消息未读数
- getNewsNum({ commit, state }) {
+ getNewsNum({
+ commit,
+ state
+ }) {
return new Promise((resolve, reject) => {
if (!state.token) return
http.get('/v1/messages/wait-read-num', {}, {
custom: {
silence: true
}
- }).then(({ num }) => {
+ }).then(({
+ num
+ }) => {
commit('SET_NEWS', num)
resolve(num)
}).catch(err => {
@@ -225,7 +272,10 @@ const actions = {
})
},
//获取订单数量
- getOrderNum({ commit, state }) {
+ getOrderNum({
+ commit,
+ state
+ }) {
return new Promise((resolve, reject) => {
if (!state.token) return
http.get('/v1/order/statistics').then(res => {