From c212c9ab501e1aff9e2dd90e8e87871c0bc7f1bc Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期二, 30 七月 2024 14:03:29 +0800
Subject: [PATCH] fix bug
---
pages/order/order-sale/order-sale.vue | 53 +++++++++++++
manifest.json | 2
pages.json | 35 ++++----
pages/user/user-customer.scss | 14 +++
pages/order/order.vue | 21 ++++
plugins/http.js | 53 +++++++-----
pages/user/supplier-user.vue | 20 ++++
store/index.js | 3
sub_pages/customer/trade/detail.vue | 2
9 files changed, 156 insertions(+), 47 deletions(-)
diff --git a/manifest.json b/manifest.json
index 7911942..651a10c 100644
--- a/manifest.json
+++ b/manifest.json
@@ -49,7 +49,7 @@
"quickapp" : {},
/* 快应用特有相关 */
"mp-weixin" : {
- "appid" : "wx6d0ecc4e18710458",
+ "appid" : "wx1441324401626290",
"setting" : {
"urlCheck" : false,
"es6" : true,
diff --git a/pages.json b/pages.json
index 1fc9c7a..6987faf 100644
--- a/pages.json
+++ b/pages.json
@@ -3,22 +3,7 @@
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
},
- "pages": [{
- "path": "pages/login/supplier-login",
- "style": {
- "navigationBarTitleText": "登录",
- "enablePullDownRefresh": false,
- "navigationStyle": "custom"
- }
- },
- {
- "path": "pages/home/supplier-home",
- "style": {
- "navigationBarTitleText": "首页",
- "enablePullDownRefresh": true,
- "navigationStyle": "custom"
- }
- },
+ "pages": [
// #ifdef PUB_CUSTOMER
{
"path": "pages/home/home",
@@ -34,7 +19,23 @@
"navigationBarTitleText": "收货地址"
}
},
- // #endif
+ // #endif
+ {
+ "path": "pages/login/supplier-login",
+ "style": {
+ "navigationBarTitleText": "登录",
+ "enablePullDownRefresh": false,
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/home/supplier-home",
+ "style": {
+ "navigationBarTitleText": "首页",
+ "enablePullDownRefresh": true,
+ "navigationStyle": "custom"
+ }
+ },
{
"path": "pages/login/supplier-reg",
"style": {
diff --git a/pages/order/order-sale/order-sale.vue b/pages/order/order-sale/order-sale.vue
index 81dc4ff..e35e0bf 100644
--- a/pages/order/order-sale/order-sale.vue
+++ b/pages/order/order-sale/order-sale.vue
@@ -51,6 +51,12 @@
<view class="label">理由</view>
<view class="value">{{item.reason}}</view>
</view>
+ <!-- #ifdef PUB_CUSTOMER -->
+ <view class="line-gray" v-if="item.status=='PENDING'"></view>
+ <view class="flex buttons" v-if="item.status=='PENDING'">
+ <view class="button button-1 m-l-15 m-r-0" @click="cancelSale(item)">取消售后</view>
+ </view>
+ <!-- #endif -->
</view>
</view>
</view>
@@ -92,6 +98,22 @@
uni.stopPullDownRefresh()
},
methods: {
+ async cancelSale(item) {
+ await this.$message.confirm('是否取消售后')
+ this.$message.showLoading()
+ const {
+ code,
+ data
+ } = await this.$http.request('get', '/api/customer/sales/list/cancel', {
+ params: {
+ id: item.id
+ }
+ })
+ this.$message.hideLoading()
+ if (code === 0) {
+ this.refreshList()
+ }
+ },
changeIndex(index) {
if (this.tabIndex !== index) {
this.tabIndex = index
@@ -165,6 +187,37 @@
max-width: unset;
}
}
+
+ .buttons {
+ display: flex;
+ margin-left: auto;
+ width: fit-content;
+
+ .button {
+ // width: 216rpx;
+ padding: 10rpx 20rpx;
+ line-height: 34rpx;
+ font-size: 24rpx;
+ height: 34rpx;
+ background: #20613D;
+ text-align: center;
+ border-radius: 30rpx;
+
+ }
+
+ .button-1 {
+ background: #fff;
+ color: #333;
+ border: 2rpx solid #333;
+
+ }
+
+ .button-0 {
+ color: #fff;
+ border: 2rpx solid #20613D;
+ }
+ }
+
}
}
</style>
\ No newline at end of file
diff --git a/pages/order/order.vue b/pages/order/order.vue
index a53af5d..91f51cc 100644
--- a/pages/order/order.vue
+++ b/pages/order/order.vue
@@ -80,6 +80,7 @@
})
this.$message.hideLoading()
if (code === 0) {
+ this.$store.dispatch('sign_add','order')
this.refreshList()
}
}
@@ -124,6 +125,7 @@
console.log('pay success', res)
that.$message.showToast('支付成功')
setTimeout(() => {
+ that.$store.dispatch('sign_add','order')
that.refreshList()
}, 200)
},
@@ -165,8 +167,23 @@
// },
case 'cancelOrder': {
- this.$message.showToast('敬请期待')
- },
+ await this.$message.confirm('是否取消订单')
+ // 发送请求
+ this.$message.showLoading()
+ const {
+ code
+ } = await this.$http.request('get', '/api/customer/order/cancel', {
+ params: {
+ id: item.id,
+ }
+ })
+ this.$message.hideLoading()
+ if (code === 0) {
+ this.$store.dispatch('sign_add','order')
+ this.refreshList()
+ }
+ }
+ break
default:
break
}
diff --git a/pages/user/supplier-user.vue b/pages/user/supplier-user.vue
index 36cc797..234857b 100644
--- a/pages/user/supplier-user.vue
+++ b/pages/user/supplier-user.vue
@@ -80,8 +80,11 @@
</view>
</view>
<view class="flex order-icons-container">
- <view class="order-icons" @click="goto('/pages/order/order?status=PENDING',true)">
- <image src="../../static/images/customer/order/order-type-1.png" class="order-icon dfk"></image>
+ <view class="order-icons" style="position: relative;" @click="goto('/pages/order/order?status=PENDING',true)">
+ <image src="../../static/images/customer/order/order-type-1.png" class="order-icon dfk"
+ style="position: relative;">
+ <view class="image-shop-number">{{order_pendding_num||''}}</view>
+ </image>
<view>待付款</view>
</view>
<view class="order-icons" @click="goto('/pages/order/order?status=SEND',true)">
@@ -289,6 +292,7 @@
tel: '15974805814',
tj: {},
cacheUserId: '',
+ order_pendding_num: 0,
};
},
@@ -349,6 +353,18 @@
that.tj = res.data || {}
}
})
+ //获取待支付数目
+ this.$http.request('get', '/api/customer/order/count/pending', {
+ params: {
+ }
+ }).then(res => {
+ if (res.code === 0) {
+ that.order_pendding_num = res.data || 0
+
+ }
+ })
+
+
// #endif
}, 200)
}
diff --git a/pages/user/user-customer.scss b/pages/user/user-customer.scss
index 37f2d03..c90db55 100644
--- a/pages/user/user-customer.scss
+++ b/pages/user/user-customer.scss
@@ -1,5 +1,19 @@
.user-customer-order-infos{
padding-top: 0rpx;
+ .image-shop-number {
+ width: 30rpx;
+ height: 30rpx;
+ background: #F20000;
+ line-height: 30rpx;
+ text-align: center;
+ position: absolute;
+ right: 0rpx;
+ top: -6rpx;
+ color: #FFFFFF;
+ border-radius: 50%;
+ font-size: 24rpx;
+ }
+
.more{
font-weight: 400;
font-size: 24rpx;
diff --git a/plugins/http.js b/plugins/http.js
index db3b571..47b71d6 100644
--- a/plugins/http.js
+++ b/plugins/http.js
@@ -64,14 +64,15 @@
msg: ''
})
} else {
- console.log('res',res.data)
+ console.log('res', res.data)
if (res.data.code == ('0')) {
resolve({
data: res.data.data,
code: 0,
msg: ''
})
- } else if (res.data.code === '3000'||res.data&&res.data.code&&res.data.code.startsWith('3000')) {
+ } else if (res.data.code === '3000' || res.data && res.data.code &&
+ res.data.code.startsWith('3000')) {
if (Array.isArray(res.data.data)) {
if (res.data.data.length > 0 && res.data.data[0]
.msg) {
@@ -87,8 +88,28 @@
code: parseInt(res.data.code),
msg: res.data.data || res.data.msg
})
- } else if (res.data.code === '4000'||res.data&&res.data.code&&res.data.code.startsWith('4000')) {
- message.showToast('系统异常')
+ } else if (res.data.code === '4000' || res.data && res.data.code &&
+ res.data.code.startsWith('4000')) {
+ message.showToast('系统异常')
+ } else if (res.data.code === '401' || res.data && res.data.code &&
+ res.data.code.startsWith('401')) {
+ message.showToast('登录信息失效')
+ storage.removeItem('token')
+ reject({
+ data: null,
+ code: 401,
+ msg: 'Unauthorized'
+ })
+ // #ifdef PUB_CUSTOMER
+ uni.reLaunch({
+ url: '/pages/user/supplier-user'
+ })
+ // #endif
+ // #ifndef PUB_CUSTOMER
+ uni.reLaunch({
+ url: '/pages/login/supplier-login'
+ })
+
} else {
if (res.data.data && typeof res.data.data === 'string') {
message.showToast(res.data.data)
@@ -128,20 +149,6 @@
})
// #endif
- // if (!http.isShowMessage) {
- // http.isShowMessage = true
- // message.confirm('登录状态已失效,是否重新登录?').then(() => {
- // uni.navigateTo({
- // url: '/pages/account/login'
- // })
- // http.isShowMessage = false
- // }).catch(() => {
- // uni.reLaunch({
- // url: '/pages/home'
- // })
- // http.isShowMessage = false
- // })
- // }
} else if (res.statusCode === 403) {
message.showToast('请求被拒绝')
reject({
@@ -216,7 +223,7 @@
if (res.statusCode === 200) {
const obj = JSON.parse(res.data)
console.log('res debug2', obj)
- if (obj.code.startsWith('200')||obj.code==='0') {
+ if (obj.code.startsWith('200') || obj.code === '0') {
resolve({
data: obj.data,
code: 0,
@@ -238,10 +245,10 @@
})
})
},
-
+
async requestCode(method, url, options) {
try {
- return await http.requestTemp(method, `${pre}/${version}`+ url, options)
+ return await http.requestTemp(method, `${pre}/${version}` + url, options)
} catch (e) {
return e
}
@@ -259,7 +266,7 @@
try {
return await http.uploadTemp(filePath, dto)
} catch (e) {
- console.log('error',e)
+ console.log('error', e)
return e
}
},
@@ -297,4 +304,4 @@
}
-export default http
+export default http
\ No newline at end of file
diff --git a/store/index.js b/store/index.js
index 0985520..8a82f8b 100644
--- a/store/index.js
+++ b/store/index.js
@@ -29,7 +29,8 @@
'flower': 0,
'shopping': 0,
'follow': 0,
- 'delivery': 0
+ 'delivery': 0,
+ 'order':0
},
defaultaddress: {}
},
diff --git a/sub_pages/customer/trade/detail.vue b/sub_pages/customer/trade/detail.vue
index 34afd53..9a1288e 100644
--- a/sub_pages/customer/trade/detail.vue
+++ b/sub_pages/customer/trade/detail.vue
@@ -13,7 +13,7 @@
</view>
<view class="icon-container">
<image src="../../../static/common/icon-shop.png" @click="toShopping(dto)" class="icon-shop">
- <view class="image-shop-number">{{shopnum||'1'}}</view>
+ <view class="image-shop-number">{{shopnum||''}}</view>
</image>
</view>
--
Gitblit v1.9.3