NurseStationApp/pages/CommodityOrder/CommodityOrder.vue

241 lines
7.1 KiB
Vue
Raw Normal View History

2022-10-28 15:37:07 +08:00
<template>
<view class="app">
<view class="inputs">
<i class="icon"></i>
2022-11-01 16:26:34 +08:00
<input v-model="goodsName" type="text" name="" id="" class="input" placeholder="请输入商品名称">
2022-10-28 15:37:07 +08:00
</view>
2022-11-15 15:36:29 +08:00
<view class="" v-if="total>0">
<view class="Apayment" v-for='(item,index) in orderlist' :key="index">
<view class="names">店铺名称
<image class="picture" src="/static/pic.png" mode=""></image>
<span v-if="item.orderStatus=='WAIT_PAY'">待付款</span>
2022-12-06 10:10:34 +08:00
<span v-if="item.orderStatus=='WAIT_PAY'&&item.timestamp<=0">订单已关闭</span>
2022-11-15 15:36:29 +08:00
<span v-if="item.orderStatus=='WAIT_REFUND'">退款中</span>
<span v-if="item.orderStatus=='CANCEL'">已取消</span>
<span v-if="item.orderStatus=='WAIT_RECEIVED_GOODS'">待收货</span>
2022-11-23 16:41:09 +08:00
<span v-if="item.orderStatus=='RECEIVED_GOODS'">待评价</span>
<span v-if="item.orderStatus=='EVALUATED'">已完成</span>
2022-11-15 15:36:29 +08:00
<span v-if="item.orderStatus=='PAY'">待发货</span>
<span v-if="item.orderStatus=='REFUNDED'">退款成功</span>
<span v-if="item.orderStatus=='WAIT_RETURNED_GOODS'">待退货</span>
<span v-if="item.orderStatus=='RETURNED_GOODS'">退款成功</span>
</view>
<view class="details" @tap='goorderdetails(item)'>
<view class="detailslist">
<image :src="baseurl+item.attributePitureUrl" mode=""></image>
<view class="model">
<view class="top">
<span>{{item.goodsName}}</span>
<span>{{item.goodsPrice}}</span>
</view>
<view class="bottom">
<span class="box">型号{{item.goodsAttributeName}}</span>
<span class="box">×{{item.goodsCount}}</span>
</view>
<view class="refund">
实付款
2022-12-01 17:03:02 +08:00
<text class="price">{{item.totalPrice}}</text>
2022-11-15 15:36:29 +08:00
</view>
2022-10-28 15:37:07 +08:00
</view>
</view>
</view>
2022-11-15 15:36:29 +08:00
<view class="anniu">
<view class="logistics" v-if="item.orderStatus=='WAIT_RECEIVED_GOODS'" @tap='gologistics(item)'>查看物流
</view>
2022-12-06 10:10:34 +08:00
<view class="logistics harvest" v-if="item.orderStatus=='WAIT_PAY'&&item.timestamp>0"
@tap='buy(item)'>
2022-11-15 15:36:29 +08:00
去支付</view>
<view class="logistics harvest" @tap='Receipt(item)' v-if="item.orderStatus=='WAIT_RECEIVED_GOODS'">
确认收货</view>
2022-11-23 16:41:09 +08:00
<view class="logistics harvest" @tap='rate(item)' v-if="item.orderStatus=='RECEIVED_GOODS'">
立即评价</view>
2022-11-01 16:26:34 +08:00
</view>
2022-11-15 15:36:29 +08:00
</view>
</view>
<view class="noorder" v-else>
<image src="../../static/noorder.png" mode=""></image>
<view class="">
暂无商品订单
2022-11-01 16:26:34 +08:00
</view>
2022-10-28 15:37:07 +08:00
</view>
<!-- 弹框 -->
<view class="frame">
<u-popup v-model="show" mode="bottom" length="45%" border-radius="30">
<view class="payment">
<span>确认收到货了吗</span>
2022-11-01 16:26:34 +08:00
<image src="../../static/gb.png" mode="" @tap="show = false"></image>
2022-10-28 15:37:07 +08:00
</view>
<view class="chat">
2022-11-01 16:26:34 +08:00
<view class="image">
<image :src="baseurl+img" mode=""></image>
<view class="blackground">共1件</view>
</view>
<view class="word">为了保证你的售后权益请收到商品确认无误后再确认收货</view>
2022-10-28 15:37:07 +08:00
</view>
2022-11-11 14:19:07 +08:00
<view class="submits" @tap='Receipts'>确定</view>
2022-10-28 15:37:07 +08:00
</u-popup>
</view>
2022-11-11 14:19:07 +08:00
<u-toast ref="uToast" />
2022-10-28 15:37:07 +08:00
</view>
</template>
<script>
2022-11-01 16:26:34 +08:00
import {
2022-11-11 14:19:07 +08:00
ssgoodsOrder,
confirmReceipt
2022-11-01 16:26:34 +08:00
} from '@/api/CommodityOrder/index.js'
import baseurl from '@/api/baseurl.js'
2022-10-28 15:37:07 +08:00
export default {
data() {
return {
2022-11-11 14:19:07 +08:00
orderNoitem: '',
2022-11-09 16:38:05 +08:00
title: '商品订单', //导航标题
2022-11-01 16:26:34 +08:00
baseurl: '', //url
orderlist: [], //商品订单list
total: 0, //list长度
show: false, //确认收获开关
img: '', //确认收货页面图片
patientId: '',
orderStatus: '', //
goodsOrderId: '', //
pageSize: 10, //
pageNum: 1, //
goodsName: '',
2022-10-28 15:37:07 +08:00
}
},
methods: {
2022-11-23 16:41:09 +08:00
//评价
rate(item) {
uni.navigateTo({
url: `/pages/goodsorderRate/goodsorderRate?item=${JSON.stringify(item)}`
})
},
2022-11-11 14:19:07 +08:00
//收货
Receipts() {
confirmReceipt(this.orderNoitem.goOrderNo).then(res => {
if (res.code == 200) {
this.$refs.uToast.show({
title: '收货成功',
type: 'success',
duration: '1000'
})
this.show = false
setTimeout(e => {
uni.navigateTo({
2022-11-23 16:41:09 +08:00
url: `/pages/goodsorderRate/goodsorderRate?item=${JSON.stringify(this.orderNoitem)}`
2022-11-11 14:19:07 +08:00
})
2022-11-23 16:41:09 +08:00
// uni.navigateTo({
// url: `/pages/orderDetails/orderDetails?goodsOrderId=${this.orderNoitem.goodsOrderId}`
// })
2022-11-11 14:19:07 +08:00
}, 1000)
} else {}
})
},
2022-11-10 16:40:00 +08:00
//支付
buy(item) {
let obj = {
patientId: this.patientId,
orderNo: item.goOrderNo,
orderChannel: "WECHAT_APPLET",
paymentPrice: item.totalPrice,
payType: "WECHAT_PAY",
buySource: item.buySource,
}
console.log(obj)
},
2022-11-01 16:26:34 +08:00
//物流页面
gologistics(item) {
2022-10-28 15:37:07 +08:00
uni.navigateTo({
2022-11-01 16:26:34 +08:00
url: `/pages/logistics/logistics?item=${JSON.stringify(item)}`
2022-10-28 15:37:07 +08:00
})
},
2022-11-01 16:26:34 +08:00
//订单详情页面
goorderdetails(item) {
uni.navigateTo({
url: `/pages/orderDetails/orderDetails?goodsOrderId=${item.goodsOrderId}`
})
},
//商品订单请求
goodsOrderinfo() {
ssgoodsOrder(this.patientId, this.orderStatus, this.goodsOrderId, this.pageSize, this.pageNum, this
.goodsName).then(
res => {
this.orderlist = res.rows
this.total = res.total
2022-12-06 10:10:34 +08:00
this.orderlist.forEach(e => {
e.timestamp = null
var time = new Date(e.orderTime).getTime() / 1000 + (60 * 60 * 24)
var times = new Date().getTime() / 1000
e.timestamp = time - times
})
2022-11-01 16:26:34 +08:00
})
},
//确认收货
Receipt(item) {
2022-11-11 14:19:07 +08:00
this.orderNoitem = item
2022-11-01 16:26:34 +08:00
this.img = item.attributePitureUrl
this.show = true
},
},
watch: { //监听
goodsName() {
this.goodsOrderinfo()
},
},
onReady() { //更改导航栏文字
uni.setNavigationBarTitle({
title: this.title,
});
},
2022-12-06 10:10:34 +08:00
onLoad(options) { //开局调用
2022-11-09 16:38:05 +08:00
let that = this
try {
const value = uni.getStorageSync('patientId');
if (value) {
that.patientId = value
that.goodsOrderinfo();
}
} catch (e) {}
this.baseurl = baseurl;
2022-11-01 16:26:34 +08:00
if (options.orderStatus) {
this.orderStatus = options.orderStatus
2022-11-09 16:38:05 +08:00
if (options.orderStatus == 'WAIT_PAY') {
this.title = '待付款'
} else if (options.orderStatus == 'WAIT_RECEIVED_GOODS') {
this.title = '待收货'
} else if (options.orderStatus == 'RECEIVED_GOODS') {
this.title = '已完成'
2022-10-28 15:37:07 +08:00
}
}
2022-11-01 16:26:34 +08:00
},
onReachBottom() { //下滑加载
if (this.orderlist.length >= this.total) {} else {
this.pageNum++;
ssgoodsOrder(this.patientId, this.orderStatus, this.goodsOrderId, this.pageSize, this.pageNum, this
.goodsName).then(
res => {
res.rows.forEach(e => {
2022-12-06 10:10:34 +08:00
e.timestamp = null
var time = new Date(e.orderTime).getTime() / 1000 + (60 * 60 * 24)
var times = new Date().getTime() / 1000
e.timestamp = time - times
2022-11-01 16:26:34 +08:00
this.orderlist.push(e)
})
this.total = res.total
})
2022-10-28 15:37:07 +08:00
}
2022-11-01 16:26:34 +08:00
},
onPullDownRefresh() { //下拉刷新
this.pageNum = 1;
2022-12-06 10:10:34 +08:00
this.goodsOrderinfo();
2022-11-01 16:26:34 +08:00
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
2022-10-28 15:37:07 +08:00
}
2022-11-01 16:26:34 +08:00
</script>
<style lang="scss">
@import "./CommodityOrder.scss";
2022-10-28 15:37:07 +08:00
</style>