|
|
|
@ -0,0 +1,146 @@
|
|
|
|
|
<script setup>
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<view class="order">
|
|
|
|
|
<!-- 背景图片 -->
|
|
|
|
|
<view class="background">
|
|
|
|
|
<image src="../../static/background/background.jfif"></image>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 订单列表 -->
|
|
|
|
|
<view class="order_item" v-for="(item,index) in orderList" :key="item.supplier_order_id" @click="navToOrderDetail(item.supplier_order_id)">
|
|
|
|
|
<view class="shop"> <!-- 商铺名称 -->
|
|
|
|
|
<image src="../../static/order-icon/shop.png"></image>
|
|
|
|
|
<view class="shop_name">{{item.super_user_name}}</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="order_info"> <!-- 商铺信息 -->
|
|
|
|
|
<view>联系电话:{{item.super_phone}}</view>
|
|
|
|
|
<view>联系地址:{{item.super_address}}</view>
|
|
|
|
|
<view>订单时间:{{item.supplier_order_createdate | formatDate}}</view>
|
|
|
|
|
<view v-if="orderList[index].supplier_goods_price">交易价格:{{item.supplier_goods_price}}元</view>
|
|
|
|
|
<view v-if="orderList[index].supplier_goods_amount">交易数量:{{item.supplier_goods_amount}}</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="line"></view> <!-- 分割线 -->
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>```
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
// 订单列表基本信息
|
|
|
|
|
orderList: [],
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
// 获取供应商订单列表数据
|
|
|
|
|
async getOrder() {
|
|
|
|
|
const res = await this.$myRequest({
|
|
|
|
|
url: '/order/getOrderBySupplierId',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
data: JSON.stringify({
|
|
|
|
|
supplier_id: uni.getStorageSync('supplier_id')
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
this.orderList = res.data.data
|
|
|
|
|
|
|
|
|
|
// 计算总价和总量
|
|
|
|
|
for(let i=0;i<this.orderList.length;i++) {
|
|
|
|
|
// 请求接口
|
|
|
|
|
let res2 = await this.$myRequest({
|
|
|
|
|
url: '/order/getSingleOrderBySupplierGoodsId',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
data: JSON.stringify({
|
|
|
|
|
supplier_order_id: this.orderList[i].supplier_order_id
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 计算总价和总量
|
|
|
|
|
let orderDetail = res2.data.data
|
|
|
|
|
let order_all_price = 0
|
|
|
|
|
let order_all_amount = 0
|
|
|
|
|
for(let j=0;j<orderDetail.length;j++) {
|
|
|
|
|
order_all_price = order_all_price + orderDetail[j].supplier_goods_price * orderDetail[j].supplier_goods_amount
|
|
|
|
|
order_all_amount = order_all_amount + orderDetail[j].supplier_goods_amount
|
|
|
|
|
}
|
|
|
|
|
this.orderList[i].supplier_goods_price = order_all_price
|
|
|
|
|
this.orderList[i].supplier_goods_amount = order_all_amount
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 点击订单跳转至订单详情事件
|
|
|
|
|
navToOrderDetail(supplier_order_id) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '/pages/order/order-detail?supplier_order_id='+supplier_order_id
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 下拉刷新订单
|
|
|
|
|
onPullDownRefresh() {
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
this.getOrder(()=>{
|
|
|
|
|
uni.stopPullDownRefresh()
|
|
|
|
|
})
|
|
|
|
|
}, 500)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 页面加载
|
|
|
|
|
onLoad() {
|
|
|
|
|
// 获取供应商订单
|
|
|
|
|
this.getOrder()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
.order {
|
|
|
|
|
.background { // 背景图片
|
|
|
|
|
image {
|
|
|
|
|
position: fixed;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
z-index: -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.order_item {
|
|
|
|
|
background-color: white;
|
|
|
|
|
|
|
|
|
|
.shop { // 商店
|
|
|
|
|
display: flex;
|
|
|
|
|
padding: 10rpx 30rpx 0 30rpx;
|
|
|
|
|
image { // 商铺图片
|
|
|
|
|
padding: 5rpx 15rpx 0 0;
|
|
|
|
|
width: 60rpx;
|
|
|
|
|
height: 60rpx;
|
|
|
|
|
}
|
|
|
|
|
.shop_name { // 商店名称
|
|
|
|
|
font-size: 45rpx;
|
|
|
|
|
line-height: 70rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.order_info { // 联系电话、地址和订单生成时间
|
|
|
|
|
color: #555555;
|
|
|
|
|
padding: 0 30rpx 10rpx 30rpx;
|
|
|
|
|
font-size: 35rpx;
|
|
|
|
|
line-height: 60rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.line { // 分割线
|
|
|
|
|
width: 750rpx;
|
|
|
|
|
height: 8rpx;
|
|
|
|
|
background: #eee;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|