Browse Source

fix: 修复订单状态显示及金额积分显示问题

- 修正订单状态显示逻辑,将状态1改为"已付款",状态2改为"确认收货"
- 统一用户金额和积分显示字段,将price改为money
- 修复购物车商品ID字段从id改为cartId
- 添加快捷订单详情查询接口
- 修正拼写错误"搜素"为"搜索"
- 优化提现页面提示信息,将"金额"改为"积分"
- 调整QuickOrderEntry组件默认位置从30vh改为33vh
- 添加分享ID存储功能
- 修复分类页面城市ID查询条件
- 新增loadList混入用于列表加载通用逻辑
master
前端-胡立永 9 hours ago
parent
commit
2aa3db9a38
17 changed files with 202 additions and 69 deletions
  1. +5
    -0
      api/model/index.js
  2. +4
    -2
      components/QuickOrderEntry.vue
  3. +1
    -1
      components/userShop/userShopCommission.vue
  4. +1
    -1
      config.js
  5. +103
    -0
      mixins/loadList.js
  6. +1
    -1
      pages/index/cart.vue
  7. +1
    -1
      pages/index/category.vue
  8. +4
    -4
      pages/index/center.vue
  9. +4
    -1
      pages/index/index.vue
  10. +9
    -3
      pages/index/order.vue
  11. +2
    -1
      pages_order/mine/individualTeam.vue
  12. +23
    -23
      pages_order/mine/purse.vue
  13. +1
    -1
      pages_order/order/createOrder.vue
  14. +18
    -22
      pages_order/order/fastOrderList.vue
  15. +20
    -6
      pages_order/order/firmOrder.vue
  16. +4
    -1
      pages_order/order/orderDetail.vue
  17. +1
    -1
      pages_order/product/productList.vue

+ 5
- 0
api/model/index.js View File

@ -157,6 +157,11 @@ const api = {
url: '/index/getAddOrderPageBean',
method: 'GET',
},
// 查询快捷订单详情
getAddOrderInfo: {
url: '/index/getAddOrderInfo',
method: 'GET',
},
}
export default api

+ 4
- 2
components/QuickOrderEntry.vue View File

@ -36,7 +36,7 @@ export default {
default: true
},
bottom : {
default : '30vh',
default : '33vh',
}
},
data() {
@ -59,8 +59,10 @@ export default {
//
if (Array.isArray(this.orderInfo) && this.orderInfo.length > 0) {
this.$emit('order-info', this.orderInfo);
this.navigateTo('/pages_order/order/firmOrder');
return
}
//
if (this.targetUrl) {
this.navigateTo(this.targetUrl);


+ 1
- 1
components/userShop/userShopCommission.vue View File

@ -3,7 +3,7 @@
<image src="/static/image/center/10.png" mode=""></image>
<view class="price">
<view class="title">
积分
我的积分
</view>
<view class="num">
{{ userInfo.money }}


+ 1
- 1
config.js View File

@ -7,7 +7,7 @@ import uvUI from '@/uni_modules/uv-ui-tools'
Vue.use(uvUI);
// 当前环境
const type = 'dev'
const type = 'prod'
// 环境配置


+ 103
- 0
mixins/loadList.js View File

@ -0,0 +1,103 @@
function query(self, queryParams){
// return (self.beforeGetData && self.beforeGetData()) ||
// queryParams || self.queryParams
// 深度合并对象
return self.$utils.deepMergeObject(
self.$utils.deepMergeObject(self.queryParams,
(self.beforeGetData && self.beforeGetData()) || {}),
queryParams)
}
export default {
data() {
return {
queryParams: {
pageNo: 1,
pageSize: 10,
},
total : 0,
List : [],
hasMore: true, // 是否还有更多数据
loading: false, // 是否正在加载
}
},
onPullDownRefresh() {
},
onReachBottom() {
},
onShow() {
},
methods: {
// 刷新列表
refreshList() {
this.pageNo = 1;
this.hasMore = true;
this.orderList = [];
this.loadList();
},
// 加载更多
loadMore() {
if (!this.hasMore || this.loading) return;
this.pageNo++;
this.loadList();
},
// 加载订单列表
loadList() {
return new Promise((success, error) => {
if(!this.mixinsListApi){
return console.error('mixinsListApi 缺失');
}
if (this.loading) return;
this.loading = true;
const params = {
...this.queryParams,
};
this.$api(this.mixinsListApi, query(this, params))
.then(res => {
this.loading = false;
uni.stopPullDownRefresh();
if (res.code === 200 && res.result) {
this.getDataThen && this.getDataThen(res.result.records, res.result.total, res.result)
success(res.result)
const newList = res.result.records || [];
this.total = res.result.total
if (this.pageNo === 1) {
this.List = newList;
} else {
this.List = [...this.List, ...newList];
}
// 判断是否还有更多数据
this.hasMore = newList.length >= this.pageSize;
} else {
uni.showToast({
title: res.message || '加载失败',
icon: 'none'
});
error(res)
}
})
})
},
}
}

+ 1
- 1
pages/index/cart.vue View File

@ -178,7 +178,7 @@
},
valChange(item, e) {
this.$api('updateCartNum', {
id: item.id,
id: item.cartId,
num: e.value,
})
},


+ 1
- 1
pages/index/category.vue View File

@ -128,7 +128,7 @@
shopClassId: this.selectCategory.id,
pageNo: 1,
pageSize: 99999,
// cityId : this.selectCity.id,
cityId : this.selectCity.id,
}, res => {
if(res.code == 200) {
this.list = res.result.records


+ 4
- 4
pages/index/center.vue View File

@ -40,8 +40,8 @@
<image src="/static/image/center/1.png" mode=""></image>
</view>
<view class="">
我的积分
<p style="color:#DC2828; font-weight: 700;">{{ userInfo.money || 0 }}</p>
累计提现
<p style="color:#DC2828; font-weight: 700;">{{ userInfo.price || 0 }}</p>
</view>
</view>
<view class="item" @click="$utils.navigateTo('/pages_order/mine/purse')">
@ -49,8 +49,8 @@
<image src="/static/image/center/4.png" mode=""></image>
</view>
<view class="">
我的金额
<p style="color:#DC2828;font-weight: 700">{{ userInfo.price || 0 }}</p>
我的积分
<p style="color:#DC2828;font-weight: 700">{{ userInfo.money || 0 }}</p>
</view>
</view>
</view>


+ 4
- 1
pages/index/index.vue View File

@ -102,7 +102,10 @@ export default {
},
computed: {
},
onLoad() {
onLoad(query) {
if (query.shareId) {
uni.setStorageSync('shareId', query.shareId)
}
if(this.selectCity.id){
this.mixinsListApi = 'getProductList'
}


+ 9
- 3
pages/index/order.vue View File

@ -3,8 +3,11 @@
<navbar title="订单中心" bgColor="#DC2828" color="#fff" leftClick @leftClick="$utils.navigateBack" />
<uv-tabs :list="tabs" :activeStyle="{ color: '#FD5100', fontWeight: 600 }" lineColor="#FD5100" lineHeight="8rpx"
lineWidth="50rpx" :scrollable="false" @click="clickTabs"></uv-tabs>
<uv-tabs :list="tabs"
:activeStyle="{ color: '#FD5100', fontWeight: 600 }"
lineColor="#FD5100" lineHeight="8rpx"
lineWidth="50rpx"
@click="clickTabs"></uv-tabs>
<view v-if="orderList.records.length > 0" class="list">
<view class="item" v-for="(item, index) in orderList.records" @click="toOrderDetail(item.id)" :key="index">
@ -46,7 +49,7 @@
<view class="b2" v-if="item.status == 0" @click.stop="toPayOrder(item)">
立即支付
</view>
<view class="b2" v-if="item.status == 1" @click.stop="confirmOrder(item)">
<view class="b2" v-if="item.status == 2" @click.stop="confirmOrder(item)">
确认收货
</view>
<view class="b1" v-if="item.status == 0" @click.stop="cancelOrder(item)">
@ -86,6 +89,9 @@ export default {
{
name: '待付款'
},
{
name: '已付款'
},
{
name: '配送中'
},


+ 2
- 1
pages_order/mine/individualTeam.vue View File

@ -15,7 +15,8 @@
</view>
<view class="number-team">
<view class="top-number">
<text style="font-weight: 500;">{{ userInfo.phone }}</text>
<text style="font-weight: 500;">{{ userInfo.nickName }}</text>
<!-- <text style="font-weight: 500;">{{ userInfo.phone }}</text> -->
<view class="salesman">{{ levelMap[info.role] }}</view>
</view>
<view class="bottom-number">


+ 23
- 23
pages_order/mine/purse.vue View File

@ -14,25 +14,25 @@
<view>我要提现</view>
<view class="from-line">
<input
placeholder="请输入提现金额"
placeholder="请输入提现积分"
v-model="withdrawAmount"
type="digit"
@input="onAmountInput"
/>
</view>
<view class="tips" v-if="userInfo.price">
可提现金额¥{{userInfo.price}}
<view class="tips" v-if="userInfo.money">
可提现¥{{userInfo.money}}
</view>
<!-- 快捷金额选择 -->
<view class="quick-amounts" v-if="userInfo.price && parseFloat(userInfo.price) > 0">
<!-- 快捷积分选择 -->
<view class="quick-amounts" v-if="userInfo.money && parseFloat(userInfo.money) > 0">
<view class="quick-label">快捷选择</view>
<view class="amount-buttons">
<view
class="amount-btn"
v-for="amount in quickAmounts"
:key="amount"
:class="{'disabled': amount > parseFloat(userInfo.price)}"
:class="{'disabled': amount > parseFloat(userInfo.money)}"
@click="selectQuickAmount(amount)"
>
¥{{amount}}
@ -88,9 +88,9 @@
data() {
return {
notice: '',
withdrawAmount: '', //
withdrawAmount: '', //
isSubmitting: false, //
quickAmounts: [10, 50, 100, 200, 500], //
quickAmounts: [10, 50, 100, 200, 500], //
}
},
computed: {
@ -102,20 +102,20 @@
this.$store.commit('getUserInfo');
},
methods: {
//
//
selectQuickAmount(amount) {
if (amount > parseFloat(this.userInfo.price)) return;
if (amount > parseFloat(this.userInfo.money)) return;
this.withdrawAmount = amount.toString();
},
//
//
selectAllAmount() {
if (this.userInfo.price) {
this.withdrawAmount = parseFloat(this.userInfo.price).toString();
if (this.userInfo.money) {
this.withdrawAmount = parseFloat(this.userInfo.money).toString();
}
},
//
//
onAmountInput(e) {
let value = e.detail.value;
//
@ -132,11 +132,11 @@
this.withdrawAmount = value;
},
//
//
validateAmount() {
if (!this.withdrawAmount) {
uni.showToast({
title: '请输入提现金额',
title: '请输入提现积分',
icon: 'none'
});
return false;
@ -145,25 +145,25 @@
const amount = parseFloat(this.withdrawAmount);
if (isNaN(amount) || amount <= 0) {
uni.showToast({
title: '请输入正确的提现金额',
title: '请输入正确的提现积分',
icon: 'none'
});
return false;
}
//
if (this.userInfo.price && amount > parseFloat(this.userInfo.price)) {
//
if (this.userInfo.money && amount > parseFloat(this.userInfo.money)) {
uni.showToast({
title: '提现金额不能超过可用余额',
title: '提现积分不能超过可用余额',
icon: 'none'
});
return false;
}
// 1
// 1
if (amount < 1) {
uni.showToast({
title: '最小提现金额为1元',
title: '最小提现积分为1元',
icon: 'none'
});
return false;
@ -176,7 +176,7 @@
submitWithdraw() {
if (this.isSubmitting) return;
//
//
if (!this.validateAmount()) return;
//


+ 1
- 1
pages_order/order/createOrder.vue View File

@ -115,7 +115,7 @@
<image src="@/pages_order/static/createOrder/account.png" mode="widthFix" class="cell-icon">
</image>
<view class="user-name">账户余额</view>
<view class="descript">(余额: {{ userInfo.price }})</view>
<view class="descript">(余额: {{ userInfo.money }})</view>
</view>
<view class="cell-item-right">
<uv-radio activeColor="#E3441A"


+ 18
- 22
pages_order/order/fastOrderList.vue View File

@ -32,11 +32,11 @@
<text class="order-time">{{formatTime(order.createTime)}}</text>
</view>
<view class="order-status" :class="{
'pending': order.state === '0',
'approved': order.state === '1',
'cancelled': order.state === '2'
'pending': order.status === '0',
'approved': order.status === '1',
'cancelled': order.status === '2'
}">
<text>{{getStatusText(order.state)}}</text>
<text>{{getStatusText(order.status)}}</text>
</view>
</view>
@ -110,10 +110,10 @@
</view>
</view>
<!-- 空状态 -->
<view class="empty-state" v-if="!orderList.length && !loading">
<text class="empty-text">暂无{{currentTabName}}订单</text>
</view>
<!-- 空状态 -->
<view class="empty-state" v-if="!orderList.length && !loading">
<text class="empty-text">暂无{{currentTabName}}订单</text>
</view>
<!-- 加载更多 -->
<view class="load-more" v-if="orderList.length && hasMore">
@ -144,7 +144,7 @@
{ name: '全部', state: '' },
{ name: '待审核', state: '0' },
{ name: '已审核', state: '1' },
{ name: '已取消', state: '2' }
// { name: '', state: '2' }
],
orderList: [], //
pageNo: 1, //
@ -216,10 +216,14 @@
const params = {
pageNo: this.pageNo,
pageSize: this.pageSize,
state: this.statusTabs[this.currentTab].state
};
this.$api('getAddOrderPageBean', params, res => {
if(this.statusTabs[this.currentTab].state){
params.state = this.statusTabs[this.currentTab].state
}
this.$api('getAddOrderPageBean', params)
.then(res => {
this.loading = false;
uni.stopPullDownRefresh();
@ -240,15 +244,7 @@
icon: 'none'
});
}
}, err => {
this.loading = false;
uni.stopPullDownRefresh();
console.error('加载订单列表失败', err);
uni.showToast({
title: '网络错误,请重试',
icon: 'none'
});
});
})
},
//
@ -352,14 +348,14 @@
//
viewOrderDetail(order) {
//
if (order.state === '1') {
if (order.status === '1') {
//
this.$utils.navigateTo(`/pages_order/order/firmOrder?orderId=${order.id}`);
} else {
//
uni.showModal({
title: '订单详情',
content: `订单号: ${order.orderNumber || order.id}\n状态: ${this.getStatusText(order.state)}\n下单方式: ${this.getTypeName(order.type)}\n创建时间: ${this.formatTime(order.createTime)}`,
content: `订单号: ${order.orderNumber || order.id}\n状态: ${this.getStatusText(order.status)}\n下单方式: ${this.getTypeName(order.type)}\n创建时间: ${this.formatTime(order.createTime)}`,
showCancel: false
});
}


+ 20
- 6
pages_order/order/firmOrder.vue View File

@ -160,16 +160,30 @@
methods: {
//
getOrderInfo() {
this.$api('getOrderInfo', res => {
if (res.code === 200 && res.result[0]) {
// commonShop
this.productInfo = res.result[0];
// this.$api('getOrderInfo', res => {
// if (res.code === 200 && res.result[0]) {
// // commonShop
// this.productInfo = res.result[0];
// this.productInfo.commonShop.forEach(n => {
// this.checkboxValue.push(n.id)
// })
// }
// });
this.$api('getAddOrderInfo', {
orderId : this.orderId
}, res => {
if (res.code === 200 && res.result) {
// commonShop
this.productInfo = res.result;
this.productInfo.commonShop.forEach(n => {
this.checkboxValue.push(n.id)
})
}
});
}
});
},
//


+ 4
- 1
pages_order/order/orderDetail.vue View File

@ -23,7 +23,7 @@
>
立即支付
</view>
<view class="btn2" v-if="order.status == 1"
<view class="btn2" v-if="order.status == 2"
@click.stop="confirmOrder(order)"
>
确认收货
@ -215,6 +215,9 @@ export default {
{
name: '待付款'
},
{
name: '已付款'
},
{
name: '配送中'
},


+ 1
- 1
pages_order/product/productList.vue View File

@ -59,7 +59,7 @@
this.queryParams.shopIconId = iconId
}else if(search){
this.search = search
this.title = '搜材料'
this.title = '搜材料'
}
},
methods: {


Loading…
Cancel
Save