uni-Identify-quality/pages/order-goods/index.vue

542 lines
13 KiB
Vue
Raw Normal View History

2023-09-19 02:53:38 +00:00
<template>
2023-09-21 04:01:11 +00:00
<div class="order-goods">
<title-block title="订单库">
<template #left>
2023-09-21 06:40:19 +00:00
<u-action-sheet
:show="show"
2023-09-22 07:49:19 +00:00
:actions="statusValue.map(x=>({name:x.label,value:x.value}))"
2023-09-21 06:40:19 +00:00
title="请选择状态"
@close="show = false"
@select="statusSelect"
>
</u-action-sheet>
<div @click="openStatus" class="wrap1">
<div class="wrap1_1">
2023-09-22 08:16:11 +00:00
<div class="wrap1_1_1">{{ statusValue.find(x => x.value === artworkStatus).label }}</div>
2023-09-21 06:40:19 +00:00
<image style="width: 12rpx;height: 8rpx" src="../../static/dbx2@3x.png"></image>
</div>
2023-09-21 04:01:11 +00:00
</div>
</template>
</title-block>
<div class="content2">
2023-09-19 07:48:24 +00:00
<div class="wrap1">
<div class="wrap1_1">
<image src="../../static/zu1@3x.png"></image>
</div>
<div class="wrap1_2"></div>
2023-09-21 06:40:19 +00:00
<input v-model="mobileKey" placeholder-style="color: #C7C7C7;font-size: 20rpx;"
placeholder="在此处搜索您的订单"/>
2023-09-19 07:48:24 +00:00
</div>
2023-09-21 06:40:19 +00:00
<div class="wrap2" @click="search">
2023-09-19 07:48:24 +00:00
搜索
</div>
</div>
2023-09-23 06:38:30 +00:00
2023-09-25 04:00:57 +00:00
<div class="content3">
<scroll-view :style="{height:`${elementBottom}rpx`}" class="scrollbox" :scroll-y="true" @scrolltolower="loadMore">
2023-09-21 06:40:19 +00:00
<div
v-for="(item,index) in mainList" :key="index"
@touchstart="(e)=>{touchStart(e,index)}"
@touchmove="(e)=>{touchMove(e,index)}"
@touchend="()=>{touchEnd(index)}"
2023-09-22 05:24:04 +00:00
@click="goRouter(item)"
2023-09-21 06:40:19 +00:00
:style="{transform: `translateX(${item.distanceX}px)`}" class="wrap1">
<div class="wrap1_1">
2023-09-22 08:16:11 +00:00
<image :src="item.artworkImg?item.artworkImg:'../../static/jx632@3x.png'"></image>
2023-09-19 07:48:24 +00:00
</div>
2023-09-21 06:40:19 +00:00
<div class="wrap1_2">
2023-09-23 03:50:34 +00:00
<div class="wrap1_2_1">{{ item.artworkName }}</div>
<div class="wrap1_2_2">订单号:{{ item.artworkName }}</div>
<div class="wrap1_2_3">{{ item.artworkSquareSize }}平尺</div>
<div class="wrap1_2_4">{{ item.startAt }}-{{ item.endAt }}</div>
2023-09-21 04:01:11 +00:00
</div>
2023-09-22 07:49:19 +00:00
<div class="wrap1_3" :class="[`status${item.artworkStatus}`]">
<div class="wrap1_3_1" v-if="item.artworkStatus===4">
2023-09-25 04:00:57 +00:00
<div class="wrap1_3_1_1">{{ item.endAt }}</div>
2023-09-23 03:50:34 +00:00
<div class="wrap1_3_1_2">已延期</div>
2023-09-25 04:00:57 +00:00
<div class="wrap1_3_1_3" @click.stop="openShow2(item)">点击补款</div>
2023-09-21 06:40:19 +00:00
</div>
2023-09-22 07:49:19 +00:00
<div class="wrap1_3_3" v-if="item.artworkStatus!==4">
<div class="wrap1_3_3_1">{{ statusValue.find(x => x.value === item.artworkStatus).label }}</div>
2023-09-21 06:40:19 +00:00
</div>
<div class="wrap1_3_2">
<div class="wrap1_3_2_1">货架号:</div>
2023-09-23 03:50:34 +00:00
<div class="wrap1_3_2_2">{{ item.shelvesNum }}</div>
2023-09-21 06:40:19 +00:00
</div>
2023-09-21 04:01:11 +00:00
</div>
2023-09-23 03:50:34 +00:00
<div class="wrap1_4" v-if="item.isRight&&item.artworkStatus===5" @click.stop="openDelete(item)">
2023-09-21 06:40:19 +00:00
<image style="width: 80rpx;height: 80rpx" src="../../static/zu154@3x.png"></image>
</div>
2023-09-19 07:48:24 +00:00
</div>
2023-09-25 04:00:57 +00:00
</scroll-view>
</div>
<uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog :type="'info'" cancelText="关闭" confirmText="确认" title="提示" :content="messageText"
@confirm="popForward"
></uni-popup-dialog>
</uni-popup>
2023-09-19 02:53:38 +00:00
<tabbar :current="1"></tabbar>
</div>
</template>
2023-09-19 02:50:09 +00:00
<script>
2023-09-19 02:53:38 +00:00
import tabbar from "../../components/uiq-tabbar/uiq-tabbar.vue";
2023-09-19 07:48:24 +00:00
import UImage from "../../uview-ui/components/u--image/u--image.vue";
2023-09-21 04:01:11 +00:00
import {postDataByParams} from "../../http/service";
2023-09-19 02:53:38 +00:00
2023-09-19 02:50:09 +00:00
export default {
2023-09-19 02:53:38 +00:00
name: "index",
2023-09-21 04:01:11 +00:00
data() {
2023-09-19 11:02:33 +00:00
return {
2023-09-25 04:00:57 +00:00
messageText: '',
2023-09-23 03:50:34 +00:00
show_1: false,
2023-09-21 06:40:19 +00:00
show: false,
mobileKey: '',
2023-09-19 11:02:33 +00:00
startX: 0,
2023-09-21 04:01:11 +00:00
windowWidth: 0,
page: 1,
2023-09-25 04:00:57 +00:00
elementBottom: '',
2023-09-23 03:50:34 +00:00
item: null,
2023-09-22 07:49:19 +00:00
artworkStatus: 0,
2023-09-21 04:01:11 +00:00
pageSize: 999,
mainList: [],
2023-09-23 03:50:34 +00:00
statusValue: [{label: '全部状态', value: 0}, {label: '待入库', value: 1}, {
2023-09-21 06:40:19 +00:00
label: '已入库',
value: 2
2023-09-23 03:50:34 +00:00
}, {label: '即将到期', value: 3}, {label: '已延期', value: 4}, {label: '已取出', value: 5}]
2023-09-19 11:02:33 +00:00
}
},
2023-09-19 08:42:19 +00:00
components: {UImage, tabbar},
2023-09-21 04:01:11 +00:00
mounted() {
2023-09-21 06:15:35 +00:00
this.getData()
2023-09-19 11:02:33 +00:00
uni.getSystemInfo({
2023-09-21 04:01:11 +00:00
success: (res) => {
this.windowWidth = res.windowWidth
2023-09-19 11:02:33 +00:00
}
})
2023-09-23 06:38:30 +00:00
this.getDistanceFromTopToPageBottom('.content3')
},
2023-09-25 04:00:57 +00:00
computed: {},
2023-09-21 04:01:11 +00:00
methods: {
2023-09-25 04:00:57 +00:00
popForward() {
2023-09-25 07:15:58 +00:00
2023-09-25 04:00:57 +00:00
if (this.messageText === '确认补款吗') {
this.supplementaryPayment()
} else if (this.messageText === '确认删除吗') {
this.deleteClick()
}
},
2023-09-25 07:15:58 +00:00
openShow2(item) {
this.item = item
2023-09-25 04:00:57 +00:00
this.messageText = `确认补款吗`
this.$refs.alertDialog.open()
},
2023-09-25 07:15:58 +00:00
async supplementaryPayment() {
2023-09-25 04:00:57 +00:00
const data = {
2023-09-25 07:15:58 +00:00
ID: this.item.ID
}
const res = await postDataByParams('/api/warehouse/supply/paid', data)
if (res.code===200){
uni.showToast({
title: '补款成功',
icon: 'none'
})
}else {
uni.showToast({
title: res.msg,
icon: 'none'
})
2023-09-25 04:00:57 +00:00
}
},
2023-09-23 06:38:30 +00:00
async getDistanceFromTopToPageBottom(classValue) {
2023-09-25 04:00:57 +00:00
const {windowHeight, windowWidth} = await uni.getSystemInfo();
const [{top}] = await new Promise(resolve => uni.createSelectorQuery().select(classValue).boundingClientRect().exec(resolve));
2023-09-23 06:38:30 +00:00
this.elementBottom = ((windowHeight - top) / windowWidth) * 750 - 175;
},
2023-09-23 03:50:34 +00:00
openDelete(item) {
2023-09-25 04:00:57 +00:00
this.messageText = `确认删除吗`
this.$refs.alertDialog.open()
2023-09-23 03:50:34 +00:00
this.item = item
},
async deleteClick() {
this.show_1 = false
const data = {
ID: this.item.ID
}
const res = await postDataByParams('/api/warehouse/remove', data)
if (res.code === 200) {
this.getData()
uni.showToast({
title: '删除成功',
icon: 'none'
})
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
},
goRouter(item) {
uni.navigateTo({
url: `/pages/order-goods/order-details?ID=${item.ID}`
})
2023-09-22 05:24:04 +00:00
},
2023-09-21 06:40:19 +00:00
search() {
this.getData()
},
statusSelect(data) {
2023-09-22 07:49:19 +00:00
this.artworkStatus = data.value
2023-09-21 06:40:19 +00:00
this.getData()
2023-09-21 06:15:35 +00:00
},
2023-09-21 06:40:19 +00:00
openStatus() {
this.show = true
},
loadMore() {
2023-09-21 06:15:35 +00:00
console.log('loadMore')
},
2023-09-21 04:01:11 +00:00
async getData() {
const data = {
page: this.page, //分页
pageSize: this.pageSize, //每页数据量
2023-09-23 03:50:34 +00:00
status: this.artworkStatus, //状态(1-待入库 2-已入库 3-即将到期 4-已延期 5-已取出)
2023-09-21 04:01:11 +00:00
mobileKey: this.mobileKey
}
const res = await postDataByParams('/api/warehouse/list', data)
if (res.code === 200) {
this.mainList = res.data.data
2023-09-21 06:40:19 +00:00
this.mainList?.forEach((x) => {
2023-09-21 04:01:11 +00:00
this.$set(x, 'distanceX', 0)
this.$set(x, 'isRight', false)
})
2023-09-23 03:50:34 +00:00
} else {
2023-09-22 05:24:04 +00:00
uni.showToast({
title: res.msg,
2023-09-23 03:50:34 +00:00
icon: 'none'
2023-09-22 05:24:04 +00:00
})
2023-09-21 04:01:11 +00:00
}
},
touchMove(e, index) {
this.mainList[index].distanceX = e.touches[0].clientX - this.startX;
2023-09-19 08:42:19 +00:00
},
2023-09-21 04:01:11 +00:00
touchStart(e, index) {
this.mainList[index].isRight = true
2023-09-19 11:02:33 +00:00
this.startX = e.touches[0].clientX;
2023-09-19 08:42:19 +00:00
},
2023-09-21 04:01:11 +00:00
touchEnd(index) {
if (this.mainList[index].distanceX < -((144 / 750) * this.windowWidth)) {
this.mainList[index].distanceX = -((144 / 750) * this.windowWidth);
2023-09-19 11:02:33 +00:00
} else {
2023-09-21 04:01:11 +00:00
this.mainList[index].isRight = false
this.mainList[index].distanceX = 0;
2023-09-19 11:02:33 +00:00
}
2023-09-19 08:42:19 +00:00
}
}
2023-09-19 02:50:09 +00:00
}
</script>
<style scoped lang="scss">
2023-09-19 07:48:24 +00:00
.order-goods {
2023-09-21 04:01:11 +00:00
overflow: hidden;
2023-09-19 07:48:24 +00:00
box-sizing: border-box;
2023-09-25 12:59:40 +00:00
background-image: url("https://cdns.fontree.cn/fonchain-main/prod/image/default/artwork/4fdc9a0f-d72a-46b6-a04d-ed56d5465213.png");
2023-09-19 07:48:24 +00:00
padding-left: 30rpx;
padding-right: 30rpx;
background-size: cover;
width: 100vw;
height: 100vh;
2023-09-21 04:01:11 +00:00
.content3 {
2023-09-25 04:00:57 +00:00
margin-top: 20rpx;
2023-09-21 04:01:11 +00:00
2023-09-23 06:38:30 +00:00
margin-bottom: 300rpx;
2023-09-21 06:40:19 +00:00
2023-09-21 04:01:11 +00:00
.wrap1 {
margin-bottom: 20rpx;
2023-09-19 11:02:33 +00:00
position: relative;
2023-09-19 07:48:24 +00:00
padding-left: 20rpx;
border-radius: 20rpx;
background-color: #fff;
height: 228rpx;
display: flex;
align-items: center;
2023-09-21 06:40:19 +00:00
2023-09-21 04:01:11 +00:00
.wrap1_4 {
2023-09-19 11:02:33 +00:00
display: flex;
justify-content: center;
align-items: center;
height: 228rpx;
width: 154rpx;
background-color: #B7C0C8;
right: -144rpx;
position: absolute;
z-index: -1;
}
2023-09-21 04:01:11 +00:00
.wrap1_3 {
2023-09-19 11:02:33 +00:00
border-top-right-radius: 20rpx;
border-bottom-right-radius: 20rpx;
2023-09-19 07:48:24 +00:00
display: flex;
margin-left: auto;
2023-09-21 04:01:11 +00:00
2023-09-19 07:48:24 +00:00
position: relative;
width: 144rpx;
height: 228rpx;
2023-09-23 03:50:34 +00:00
&.status5 {
2023-09-22 08:16:11 +00:00
background: #939393;
2023-09-23 03:50:34 +00:00
2023-09-22 08:16:11 +00:00
.wrap1_3_3_1 {
color: #939393;
}
}
2023-09-23 03:50:34 +00:00
2023-09-21 06:40:19 +00:00
&.status1 {
2023-09-21 04:01:11 +00:00
background: #FFBA00;
2023-09-21 06:40:19 +00:00
.wrap1_3_3_1 {
2023-09-21 04:01:11 +00:00
color: #FFBA00;
}
}
2023-09-21 06:40:19 +00:00
&.status2 {
2023-09-21 04:01:11 +00:00
background: #76C458;
2023-09-21 06:40:19 +00:00
.wrap1_3_3_1 {
2023-09-21 04:01:11 +00:00
color: #76C458;
}
}
2023-09-21 06:40:19 +00:00
&.status3 {
2023-09-21 04:01:11 +00:00
background: #76C458;
2023-09-21 06:40:19 +00:00
.wrap1_3_3_1 {
color: #FF4848;
}
}
2023-09-23 03:50:34 +00:00
2023-09-21 06:40:19 +00:00
&.status4 {
background: #FF4848;
.wrap1_3_3_1 {
2023-09-21 04:01:11 +00:00
color: #FF4848;
}
}
2023-09-21 06:40:19 +00:00
2023-09-21 04:01:11 +00:00
.wrap1_3_2 {
2023-09-19 08:42:19 +00:00
display: flex;
flex-direction: column;
2023-09-21 04:01:11 +00:00
left: 20rpx;
2023-09-19 08:42:19 +00:00
position: absolute;
2023-09-21 04:01:11 +00:00
bottom: 60rpx;
.wrap1_3_2_1 {
color: #fff;
font-size: 16rpx;
}
.wrap1_3_2_2 {
2023-09-19 08:42:19 +00:00
color: #fff;
font-size: 24rpx;
}
}
2023-09-21 06:40:19 +00:00
.wrap1_3_3 {
padding-top: 18rpx;
2023-09-21 04:01:11 +00:00
padding-bottom: 18rpx;
display: flex;
flex-direction: column;
align-items: center;
border-top-right-radius: 15rpx;
left: 4rpx;
top: 4rpx;
width: 136rpx;
background-color: #fff;
position: absolute;
2023-09-21 06:40:19 +00:00
.wrap1_3_3_1 {
2023-09-21 04:01:11 +00:00
text-align: center;
font-size: 28rpx;
}
}
2023-09-21 06:40:19 +00:00
2023-09-21 04:01:11 +00:00
.wrap1_3_1 {
2023-09-19 08:42:19 +00:00
2023-09-19 07:48:24 +00:00
padding-bottom: 6rpx;
display: flex;
flex-direction: column;
align-items: center;
2023-09-21 04:01:11 +00:00
border-top-right-radius: 15rpx;
2023-09-19 07:48:24 +00:00
left: 4rpx;
top: 4rpx;
width: 136rpx;
background-color: #fff;
position: absolute;
2023-09-21 04:01:11 +00:00
.wrap1_3_1_1 {
2023-09-19 07:48:24 +00:00
font-size: 16rpx;
color: #FF4848;
}
2023-09-21 04:01:11 +00:00
.wrap1_3_1_2 {
2023-09-19 07:48:24 +00:00
font-size: 24rpx;
color: #FF4848;
}
2023-09-21 04:01:11 +00:00
.wrap1_3_1_3 {
2023-09-19 07:48:24 +00:00
display: flex;
align-items: center;
justify-content: center;
border-radius: 8rpx;
color: #fff;
font-size: 16rpx;
2023-09-21 04:01:11 +00:00
width: 110rpx;
height: 34rpx;
background-color: #000;
2023-09-19 07:48:24 +00:00
}
}
}
2023-09-21 04:01:11 +00:00
.wrap1_2 {
2023-09-19 07:48:24 +00:00
margin-left: 14rpx;
display: flex;
flex-direction: column;
align-items: start;
2023-09-21 04:01:11 +00:00
.wrap1_2_1 {
margin-bottom: 12rpx;
2023-09-19 07:48:24 +00:00
color: #000;
font-size: 28rpx;
}
2023-09-21 04:01:11 +00:00
.wrap1_2_2 {
2023-09-19 07:48:24 +00:00
margin-bottom: 12rpx;
color: #808080;
font-size: 24rpx;
}
2023-09-21 04:01:11 +00:00
.wrap1_2_3 {
2023-09-19 07:48:24 +00:00
margin-bottom: 12rpx;
color: #808080;
font-size: 24rpx;
}
2023-09-21 04:01:11 +00:00
.wrap1_2_4 {
2023-09-19 07:48:24 +00:00
color: #FF4848;
font-size: 24rpx;
}
}
2023-09-21 04:01:11 +00:00
.wrap1_1 {
image {
2023-09-19 07:48:24 +00:00
width: 188rpx;
height: 188rpx;
}
}
}
}
2023-09-21 04:01:11 +00:00
.content2 {
margin-top: 26rpx;
2023-09-19 07:48:24 +00:00
display: flex;
2023-09-21 04:01:11 +00:00
justify-content: space-between;
2023-09-19 07:48:24 +00:00
2023-09-21 04:01:11 +00:00
.wrap2 {
display: flex;
justify-content: center;
align-items: center;
border-radius: 20rpx;
color: #fff;
font-size: 20rpx;
width: 94rpx;
height: 52rpx;
background-color: #4E964D;
2023-09-19 07:48:24 +00:00
}
2023-09-21 04:01:11 +00:00
.wrap1 {
align-items: center;
display: flex;
border-radius: 20rpx;
background-color: rgba(0, 0, 0, 0.5);
width: 586rpx;
height: 52rpx;
.wrap1_2 {
margin-left: 20rpx;
margin-right: 20rpx;
width: 1rpx;
height: 30rpx;
background-color: #fff;
}
input {
}
.wrap1_1 {
margin-left: 26rpx;
image {
width: 28rpx;
height: 28rpx;
}
2023-09-19 07:48:24 +00:00
}
}
}
2023-09-21 04:01:11 +00:00
2023-09-19 07:48:24 +00:00
.content1 {
display: flex;
justify-content: space-between;
2023-09-21 04:01:11 +00:00
.wrap3 {
font-size: 24rpx;
color: #fff;
width: 132rpx;
height: 52rpx;
background-color: #76C458;
display: flex;
justify-content: center;
align-items: center;
border-radius: 20rpx;
}
2023-09-19 07:48:24 +00:00
.wrap2 {
display: flex;
flex-direction: column;
align-items: center;
2023-09-21 04:01:11 +00:00
2023-09-19 07:48:24 +00:00
.wrap2_1 {
color: #4E964D;
font-size: 32rpx;
}
2023-09-21 04:01:11 +00:00
2023-09-19 07:48:24 +00:00
.wrap2_2 {
2023-09-21 04:01:11 +00:00
color: #7C9F6F;
2023-09-19 07:48:24 +00:00
font-size: 16rpx;
}
}
.wrap1 {
.wrap1_1 {
justify-content: center;
border-radius: 20rpx;
width: 156rpx;
height: 52rpx;
background-color: #4E964D;
color: #fff;
font-size: 24rpx;
display: flex;
align-items: center;
}
}
}
}
2023-09-19 02:50:09 +00:00
</style>