flying-monkey/pagesA/mountingsList/mountingsList.vue

344 lines
9.8 KiB
Vue
Raw Normal View History

2022-03-22 03:38:06 +00:00
<template>
<view class="content">
2022-03-28 07:33:10 +00:00
<statusNav returnColor="#c2c2c2" navBarTitle="配件列表"></statusNav>
2022-03-28 03:19:05 +00:00
<container-subgroup-two>
2022-04-01 10:16:43 +00:00
<view slot="content" style="margin: -26rpx -25rpx 0rpx" :style="{paddingTop:statusBarHeight + 'px'}">
<view class="mountingsList-input" :style="{top:statusBarHeight + 'px'}">
2022-04-01 10:16:43 +00:00
<input type="text" class="int fon24" value="" placeholder="请输入关键字" />
<image class="search" src="../../static/iocn/ss.png" mode="" lazy-load></image>
<view class="xian"></view>
</view>
<view class="mountings-list">
<view class="li radius10 animated fadeIn" v-for="(item,index) in dataList.data" :key="index">
2022-04-01 10:16:43 +00:00
<view class="textCon" style="padding: 0rpx 16rpx;">
<view class="imgCon">
<image :src="item.images" class="img radius10" mode="aspectFill" lazy-load></image>
2022-04-01 10:16:43 +00:00
<!-- <image src="/static/del/img001.png" class="img radius10" mode="aspectFill"></image> -->
</view>
2022-04-01 10:16:43 +00:00
<view class="text" style="104rpx">
<view class="title disjbac posir">
<view class="clips1 mar-y40 bold fon24">{{item.name}}</view>
<view class="ispitchOn" @click="ispitchOnFun(item)" style="position: absolute;right: 0;">
<image v-if="item.isJob" src="../../static/iocn/pxz.png" class="icon1" mode="" lazy-load></image>
<view v-else class="icon"></view>
</view>
</view>
2022-04-01 10:16:43 +00:00
<view class="brand p scal09" style="margin-left: -20rpx;">配件品牌{{item.brand}}</view>
<view class="model p scal09" style="margin-left: -20rpx;">规格型号{{item.model}}</view>
<view class="num p">
2022-04-01 10:16:43 +00:00
<view class="scal09" style="margin-left: -8rpx;">已用数量{{item.remark || 0}}</view>
<view class="numBtn">
<view class="subtract" @click="addDelEv(item,0)">-</view>
<view class="sum">{{item.num}}</view>
<view class="add" @click="addDelEv(item,1)">+</view>
</view>
</view>
</view>
</view>
2022-04-01 10:16:43 +00:00
<view class="bottom line-h40">
<view class="p scal09 width100" style="margin-left: -20rpx;">*请注意规格型号的选择不同型号不同价格</view>
<view class="sum fon24 bold flexs">费用合计¥{{item.sum}}</view>
</view>
2022-04-01 10:16:43 +00:00
</view>
<pitera v-if="dataList.data.length" textStr="暂无更多配件列表数据"></pitera>
<nothing-page v-if="dataList.data.length==0 && !ifLoading"></nothing-page>
</view>
<button v-show="dbtn" class="submit-button" @tap="submitEv" type="default"></button>
2022-03-25 03:41:31 +00:00
</view>
</container-subgroup-two>
2022-03-22 03:38:06 +00:00
</view>
</template>
<script>
import statusNav from '../../components/status-nav.vue';
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
import pitera from '@/components/nothing/pitera.vue';
2022-03-22 03:38:06 +00:00
export default {
components: {
statusNav,
containerSubgroupTwo,
pitera
2022-03-22 03:38:06 +00:00
},
data() {
return {
statusBarHeight:uni.getSystemInfoSync().statusBarHeight+40,
dataList: {
list_rows: 10,
page: 1,
data:[],
},
total:0,
temporaryList:[] ,// 暂时存储选中的配件列表
ifLoading:true,
dbtn:false
2022-03-22 03:38:06 +00:00
}
},
onReachBottom() {
if(this.total!=this.dataList.data.length) {
this.dataList.page++;
this.getData();
}
},
2022-03-30 10:04:40 +00:00
onLoad() {
// 调用获取配件列表事件
2022-03-30 10:04:40 +00:00
this.getData()
},
2022-03-22 03:38:06 +00:00
methods: {
// 切换选取配件事件
2022-03-22 03:38:06 +00:00
ispitchOnFun(item) {
item.isJob = !item.isJob;
// 调用暂存配件列表事件
this.temporaryEv();
2022-03-22 03:38:06 +00:00
},
// 将选中的配件存储到暂存配件数组
temporaryEv(){
this.temporaryList = [];
this.dataList.data.forEach(item=>{
if(item.isJob) {
this.temporaryList.push(item);
}
})
uni.setStorageSync('partsList',this.temporaryList);
this.temporaryList.length ? this.dbtn = true : this.dbtn = false;
},
// 配件数量加减事件
addDelEv(item,index) {
if (index==0) {
// 减数量
if(item.num!=1) {
item.num--;
item.sum = this.$toolAll.tools.operationEv(item.price*1, item.num*1, '*',2);
}
} else {
// 加数量
item.num++;
item.sum = this.$toolAll.tools.operationEv(item.price*1, item.num*1, '*',2);
}
// 调用暂存配件列表事件
this.temporaryEv();
2022-03-22 03:38:06 +00:00
},
// 获取配件列表事件
2022-03-30 10:04:40 +00:00
getData() {
uni.showLoading({
title:'加载中...',
mask:true
})
this.$requst.get('/universal/api.accessory/accessory_list', {
2022-03-30 10:04:40 +00:00
list_rows: this.dataList.list_rows,
page: this.dataList.page,
}).then(res => {
if (res.code == 1) {
this.dataList.data = res.data.data;
this.total = res.data.total;
console.log(res,'配件数据')
2022-03-30 10:04:40 +00:00
for (var i = 0; i < this.dataList.data.length; i++) {
this.$set(this.dataList.data,i,{num:1,...this.dataList.data[i],sum:this.dataList.data[i].price,isJob:false})
2022-03-30 10:04:40 +00:00
}
// 获取处理工单下的配件列表
let newList = uni.getStorageSync('partsList');
// 如果配件列表页面的列表数据不为空
if(this.dataList.data.length) {
this.dataList.data.forEach(item1=>{
// 如果处理工单下的配件列表不为空
if(newList.length!=0) {
newList.forEach((item,index)=>{
// 如果配件列表页面的配件id等于处理工单下的配件列表的配件id
if(item1.id==item.id) {
// 选中配件列表页面下的对应配件
item1.isJob = true;
// 设置配件列表页面下的配件数量
item1.num = item.num;
// 设置配件列表页面下的费用合计
item1.sum = item.sum;
// 删除临时处理工单下的配件列表对应数据
newList.splice(index,1)
}
})
// 调用暂存配件列表事件
this.temporaryEv();
}
})
}
2022-03-30 10:04:40 +00:00
}
uni.hideLoading();
this.ifLoading = false;
2022-03-30 10:04:40 +00:00
})
},
// 确认提交事件
submitEv(){
console.log(uni.getStorageSync('partsList'),146);
uni.navigateBack({delta:1})
}
2022-03-22 03:38:06 +00:00
}
}
</script>
<style>
.content {
2022-03-24 09:04:24 +00:00
padding-top: 70rpx;
2022-03-22 03:38:06 +00:00
}
2022-03-25 03:41:31 +00:00
.mountingsList-input .xian {
width: 3rpx;
height: 35rpx;
2022-03-28 03:19:05 +00:00
z-index: 100;
2022-03-25 03:41:31 +00:00
position: absolute;
background-color: #EAEAEA;
right: 100rpx;
top: 50%;
margin-top: -14rpx;
}
2022-03-22 03:38:06 +00:00
.submit-button {
position: fixed;
bottom: 20rpx;
left: 50%;
transform: translateX(-50%);
2022-03-22 03:38:06 +00:00
width: 686rpx;
border-radius: 50rpx;
margin-top: 60rpx;
2022-03-22 03:38:06 +00:00
height: 90rpx;
background-color: #02A2ea;
line-height: 90rpx;
color: #FFFFFF;
text-align: center;
font-size: 30rpx;
}
.mountingsList-input {
width: 100%;
2022-03-28 03:19:05 +00:00
position: fixed;
2022-03-22 03:38:06 +00:00
padding: 40rpx 16rpx;
2022-03-28 03:19:05 +00:00
z-index: 2;
2022-03-22 03:38:06 +00:00
box-sizing: border-box;
background-color: #FFFFFF
}
.mountingsList-input .int {
width: 100%;
background-color: #F7F7F7;
padding: 0 25rpx;
height: 67rpx;
box-sizing: border-box;
border-radius: 36rpx;
}
.mountingsList-input .search {
width: 28rpx;
height: 28rpx;
position: absolute;
right: 43rpx;
top: 50%;
margin-top: -14rpx;
}
.mountings-list .li {
width: 680rpx;
margin: auto;
margin-top: 20rpx;
background-color: #FFFFFF;
padding: 30rpx 20rpx 0rpx;
}
.mountings-list .li .textCon {
display: flex;
border-bottom: 2rpx solid #F5F5F5;
}
.mountings-list .li .imgCon {
width: 217rpx;
2022-04-01 10:16:43 +00:00
height: 140rpx;
2022-03-22 03:38:06 +00:00
background-color: #CCCCCC;
border-radius: 5rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 18rpx;
2022-04-01 10:16:43 +00:00
padding: 20rpx;
box-sizing: border-box;
2022-03-22 03:38:06 +00:00
}
.mountings-list .li .text {
flex: 1;
}
.mountings-list .li .imgCon .img {
width: 169rpx;
height: 104rpx;
2022-03-28 03:19:05 +00:00
position: relative;
z-index: 1;
2022-03-22 03:38:06 +00:00
}
.mountings-list .li .title .ispitchOn .icon {
width: 26rpx;
height: 26rpx;
border: 2rpx solid #CCCCCC;
box-sizing: border-box;
border-radius: 50%;
}
.mountings-list .li .title .ispitchOn .icon1 {
width: 26rpx;
height: 26rpx;
border-radius: 50%;
}
.mountings-list .li .text .p {
color: #999999;
font-size: 24rpx;
2022-03-25 03:41:31 +00:00
margin-top: 5rpx;
2022-03-22 03:38:06 +00:00
}
.mountings-list .li .text .num {
display: flex;
justify-content: space-between;
}
.mountings-list .li .text {
2022-04-01 10:16:43 +00:00
padding-bottom: 20rpx;
2022-03-22 03:38:06 +00:00
}
.numBtn {
display: flex;
2022-03-25 03:56:30 +00:00
align-items: center;
2022-03-22 03:38:06 +00:00
}
.numBtn .subtract {
border: 2rpx solid #F5F5F5;
width: 36rpx;
height: 36rpx;
border-radius: 50%;
text-align: center;
2022-03-25 03:56:30 +00:00
line-height: 25rpx;
color: #333333;
font-size: 50rpx
2022-03-22 03:38:06 +00:00
}
.numBtn .sum {
color: #333333;
padding: 0 15rpx;
}
.numBtn .add {
width: 36rpx;
height: 36rpx;
border-radius: 50%;
text-align: center;
line-height: 35rpx;
font-size: 35rpx;
background-color: #f82a34;
color: #FFFFFF;
}
.mountings-list .li .bottom {
padding: 14rpx;
display: flex;
justify-content: space-between;
font-size: 24rpx;
}
.mountings-list .li .bottom .sum {
color: #ff0000;
}
</style>