完善功能

This commit is contained in:
2025-05-15 00:01:24 +08:00
parent dab4dba0fe
commit a92a6c5baf
10 changed files with 325 additions and 179 deletions

View File

@ -1,80 +1,58 @@
<template> <template>
<view class="order-goods bg-white"> <view class="order-goods bg-white">
<view v-for="(item, index) in list" :key="index" class="item-wrap"> <view v-for="(item, index) in list" :key="index" class="item-wrap u-p-b-20">
<view class="row-between u-p-l-20 u-p-r-20 u-p-t-20">
<view class="u-line-1 nr bold-500 text-000"> {{ item.goods_name || item.name }}</view>
<view class="text-999 flex1 u-m-l-40 text-nowrap">{{ orderDesc }}</view>
</view>
<view class="item row" @tap="toGoods(item.goods_id)"> <view class="item row" @tap="toGoods(item.goods_id)">
<view class="goods-img"> <view>
<u-image :src="item.image_str || item.image" <u-image :src="item.image_str || item.image"
:width="imageWidth" :width="imageWidth"
:height="imageHeight" :height="imageHeight"
:border-radius="imageRadius" :border-radius="imageRadius"
mode="aspectFit"
lazy-load/> lazy-load/>
</view> </view>
<view class="goods-info ml20 flex1"> <view class="goods-info ml20 flex1">
<view class="goods-name line2 mb10"> <view class="sm text-999">
<u-tag <view>下单时间:2024-10-10 16:58:53</view>
class="mr10" <view>预计时间:2025-10-10 16:58:54</view>
v-if="team.need" <view>数量:x{{ item.goods_num }}</view>
:text="team.need + '人团'" <view>实付:0.00</view>
size="mini" <view>{{item.spec_value_str || item.spec_value}}</view>
type="primary"
mode="plain"
/>
{{ item.goods_name || item.name }}</view
>
<view class="goods-spec xs muted mb20">{{
item.spec_value_str || item.spec_value
}}</view>
<view class="row-between">
<view class="goods-price row">
<view class="primary">
<price-format
v-if="!item.is_member && order_type === 0"
:weight="500"
:subscript-size="24"
:first-size="34"
:second-size="24"
:price="item.original_price || item.goods_price"
></price-format>
</view>
<view class="vip-price row" v-if="item.is_member && order_type === 0">
<view class="price-name xxs">会员价</view>
<view style="padding: 0 10rpx">
<price-format
:price="item.goods_price"
:first-size="22"
:second-size="22"
:subscript-size="22"
:weight="500"
color="#7B3200"
></price-format>
</view>
</view>
<view
class="vip-price row"
v-if="order_type === 1 || order_type === 2 || order_type === 3"
>
<view class="price-name xxs" style="background-color: #e74346">
<text v-if="order_type === 1">秒杀价</text>
<text v-if="order_type === 2">拼团价</text>
<text v-if="order_type === 3">砍价</text>
</view>
<view style="padding: 0 10rpx">
<price-format
:price="item.goods_price"
:first-size="22"
:second-size="22"
:subscript-size="22"
:weight="500"
color="#7B3200"
></price-format>
</view>
</view>
</view>
<view class="goods-num sm">x{{ item.goods_num }}</view>
</view> </view>
</view> </view>
</view> </view>
<view class="u-m-t-26 u-m-b-26 u-p-l-20 u-p-r-20">
<u-line color="#EEE" />
</view>
<view class="u-m-t-26 row-between u-p-l-20 u-p-r-20">
<view class="primary flex1">
<view v-if="getCancelTime(orderCancleTime) > 0" >
<u-count-down separator="zh"
:timestamp="getCancelTime(item.order_cancel_time)" separator-color="#FF2C3C"
color="#FF2C3C" :separator-size="26" :font-size="26" bg-color="transparent"
@end="refresh"></u-count-down>
</view>
</view>
<view class="row">
<view class="u-m-r-16">
<u-button @click="cancleOrder" hover-class="none" :customStyle="{width: '164rpx', height: '60rpx', color: '#999', border: '1px solid #DDD'}" :plain="true" :hair-line="false" shape="circle">取消订单</u-button>
</view>
<view>
<u-button @click="toPay" hover-class="none" :customStyle="{width: '164rpx', height: '60rpx', backgroundColor: themeColor, color: '#fff', border: 'none'}" :hair-line="false" shape="circle">去付款</u-button>
</view>
<!-- <view>
<u-button @click="seeDetails" hover-class="none" :customStyle="{width: '164rpx', height: '60rpx', backgroundColor: themeColor, color: '#fff', border: 'none'}" :hair-line="false" shape="circle">查看详情</u-button>
</view>
<view>
<u-button @click="toRefund" hover-class="none" :customStyle="{width: '164rpx', height: '60rpx', backgroundColor: themeColor, color: '#fff', border: 'none'}" :hair-line="false" shape="circle">查看详情</u-button>
</view> -->
</view>
</view>
<template v-if="mode === 'comfirm'"> <template v-if="mode === 'comfirm'">
<view class="delivery" v-if="delivery === 1 && !item.is_express" <view class="delivery" v-if="delivery === 1 && !item.is_express"
>该商品不支持快递配送</view >该商品不支持快递配送</view
@ -158,6 +136,14 @@ export default {
imageRadius: { imageRadius: {
type: Number, type: Number,
default: 0 default: 0
},
orderDesc: {
type: String,
default: ''
},
orderCancleTime: {
type: Number,
default: 0
} }
}, },
@ -167,8 +153,18 @@ export default {
uni.navigateTo({ uni.navigateTo({
url: `/pages/goods_details/goods_details?id=${id}` url: `/pages/goods_details/goods_details?id=${id}`
}) })
},
refresh() {
this.$emit('refresh')
} }
} },
computed: {
getCancelTime() {
return (time) => time - Date.now() / 1000;
},
},
} }
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@ -1,63 +1,125 @@
<template> <template>
<view> <view>
<view class="bg-white br16 px20 u-p-t-20 u-p-b-20 u-m-b-24"> <view class="u-p-t-20 u-p-b-20 ">
<view> <view>
<navigator hover-class="none" url="/pages/order_details/order_details?type=0"> <mescroll-body ref="mescroll" @init="mescrollInit" @down="downCallback" :up="upOption" @up="upCallback">
<view class="row-between"> <navigator
<view>煎饼果子套餐</view> class="br16 px20 u-m-b-24"
<view class="text-999">待付款</view> hover-class="none"
<!-- <view class="text-999">已完成</view> url="/pages/order_details/order_details?type=0"
<view class="text-999">退款</view> v-for="(item, index ) in orderList" :key="index">
<view class="primary" >未制作</view> <order-goods :list="item.order_goods"
<view class="primary" >未取餐</view> --> :order_type="item.order_type"
</view> :imageRadius="12"
<view class="u-m-t-16 row"> :orderDesc="item.order_status_desc"
<view> :orderCancleTime="item.order_cancle_time"
<u-image :src="cloudPath + 'img/banner.png'" width="124" height="124" border-radius="16"></u-image> @refresh="orderRefresh"></order-goods>
</view> <!-- <view class="row-between">
<view class="sm ml20 text-999"> <view>{{ item. }}</view>
<view>下单时间:2024-10-10 16:58:53</view> <view class="text-999">待付款</view> -->
<view>预计时间:2025-10-10 16:58:54</view> <!-- <view class="text-999">已完成</view>
<view>数量:1</view> <view class="text-999">退款</view>
<view>实付:0.00</view> <view class="primary" >未制作</view>
</view> <view class="primary" >未取餐</view> -->
</view> <!-- </view>
<view class="u-m-t-26 u-m-b-26"> <view class="u-m-t-16 row">
<u-line color="#EEE" /> <view>
</view> <u-image :src="cloudPath + 'img/banner.png'" width="124" height="124" border-radius="16"></u-image>
</navigator> </view>
<view class="sm ml20 text-999">
<view>下单时间:2024-10-10 16:58:53</view>
<view>预计时间:2025-10-10 16:58:54</view>
<view>数量:1</view>
<view>实付:0.00</view>
</view>
</view>
<view class="u-m-t-26 u-m-b-26">
<u-line color="#EEE" />
</view> -->
</navigator>
</mescroll-body>
</view> </view>
<view class="u-m-t-26 row-between"> <!-- <view class="u-m-t-26 row-between">
<view class="primary">等待时间:15分钟</view> <view class="primary">等待时间:15分钟</view> -->
<view class="row"> <!-- <view class="row">
<view class="u-m-r-16"> <view class="u-m-r-16">
<u-button @click="cancleOrder" hover-class="none" :customStyle="{width: '164rpx', height: '60rpx', color: '#999', border: '1px solid #DDD'}" :plain="true" :hair-line="false" shape="circle">取消订单</u-button> <u-button @click="cancleOrder" hover-class="none" :customStyle="{width: '164rpx', height: '60rpx', color: '#999', border: '1px solid #DDD'}" :plain="true" :hair-line="false" shape="circle">取消订单</u-button>
</view> </view>
<view> <view>
<u-button @click="toPay" hover-class="none" :customStyle="{width: '164rpx', height: '60rpx', backgroundColor: themeColor, color: '#fff', border: 'none'}" :hair-line="false" shape="circle">去付款</u-button> <u-button @click="toPay" hover-class="none" :customStyle="{width: '164rpx', height: '60rpx', backgroundColor: themeColor, color: '#fff', border: 'none'}" :hair-line="false" shape="circle">去付款</u-button>
</view> </view> -->
<!-- <view> <!-- <view>
<u-button @click="seeDetails" hover-class="none" :customStyle="{width: '164rpx', height: '60rpx', backgroundColor: themeColor, color: '#fff', border: 'none'}" :hair-line="false" shape="circle">查看详情</u-button> <u-button @click="seeDetails" hover-class="none" :customStyle="{width: '164rpx', height: '60rpx', backgroundColor: themeColor, color: '#fff', border: 'none'}" :hair-line="false" shape="circle">查看详情</u-button>
</view> </view>
<view> <view>
<u-button @click="toRefund" hover-class="none" :customStyle="{width: '164rpx', height: '60rpx', backgroundColor: themeColor, color: '#fff', border: 'none'}" :hair-line="false" shape="circle">查看详情</u-button> <u-button @click="toRefund" hover-class="none" :customStyle="{width: '164rpx', height: '60rpx', backgroundColor: themeColor, color: '#fff', border: 'none'}" :hair-line="false" shape="circle">查看详情</u-button>
</view> --> </view> -->
</view> <!-- </view>
</view> </view> -->
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import {
getOrderList,
cancelOrder,
delOrder,
confirmOrder,
completeAudit
} from '@/api/order'
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"
export default { export default {
name: 'order-list', name: 'order-list',
mixins: [MescrollMixin],
props: { props: {
type: { type: {
type: String, type: String,
default: 'all' default: 'all'
} }
}, },
data() {
return {
orderList: [],
upOption:{
noMoreSize: 4,
empty:{
tip: '~ 空空如也 ~', // 提示
btnText: ''
},
textNoMore: '没有更多了'
},
}
},
created() {
},
methods: { methods: {
// 初始化数据
upCallback(page) {
let pageNum = page.num // 页码, 默认从1开始
let pageSize = page.size // 页长, 默认每页10条
let {type} = this
getOrderList({
page_size: pageSize,
page_no: pageNum,
type
}).then(({
data
}) => {
let curPageData = data.list;
let curPageLen = curPageData.length;
let hasNext = !!data.more;
if (page.num == 1) this.orderList = [];
this.orderList = this.orderList.concat(curPageData);
this.mescroll.endSuccess(curPageLen, hasNext);
})
},
orderRefresh() {
this.mescroll.resetUpScroll()
},
// 取消订单 // 取消订单
cancleOrder() { cancleOrder() {

View File

@ -15,10 +15,12 @@ const IS_H5 = false
const baseURLMap = { const baseURLMap = {
// 开发环境 // 开发环境
// development: 'https://likeshop-open.yixiangonline.com', // development: 'https://likeshop-open.yixiangonline.com',
development: 'http://admin.likeshop.com', // development: 'http://admin.likeshop.com',
// development: 'https://jianbing.stnav.com', development: 'https://jianbing.stnav.com',
// development: 'https://jb.stnav.com',
// 生产环境https://php-b2c.likeshop.cn // 生产环境https://php-b2c.likeshop.cn
production: IS_H5 ? location.origin : ''
production: IS_H5 ? location.origin : 'https://jb.stnav.com'
} }
const baseURL = SWITCH_DEVELOPMENT ? baseURLMap['development'] : baseURLMap[process.env.NODE_ENV] const baseURL = SWITCH_DEVELOPMENT ? baseURLMap['development'] : baseURLMap[process.env.NODE_ENV]

View File

@ -1,6 +1,6 @@
{ {
"name" : "base", "name" : "base",
"appid" : "__UNI__119A841", "appid" : "__UNI__397496C",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : "100",

View File

@ -134,6 +134,12 @@
"navigationBarTitleText": "支付订单" "navigationBarTitleText": "支付订单"
} }
}, },
{
"path": "pages/pay_result/pay_result",
"style": {
"navigationBarTitleText": "支付详情"
}
},
{ {
"path": "components/uview-ui/components/u-avatar-cropper/u-avatar-cropper", "path": "components/uview-ui/components/u-avatar-cropper/u-avatar-cropper",
"style": { "style": {

View File

@ -19,7 +19,7 @@
<u-button @click="mobileLogin" hover-class="none" :customStyle="{color: themeColor, border: '1px solid ' + themeColor, padding: '16rpx 0'}" :plain="true" :hair-line="false" shape="circle">手机号登录/注册</u-button> <u-button @click="mobileLogin" hover-class="none" :customStyle="{color: themeColor, border: '1px solid ' + themeColor, padding: '16rpx 0'}" :plain="true" :hair-line="false" shape="circle">手机号登录/注册</u-button>
</view> </view>
<u-button @click="testLogin" hover-class="none" :customStyle="{backgroundColor: themeColor, color: '#fff', border: 'none', padding: '16rpx 0'}" :hair-line="false" shape="circle">测试账号一键登录</u-button> <!-- <u-button @click="testLogin" hover-class="none" :customStyle="{backgroundColor: themeColor, color: '#fff', border: 'none', padding: '16rpx 0'}" :hair-line="false" shape="circle">测试账号一键登录</u-button> -->
</view> </view>
<view class="u-m-t-32 u-flex u-row-center"> <view class="u-m-t-32 u-flex u-row-center">

View File

@ -42,6 +42,7 @@
} }
}, },
onLoad() { onLoad() {
// setTabbar()
}, },
methods: { methods: {
tabChange(index) { tabChange(index) {

View File

@ -252,18 +252,7 @@ export default {
this.pay.alipay = 1 this.pay.alipay = 1
//#endif //#endif
this.initDelivery() getDelivery()
},
onUnload() {
// 取消全局监听
uni.$off(['selectaddress', 'store'])
},
methods: {
// 初始化配送方式
initDelivery(){
getDelivery()
.then(({ code, data, msg }) => { .then(({ code, data, msg }) => {
// 请求结果判断 // 请求结果判断
if (code != 1) throw new Error(msg) if (code != 1) throw new Error(msg)
@ -298,14 +287,15 @@ export default {
uni.$on('payment', (params) => { uni.$on('payment', (params) => {
setTimeout(() => { setTimeout(() => {
uni.$off('payment') uni.$off('payment')
console.log("payment>>>", 'payment');
if (params.result) { if (params.result) {
uni.redirectTo({ uni.redirectTo({
url: `/pages/pay_result/pay_result?id=${params.order_id}` url: `/pages/pay_result/pay_result?id=${params.order_id}`
}) })
} else { } else {
uni.redirectTo({ uni.reLaunch({
url: '/pages/user_order/user_order' url: '/pages/order/order'
}) })
} }
}, 500) }, 500)
@ -318,13 +308,14 @@ export default {
.catch((err) => { .catch((err) => {
console.log(err) console.log(err)
}) })
}, },
// 初始化支付方式 onUnload() {
initPay() { // 取消全局监听
uni.$off(['selectaddress', 'store'])
}, },
methods: {
appointmentTime() { appointmentTime() {
this.timePopup = true this.timePopup = true
}, },
@ -334,17 +325,17 @@ export default {
getOrderCoupon({ getOrderCoupon({
goods: this.goods goods: this.goods
}) })
.then(({ code, data, msg }) => { .then(({ code, data, msg }) => {
if (code != 1) throw new Error(msg) if (code != 1) throw new Error(msg)
return data return data
}) })
.then((data) => { .then((data) => {
this.usableCoupon = data.usable this.usableCoupon = data.usable
this.unusableCoupon = data.unusable this.unusableCoupon = data.unusable
}) })
.catch((err) => { .catch((err) => {
console.log(err) console.log(err)
}) })
}, },
// 选择优惠券 // 选择优惠券
@ -456,54 +447,6 @@ export default {
this.showLoading = false this.showLoading = false
} }
}, },
// 订单处理
// handleOrderMethods(action) {
// // 订单提交数据
// const orderFrom = {
// action,
// goods: this.goods,
// delivery_type: this.delivery,
// use_integral: this.useIntegral,
// address_id: this.addressId,
// coupon_id: this.couponId,
// bargain_launch_id: this.bargainLaunchId == -1 ? '' : this.bargainLaunchId
// }
// switch (action) {
// case 'info':
// this.initPageData(orderFrom)
// break
// case 'submit':
// this.handleOrderSubmit(orderFrom)
// break
// }
// },
// // 订单提交
// async handleOrderSubmit(from) {
// this.showLoading = true
// from.remark = this.userRemark
// from.type = this.type
// try {
// const { code, data, msg } = this.teamId ? await teamBuy(from) : await orderBuy(from)
// if (code == 1) {
// uni.redirectTo({
// url: `/pages/payment/payment?from=${data.type}&order_id=${data.order_id}`
// })
// } else {
// throw new Error(msg)
// }
// } catch (err) {
// console.log(err)
// // this.$toast({ title: '下单异常,请重新操作' })
// } finally {
// this.showLoading = false
// }
// },
}, },
computed: { computed: {
delivery() { delivery() {

View File

@ -0,0 +1,134 @@
<template>
<view class="pay-result column-center">
<view class="contain bg-white">
<view class="header column-center">
<view>
<image class="tips-icon" :src="`${cloudPath}img/icon_paySuccess.png`"></image>
</view>
<view class="xl mt20">订单支付成功</view>
</view>
<view style="height:181rpx"></view>
<view class="info">
<view class="order-num row-between mt20">
<view class="ml20">订单编号</view>
<view class="mr20">
{{payInfo.order_sn}}
</view>
</view>
<view v-if="payInfo.pay_time" class="order-time row-between mt20">
<view class="ml20">付款时间</view>
<view class="mr20">{{payInfo.pay_time}}</view>
</view>
<view class="order-pay-type row-between mt20">
<view class="ml20">支付方式</view>
<view class="mr20">{{payInfo.pay_way_text}}</view>
</view>
<view class="order-pay-money row-between mt20">
<view class="ml20">支付金额</view>
<view class="mr20">
<price-format :price="payInfo.order_amount"></price-format>
</view>
</view>
</view>
<view class="line ml20"></view>
<view class="opt-btn-contain row-center wrap">
<navigator hover-class="none" class="check-order-btn row-center bg-default br60 mt20" open-type="switchTab" url="/pages/order/order">
<view class="white lg">查看订单</view>
</navigator>
<navigator hover-class="none" class="go-back-btn row-center br60 mt20" open-type="switchTab" url="/pages/index/index">
<view class="textdefault br60 lg">返回首页</view>
</navigator>
</view>
</view>
</view>
</template>
<script>
import {
getOrderDetail
} from '@/api/order';
export default {
data() {
return {
payInfo: {}
};
},
components: {
},
props: {},
onLoad: function(options) {
this.id = options.id;
this.getOrderResultFun();
},
methods: {
getOrderResultFun() {
getOrderDetail(this.id).then(res => {
if (res.code == 1) {
this.payInfo = res.data
}
});
},
}
};
</script>
<style lang="scss">
.pay-result {
.contain {
width: 682rpx;
margin-left: 20rpx;
margin-right: 20rpx;
border-radius: 10rpx;
margin-top: 78rpx;
padding-left: 20rpx;
padding-right: 20rpx;
padding-bottom: 40rpx;
position: relative;
.tips-icon {
width: 112rpx;
height: 112rpx;
}
.header {
position: absolute;
left: 50%;
transform: translateX(-50%);
top: -50rpx;
}
.order-num {
align-items: flex-start;
}
.info {
margin-bottom: 40rpx;
}
.opt-btn-contain {
margin-top: 40rpx;
.check-order-btn {
width: 650rpx;
height: 84rpx;
}
.go-back-btn {
width: 650rpx;
height: 84rpx;
border:1px solid #254062;
box-sizing: border-box;
}
}
.line {
width: 650rpx;
border-top: 1px solid rgba(229, 229, 229, 1);
}
}
}
</style>

View File

@ -506,10 +506,12 @@ checkbox {
.text-666 {color: #666} .text-666 {color: #666}
.text-999 {color: #999} .text-999 {color: #999}
.text-fff {color: #fff} .text-fff {color: #fff}
.text-000 {color: #000}
.text-gray {color: #86909C} .text-gray {color: #86909C}
.text-default {color: #254062} .text-default {color: #254062}
.bg-default {background-color: #254062} .bg-default {background-color: #254062}
.text-nowrap {white-space: nowrap}
.fixed {position: fixed;} .fixed {position: fixed;}