Browse Source

新增库存逻辑和下单推款等相同的逻辑

master
tianyi@bogon 3 years ago
parent
commit
5114402bbc
  1. 311
      pages/billing/changeGoods1.vue
  2. 6
      pages/index/addHangOrder.vue
  3. 526
      pages/index/downStearmList.vue
  4. 88
      pages/inventory/addinventory.vue
  5. 772
      pages/inventory/changeGoods1.vue

311
pages/billing/changeGoods1.vue

@ -65,15 +65,18 @@
<view class="popup-title-right"> <view class="popup-title-right">
<view class="popup-title-right-box" style="color: #088FEB;">{{goodsDetail.productName}} <view class="popup-title-right-box" style="color: #088FEB;">{{goodsDetail.productName}}
</view> </view>
<view class="popup-title-right-box">{{goodsDetail.barcode}}</view> <view class="popup-title-right-box">{{goodsDetail.productSn}}</view>
<view class="popup-title-right-box" style="color: darkorange;" @tap="inputDialogToggle"> <view class="popup-title-right-box" style="color: darkorange;" @tap="inputDialogToggle">
<text style="margin-right:20rpx;">¥{{goodsDetail.price}}</text> <text style="margin-right:20rpx;">修改价格</text>
<text style="color:blue;">临时改价</text>
</view> </view>
</view> </view>
</view> </view>
<view class="popup-container"> <view class="popup-container">
<ul> <view class="purchase-price" v-if="storageType == 0">
<view style="margin-right: 20rpx;">实际价格</view>
<uni-easyinput type="text" v-model="purchasePrice" placeholder="请输入实际价格" />
</view>
<ul style="border-top:20rpx;">
<li v-for="(items,index) in goodsDetail.attributeList" :key="index"> <li v-for="(items,index) in goodsDetail.attributeList" :key="index">
<view class="title-fur"> <view class="title-fur">
<view class="name">{{items.name}}</view> <view class="name">{{items.name}}</view>
@ -91,13 +94,13 @@
<view class="checkList-box"> <view class="checkList-box">
{{item.name}} {{item.name}}
</view> </view>
<uni-number-box :value="item.temporaryNum" @change="temporaryChange" /> <uni-number-box v-model="item.productCount" @change="temporaryChange" />
</view> </view>
</view> </view>
<view class="popup-bottom" v-for="item in temporaryList"> <view class="popup-bottom" v-for="item in temporaryList">
<view class="popup-bottom-left"> <view class="popup-bottom-left">
<text>{{item.num}} 件</text> <text>{{zNum}} 件</text>
<text>¥{{item.num * item.price}}</text> <text>¥{{zPrice}}</text>
</view> </view>
<view class="popup-bottom-right"> <view class="popup-bottom-right">
<view class="bottom-btn" @tap="temporaryCheck">选好了</view> <view class="bottom-btn" @tap="temporaryCheck">选好了</view>
@ -106,17 +109,24 @@
</view> </view>
</uni-popup> </uni-popup>
</view> </view>
<!-- 弹出输入框 --> <!-- 弹出输入框 -->
<uni-popup ref="inputDialog" type="dialog"> <uni-popup ref="inputDialog" background-color="#fff" @change="change">
<uni-popup-dialog ref="inputClose" mode="input" title="临时改价" placeholder="请输入临时售价" <view class="popup-pay-content">
@confirm="changePrice"></uni-popup-dialog> <view class="popup-pay-title">
<text>选择商品价格</text>
</view>
<view class="popup-pay-container">
<text style="display: inline-block">零售价:¥29.99</text>
</view>
<view class="popup-pay-container">
<text style="display: inline-block">批发价:¥25.99</text>
</view>
</view>
</uni-popup> </uni-popup>
<!-- 购物车弹出层 --> <!-- 购物车弹出层 -->
<uni-popup ref="carPopup" background-color="#fff" @change="change"> <uni-popup ref="carPopup" background-color="#fff" @change="change">
<view class="popup-content"> <view class="popup-content">
<view v-for="item in carList"> <view v-for="item in carList" style="position: relative;">
<view class="popup-title"> <view class="popup-title">
<view class="popup-title-left"> <view class="popup-title-left">
<img src="/static/images/logo.png" alt=""> <img src="/static/images/logo.png" alt="">
@ -126,25 +136,23 @@
<view class="popup-title-right-box">{{item.productSn}}</view> <view class="popup-title-right-box">{{item.productSn}}</view>
<view class="popup-title-right-box" style="color: darkorange;" @tap="inputDialogToggle"> <view class="popup-title-right-box" style="color: darkorange;" @tap="inputDialogToggle">
<text style="margin-right:20rpx;">¥{{item.price}}</text> <text style="margin-right:20rpx;">¥{{item.price}}</text>
<uni-icons color="#088FEB" type="compose" size="16"></uni-icons> <!-- <uni-icons color="#088FEB" type="compose" size="16"></uni-icons> -->
<view style="position: absolute;top: 30rpx;right: 30rpx;"> <view style="position: absolute;top: 30rpx;right: 30rpx;" @tap.stop="delShop(item.id)">
<uni-icons color="red" type="trash" size="26"></uni-icons> <uni-icons color="red" type="trash" size="26"></uni-icons>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="popup-container"> <view class="popup-container" v-for="items in item.saleDetailQueryDTO">
<view class="checkList"> <view class="checkList">
<view style="margin-right:5%;"> <view style="margin-right:5%;" @tap="delShopSpec(items.name)">
<uni-icons color="red" type="minus" size="26"></uni-icons> <uni-icons color="red" type="minus" size="26"></uni-icons>
</view> </view>
<view class="checkList-box"> <view class="checkList-box">
<text>女装</text> {{items.name}}
<text>S码</text>
<text>黄色</text>
</view> </view>
<uni-number-box :value="numberValue" @change="change" /> <uni-number-box v-model="items.productCount" @change="change" />
</view> </view>
</view> </view>
</view> </view>
@ -157,7 +165,6 @@
<view class="bottom-btn" @tap="">选好了</view> <view class="bottom-btn" @tap="">选好了</view>
</view> </view>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
</view> </view>
@ -180,16 +187,21 @@
goodsDetail: [], goodsDetail: [],
attrNameList: [], attrNameList: [],
temporaryList: [], temporaryList: [],
carList: [], carList: [],
columns: [], columns: [],
keyList: [], keyList: [],
specsList:[], specsList: [],
evalue:[], evalue: [],
attributeList:[] attributeList: [],
purchasePrice: 0,
zPrice:0,
zNum:0,
storageType:0
} }
}, },
onLoad() { onLoad() {
this.getGategoryList() this.getGategoryList()
this.storageType = uni.getStorageSync('type')
}, },
methods: { methods: {
//初始化获取分类列表 //初始化获取分类列表
@ -207,8 +219,8 @@
} }
} }
this.getShareList(this.indexList[0].id); this.getShareList(this.indexList[0].id);
} else { } else {
this.tui.toast(res.message) this.tui.toast(res.message)
} }
}).catch((res) => {}) }).catch((res) => {})
}, },
@ -218,53 +230,71 @@
}) })
this.goodsDetail.attributeList[index].isChecked = true; this.goodsDetail.attributeList[index].isChecked = true;
this.goodsDetail.attributeList[index].value[index1].isChecked = true; this.goodsDetail.attributeList[index].value[index1].isChecked = true;
console.log(this.goodsDetail) var name = '',
var name = '', evalue = [],
evalue = [] obj = {},
specsList = []
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) { for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
for (var m = 0, Ien = this.goodsDetail.attributeList[i].value; m < Ien.length; m++) { for (var m = 0, Ien = this.goodsDetail.attributeList[i].value; m < Ien.length; m++) {
console.log(Ien[m])
if (Ien[m].isChecked == true) { if (Ien[m].isChecked == true) {
evalue.push(Ien[m].value) evalue.push(Ien[m].value)
name += Ien[m].value name += Ien[m].value
} }
} }
} }
this.evalue = evalue; this.keyList.map((item, index) => {
this.temporaryList = [{ obj[item] = evalue[index]
id: this.goodsDetail.id, })
barcode: this.goodsDetail.barcode, let jishuqi = 0;
price: this.goodsDetail.price, for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
name: name, if (this.goodsDetail.attributeList[i].isChecked == true) {
num: this.temporaryNum, jishuqi++
productName: this.goodsDetail.productName, }
productSn: this.goodsDetail.productSn, }
productPicture:this.goodsDetail.productPicture, if (this.goodsDetail.attributeList.length == jishuqi) {
supplierName:this.goodsDetail.supplierName let data = {}
}] this.attributeList = {
attributeList: JSON.stringify(obj),
productCount: this.temporaryNum,
name:name,
price:this.purchasePrice
}
if (this.temporaryList.length == 0) {
this.temporaryList.push(this.attributeList);
} else {
for (var i = 0; i < this.temporaryList.length; i++) {
if (this.temporaryList[i].name.indexOf(this.attributeList.name) != -1) {
this.temporaryList[i] = this.attributeList
return
} else {
if (this.temporaryList.length == (i+1)) {
this.temporaryList.push(this.attributeList);
return
}
}
}
}
}
}, },
temporaryChange(val) { temporaryChange(val) {
console.log(val) console.log(val)
this.temporaryList[0].num = val this.zNum = 0
console.log(this.temporaryList)
}, for (var i=0;i<this.temporaryList.length;i++) {
//点击底部选好了,返回上一页 this.zNum += this.temporaryList[i].productCount
backPrevPage(){
this.specsList.map((item, index) => {
this.attributeList[index] = {
attributeList: JSON.stringify(item),
productCount: this.carList[index].num
}
})
for (var i=0;i<this.carList.length;i++) {
this.carList[i].saleDetailQueryDTO = this.attributeList[i]
} }
let pages = getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。 this.zPrice = this.zNum * this.purchasePrice
let prevPage = pages[pages.length - 2]; //上一页页面实例 },
prevPage.$vm.carList = this.carList //点击底部选好了,返回上一页
uni.navigateBack({ backPrevPage() {
delta: 1 let pages = getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
}) let prevPage = pages[pages.length - 2]; //上一页页面实例
prevPage.$vm.carList = this.carList
uni.navigateBack({
delta: 1
})
}, },
//点击分类获取商品列表 //点击分类获取商品列表
getShareList(id) { getShareList(id) {
@ -277,8 +307,8 @@
if (res.code == 200) { if (res.code == 200) {
console.log(res.result.records) console.log(res.result.records)
this.shopList = res.result.records this.shopList = res.result.records
} else { } else {
this.tui.toast(res.message) this.tui.toast(res.message)
} }
}).catch((res) => {}) }).catch((res) => {})
}, },
@ -292,7 +322,8 @@
this.type = type this.type = type
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性 // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
if (type == 'carPopup') { if (type == 'carPopup') {
this.$refs.carPopup.open('bottom') this.$refs.carPopup.open('bottom')
} else { } else {
this.checkGoods(item); this.checkGoods(item);
this.$refs.popup.open('bottom') this.$refs.popup.open('bottom')
@ -323,10 +354,10 @@
value: valueObj value: valueObj
}) })
} }
this.goodsDetail.attributeList = newArr; this.goodsDetail.attributeList = newArr;
this.goodsDetail.attributeList.forEach((item, index) => { this.goodsDetail.attributeList.forEach((item, index) => {
this.columns[index] = item.value; this.columns[index] = item.value;
this.keyList[index] = item.name; this.keyList[index] = item.name;
}) })
} }
@ -358,26 +389,74 @@
this.goodsDetail.price = this.temporaryList[0].price = val this.goodsDetail.price = this.temporaryList[0].price = val
}, },
//弹窗选择规格后,点击弹窗中选好了按钮 //弹窗选择规格后,点击弹窗中选好了按钮
temporaryCheck() { temporaryCheck() {
this.carList.push(this.temporaryList[0]); if(this.storageType == 0 && this.purchasePrice == 0){
this.$refs.popup.close() uni.showToast({
var obj = {}; title: "请输入采购价!",
this.keyList.map((item, index) => { icon: 'none'
obj[item] = this.evalue[index] })
}) }else{
this.specsList.push(obj); let data = {
console.log(this.specsList); id: this.goodsDetail.id,
// this.specsList.map((item, index) => { price: this.zPrice,
// this.attributeList[index] = { num: this.zNum,
// attributeList: JSON.stringify(item), productName: this.goodsDetail.productName,
// productCount: this.numList[index] productSn: this.goodsDetail.productSn,
// } productPicture: this.goodsDetail.productPicture,
// }) supplierName: this.goodsDetail.supplierName,
// for (var i =0;i<this.shopList.length;i++) { saleDetailQueryDTO:this.temporaryList
// if(this.shopList[i].id == this.temporaryList[0].id){ }
// this.shopList[i].temporaryList = this.temporaryList[0] this.carList.push(data)
// } this.temporaryList = []
// } this.purchasePrice = ''
this.zPrice = ''
this.zNum = ''
for(let i=0;i<this.goodsDetail.attributeList.length;i++){
this.goodsDetail.attributeList[i].isChecked = false;
for (let m=0;m<this.goodsDetail.attributeList[i].value.length;m++) {
this.goodsDetail.attributeList[i].value[m].isChecked = false
}
}
this.$refs.popup.close()
}
},
//删除整条商品
delShop(id){
var that = this;
console.log(this.carList)
for (let i=0;i<this.carList.length;i++) {
if(this.carList[i].id == id){
uni.showModal({
title: "提示",
content: "确定删除此条商品吗?",
success: function(res) {
that.carList.splice(i,1)
}
})
}
}
},
//删除商品下的某一个规格
delShopSpec(name){
var that = this;
console.log(this.carList)
for (let i=0;i<this.carList.length;i++) {
for (let m=0;m<this.carList[i].saleDetailQueryDTO.length;m++) {
if(this.carList[i].saleDetailQueryDTO[m].name == name){
uni.showModal({
title: "提示",
content: "确定删除此条商品吗?",
success: function(res) {
that.carList[i].saleDetailQueryDTO.splice(m,1)
if(that.carList[i].saleDetailQueryDTO.length == 0){
that.carList.splice(i,1)
}
}
})
}
}
}
} }
} }
} }
@ -410,8 +489,34 @@
padding: 15px; padding: 15px;
height: 1200rpx; height: 1200rpx;
background-color: #fff; background-color: #fff;
} }
.popup-pay-content{
align-items: center;
justify-content: center;
padding: 15px;
width: 500rpx;
height: auto;
background-color: #fff;
}
.popup-pay-title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
position: relative;
}
.popup-pay-container {
margin-top: 20rpx;
height: 100rpx;
border-radius: 10px;
background: #088FEB;
line-height: 100rpx;
text-align: center;
border-bottom: 1px solid #eee;
border-top: 1px solid #eee;
color: #fff;
}
.popup-title-right-box { .popup-title-right-box {
height: 50rpx; height: 50rpx;
line-height: 50rpx; line-height: 50rpx;
@ -511,6 +616,14 @@
border-bottom: 1px solid #fff; border-bottom: 1px solid #fff;
} }
.purchase-price {
display: flex;
line-height: 40px;
height: 80rpx;
width: 95%;
margin: 20rpx auto;
}
.left-box-hover { .left-box-hover {
width: 100%; width: 100%;
height: 90rpx; height: 90rpx;

6
pages/index/addHangOrder.vue

@ -246,7 +246,7 @@
scanCodeAdd() { scanCodeAdd() {
uni.scanCode({ uni.scanCode({
success: (res) => { success: (res) => {
console.log(typeof(res.result)) console.log(res.result)
this.toggle('bottom', res.result); this.toggle('bottom', res.result);
}, },
@ -304,9 +304,7 @@
}, },
//通过商品id查询商品详细信息 //通过商品id查询商品详细信息
getById(id) { getById(id) {
this.tui.request("/app/product/getById", "POST", { this.tui.request("/app/product/getById/"+id, "POST", {}, false, true).then((res) => {
id: "XD1718301576285786112"
}, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
} else { } else {

526
pages/index/downStearmList.vue

@ -48,105 +48,109 @@
<view class="bottom-btn" @tap="backPrevPage">开单</view> <view class="bottom-btn" @tap="backPrevPage">开单</view>
</view> </view>
</view> </view>
<!-- 弹出层 --> <!-- 弹出层 -->
<view> <view>
<uni-popup ref="popup" background-color="#fff" @change="change"> <uni-popup ref="popup" background-color="#fff" @change="change">
<view class="popup-content"> <view class="popup-content">
<view class="popup-title"> <view class="popup-title">
<view class="popup-title-left"> <view class="popup-title-left">
<img src="/static/images/logo.png" alt=""> <img src="/static/images/logo.png" alt="">
</view> </view>
<view class="popup-title-right"> <view class="popup-title-right">
<view class="popup-title-right-box" style="color: #088FEB;">{{goodsDetail.productName}} <view class="popup-title-right-box" style="color: #088FEB;">{{goodsDetail.productName}}
</view> </view>
<view class="popup-title-right-box">{{goodsDetail.barcode}}</view> <view class="popup-title-right-box">{{goodsDetail.productSn}}</view>
<view class="popup-title-right-box" style="color: darkorange;" @tap="inputDialogToggle"> <view class="popup-title-right-box" style="color: darkorange;" @tap="inputDialogToggle">
<text style="margin-right:20rpx;">¥{{goodsDetail.price}}</text> <!-- <text style="margin-right:20rpx;">¥{{goodsDetail.price}}</text> -->
</view> </view>
</view> </view>
</view> </view>
<view class="popup-container"> <view class="popup-container">
<ul> <view class="purchase-price" v-if="storageType == 0">
<li v-for="(items,index) in goodsDetail.attributeList" :key="index"> <view style="margin-right: 20rpx;">采购价</view>
<view class="title-fur"> <uni-easyinput type="text" v-model="purchasePrice" placeholder="请输入采购价" />
<view class="name">{{items.name}}</view> </view>
</view> <ul style="border-top:20rpx;">
<view class="attrs"> <li v-for="(items,index) in goodsDetail.attributeList" :key="index">
<uni-data-checkbox v-model="value" :localdata="range" <view class="title-fur">
@change="change"></uni-data-checkbox> <view class="name">{{items.name}}</view>
<text v-for="(itemTag, index1) in items.value" :key="index1" </view>
@tap.stop="attrNameChange(index,index1) " <view class="attrs">
:class="itemTag.isChecked ? 'checkedText' : '' "> {{itemTag.value}}</text> <uni-data-checkbox v-model="value" :localdata="range"
</view> @change="change"></uni-data-checkbox>
</li> <text v-for="(itemTag, index1) in items.value" :key="index1"
</ul> @tap.stop="attrNameChange(index,index1) "
<view class="checkList" v-for="item in temporaryList"> :class="itemTag.isChecked ? 'checkedText' : '' "> {{itemTag.value}}</text>
<view class="checkList-box"> </view>
{{item.name}} </li>
</view> </ul>
<uni-number-box :value="item.temporaryNum" @change="temporaryChange" /> <view class="checkList" v-for="item in temporaryList">
</view> <view class="checkList-box">
</view> {{item.name}}
<view class="popup-bottom" v-for="item in temporaryList"> </view>
<view class="popup-bottom-left"> <uni-number-box v-model="item.productCount" @change="temporaryChange" />
<text>{{item.num}} 件</text> </view>
<text>¥{{item.num * item.price}}</text> </view>
</view> <view class="popup-bottom" v-for="item in temporaryList">
<view class="popup-bottom-right"> <view class="popup-bottom-left">
<view class="bottom-btn" @tap="temporaryCheck">选好了</view> <text>{{zNum}} 件</text>
</view> <text>¥{{zPrice}}</text>
</view> </view>
</view> <view class="popup-bottom-right">
</uni-popup> <view class="bottom-btn" @tap="temporaryCheck">选好了</view>
</view> </view>
<!-- 购物车弹出层 --> </view>
<uni-popup ref="carPopup" background-color="#fff" @change="change"> </view>
<view class="popup-content"> </uni-popup>
<view v-for="item in carList"> </view>
<!-- 弹出输入框 -->
<uni-popup ref="inputDialog" type="dialog">
<view class="popup-title"> <uni-popup-dialog ref="inputClose" mode="input" title="采购价" placeholder="请输入采购价"
<view class="popup-title-left"> @confirm="changePrice"></uni-popup-dialog>
<img src="/static/images/logo.png" alt=""> </uni-popup>
</view> <!-- 购物车弹出层 -->
<view class="popup-title-right"> <uni-popup ref="carPopup" background-color="#fff" @change="change">
<view class="popup-title-right-box" style="color: #088FEB;">{{item.productName}}</view> <view class="popup-content">
<view class="popup-title-right-box">{{item.productSn}}</view> <view v-for="item in carList" style="position: relative;">
<view class="popup-title-right-box" style="color: darkorange;" @tap="inputDialogToggle"> <view class="popup-title">
<text style="margin-right:20rpx;">¥{{item.price}}</text> <view class="popup-title-left">
<uni-icons color="#088FEB" type="compose" size="16"></uni-icons> <img src="/static/images/logo.png" alt="">
<view style="position: absolute;top: 30rpx;right: 30rpx;"> </view>
<uni-icons color="red" type="trash" size="26"></uni-icons> <view class="popup-title-right">
</view> <view class="popup-title-right-box" style="color: #088FEB;">{{item.productName}}</view>
</view> <view class="popup-title-right-box">{{item.productSn}}</view>
<view class="popup-title-right-box" style="color: darkorange;" @tap="inputDialogToggle">
</view> <text style="margin-right:20rpx;">¥{{item.price}}</text>
</view> <!-- <uni-icons color="#088FEB" type="compose" size="16"></uni-icons> -->
<view class="popup-container"> <view style="position: absolute;top: 30rpx;right: 30rpx;" @tap.stop="delShop(item.id)">
<view class="checkList"> <uni-icons color="red" type="trash" size="26"></uni-icons>
<view style="margin-right:5%;"> </view>
<uni-icons color="red" type="minus" size="26"></uni-icons> </view>
</view>
<view class="checkList-box"> </view>
<text>女装</text> </view>
<text>S码</text> <view class="popup-container" v-for="items in item.saleDetailQueryDTO">
<text>黄色</text> <view class="checkList">
</view> <view style="margin-right:5%;" @tap="delShopSpec(items.name)">
<uni-number-box :value="numberValue" @change="change" /> <uni-icons color="red" type="minus" size="26"></uni-icons>
</view> </view>
</view> <view class="checkList-box">
</view> {{items.name}}
</view>
<view class="popup-bottom"> <uni-number-box v-model="items.productCount" @change="change" />
<view class="popup-bottom-left"> </view>
<text>2 款 9 件</text> </view>
</view> </view>
<view class="popup-bottom-right">
<view class="bottom-btn" @tap="">选好了</view> <view class="popup-bottom">
</view> <view class="popup-bottom-left">
</view> <text>2 款 9 件</text>
</view>
</view> <view class="popup-bottom-right">
<view class="bottom-btn" @tap="">选好了</view>
</view>
</view>
</view>
</uni-popup> </uni-popup>
</view> </view>
</template> </template>
@ -180,44 +184,204 @@
this.khid = options.khid; this.khid = options.khid;
this.getShareList(options.khid); this.getShareList(options.khid);
}, },
methods: { methods: {
attrNameChange(index, index1) { attrNameChange(index, index1) {
this.goodsDetail.attributeList[index].value.forEach(item => { this.goodsDetail.attributeList[index].value.forEach(item => {
item.isChecked = false; item.isChecked = false;
}) })
this.goodsDetail.attributeList[index].isChecked = true;
this.goodsDetail.attributeList[index].isChecked = true; this.goodsDetail.attributeList[index].value[index1].isChecked = true;
this.goodsDetail.attributeList[index].value[index1].isChecked = true; var name = '',
evalue = [],
var name = '', //选中后弹出层显示的名字 obj = {},
evalue = [] //临时储存的数组 specsList = []
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) { for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
for (var m = 0, Ien = this.goodsDetail.attributeList[i].value; m < Ien.length; m++) { for (var m = 0, Ien = this.goodsDetail.attributeList[i].value; m < Ien.length; m++) {
if (Ien[m].isChecked == true) {
if (Ien[m].isChecked == true) {
evalue.push(Ien[m].value) evalue.push(Ien[m].value)
name += Ien[m].value name += Ien[m].value
} }
} }
}
this.keyList.map((item, index) => {
obj[item] = evalue[index]
})
let jishuqi = 0;
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
if (this.goodsDetail.attributeList[i].isChecked == true) {
jishuqi++
}
}
if (this.goodsDetail.attributeList.length == jishuqi) {
let data = {}
this.attributeList = {
attributeList: JSON.stringify(obj),
productCount: this.temporaryNum,
name:name,
price:this.purchasePrice
}
if (this.temporaryList.length == 0) {
this.temporaryList.push(this.attributeList);
} else {
for (var i = 0; i < this.temporaryList.length; i++) {
if (this.temporaryList[i].name.indexOf(this.attributeList.name) != -1) {
this.temporaryList[i] = this.attributeList
return
} else {
if (this.temporaryList.length == (i+1)) {
this.temporaryList.push(this.attributeList);
return
}
}
}
}
}
},
temporaryChange(val) {
console.log(val)
this.zNum = 0
console.log(this.temporaryList)
for (var i=0;i<this.temporaryList.length;i++) {
this.zNum += this.temporaryList[i].productCount
}
this.zPrice = this.zNum * this.purchasePrice
},
//获取弹出层状态
change(e) {
console.log('当前模式:' + e.type + ',状态:' + e.show);
},
//弹出购物车或者商品规格选择弹窗
toggle(type, item) {
this.type = type
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
if (type == 'carPopup') {
this.$refs.carPopup.open('bottom')
} else {
this.checkGoods(item);
this.$refs.popup.open('bottom')
}
},
//选择商品查询商品规格
checkGoods(item) {
this.goodsDetail = item
if (typeof(this.goodsDetail.attributeList) == 'string') {
let newObj = JSON.parse(this.goodsDetail.attributeList)
let newArr = []
for (let val in newObj) {
let valueObj = [];
for (var i = 0; i < newObj[val].length; i++) {
valueObj.push({
value: newObj[val][i],
isChecked: false
})
this.attrNameList.push({
value: newObj[val][i],
name: val,
isChecked: false
})
}
newArr.push({
name: val,
value: valueObj
})
}
this.goodsDetail.attributeList = newArr;
this.goodsDetail.attributeList.forEach((item, index) => {
this.columns[index] = item.value;
this.keyList[index] = item.name;
})
}
},
//顶部搜索框
search(res) {
this.searchName = res.value
uni.showToast({
title: '搜索:' + res.value,
icon: 'none'
})
},
inputDialogToggle() {
this.$refs.inputDialog.open()
},
//临时改价
changePrice(val) {
this.goodsDetail.price = this.temporaryList[0].price = val
},
//弹窗选择规格后,点击弹窗中选好了按钮
temporaryCheck() {
if(this.storageType == 0 && this.purchasePrice == 0){
uni.showToast({
title: "请输入采购价!",
icon: 'none'
})
}else{
let data = {
id: this.goodsDetail.id,
price: this.zPrice,
num: this.zNum,
productName: this.goodsDetail.productName,
productSn: this.goodsDetail.productSn,
productPicture: this.goodsDetail.productPicture,
supplierName: this.goodsDetail.supplierName,
saleDetailQueryDTO:this.temporaryList
}
this.carList.push(data)
this.temporaryList = []
this.purchasePrice = ''
this.zPrice = ''
this.zNum = ''
for(let i=0;i<this.goodsDetail.attributeList.length;i++){
this.goodsDetail.attributeList[i].isChecked = false;
for (let m=0;m<this.goodsDetail.attributeList[i].value.length;m++) {
this.goodsDetail.attributeList[i].value[m].isChecked = false
}
}
this.$refs.popup.close()
}
},
//删除整条商品
delShop(id){
var that = this;
console.log(this.carList)
for (let i=0;i<this.carList.length;i++) {
if(this.carList[i].id == id){
uni.showModal({
title: "提示",
content: "确定删除此条商品吗?",
success: function(res) {
that.carList.splice(i,1)
}
})
}
}
},
//删除商品下的某一个规格
delShopSpec(name){
var that = this;
console.log(this.carList)
for (let i=0;i<this.carList.length;i++) {
for (let m=0;m<this.carList[i].saleDetailQueryDTO.length;m++) {
if(this.carList[i].saleDetailQueryDTO[m].name == name){
uni.showModal({
title: "提示",
content: "确定删除此条商品吗?",
success: function(res) {
that.carList[i].saleDetailQueryDTO.splice(m,1)
if(that.carList[i].saleDetailQueryDTO.length == 0){
that.carList.splice(i,1)
}
}
})
}
}
} }
this.evalue = evalue;
console.log(evalue)
this.temporaryList = [{
id: this.goodsDetail.id,
barcode: this.goodsDetail.barcode,
price: this.goodsDetail.price,
name: name,
num: this.temporaryNum,
productName: this.goodsDetail.productName,
productSn: this.goodsDetail.productSn,
productPicture:this.goodsDetail.productPicture,
supplierName:this.goodsDetail.supplierName
}]
},
temporaryChange(val) {
this.temporaryList[0].num = val
}, },
//点击底部选好了,返回上一页 //点击底部选好了,返回上一页
backPrevPage(){ backPrevPage(){
@ -274,100 +438,6 @@
this.tui.toast(res.message) this.tui.toast(res.message)
} }
}).catch((res) => {}) }).catch((res) => {})
},
//获取弹出层状态
change(e) {
},
//弹出购物车或者商品规格选择弹窗
toggle(type, item) {
this.type = type
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
if (type == 'carPopup') {
this.$refs.carPopup.open('bottom')
} else {
this.checkGoods(item);
this.$refs.popup.open('bottom')
}
},
//选择商品查询商品规格
checkGoods(item) {
this.goodsDetail = item
if (typeof(this.goodsDetail.attributeList) == 'string') {
let newObj = JSON.parse(this.goodsDetail.attributeList)
let newArr = []
for (let val in newObj) {
let valueObj = [];
for (var i = 0; i < newObj[val].length; i++) {
valueObj.push({
value: newObj[val][i],
isChecked: false
})
this.attrNameList.push({
value: newObj[val][i],
name: val,
isChecked: false
})
}
newArr.push({
name: val,
value: valueObj
})
}
this.goodsDetail.attributeList = newArr;
this.goodsDetail.attributeList.forEach((item, index) => {
this.columns[index] = item.value;
this.keyList[index] = item.name;
})
}
},
//顶部搜索框
search(res) {
this.keywords = res.value
this.getShareList(this.khid)
},
//点击左侧菜单切换
clickLeftBtn(index) {
for (var i = 0; i < this.indexList.length; i++) {
if (i == index) {
this.indexList[i].parentId = true
} else {
this.indexList[i].parentId = false
}
}
this.getShareList(this.indexList[index].id)
},
inputDialogToggle() {
this.$refs.inputDialog.open()
},
//临时改价
changePrice(val) {
this.goodsDetail.price = this.temporaryList[0].price = val
},
//弹窗选择规格后,点击弹窗中选好了按钮
temporaryCheck() {
this.carList.push(this.temporaryList[0]);
this.$refs.popup.close()
var obj = {};
this.keyList.map((item, index) => {
obj[item] = this.evalue[index]
})
this.specsList.push(obj);
// this.specsList.map((item, index) => {
// this.attributeList[index] = {
// attributeList: JSON.stringify(item),
// productCount: this.numList[index]
// }
// })
// for (var i =0;i<this.shopList.length;i++) {
// if(this.shopList[i].id == this.temporaryList[0].id){
// this.shopList[i].temporaryList = this.temporaryList[0]
// }
// }
} }
} }
} }

88
pages/inventory/addinventory.vue

@ -31,15 +31,15 @@
style="width: 140rpx;height: 140rpx;margin: 30rpx 0 0 30rpx;"> style="width: 140rpx;height: 140rpx;margin: 30rpx 0 0 30rpx;">
<view class="shop-productName"> <view class="shop-productName">
<view style="color:#FF5809;">品名:{{item.productName}}</view> <view style="color:#FF5809;">品名:{{item.productName}}</view>
<view>货号:{{item.barcode}}</view> <view>货号:{{item.productSn}}</view>
<view>供应商:{{item.supplierName}}</view> <view>供应商:{{item.supplierName}}</view>
</view> </view>
</view> </view>
<view class="shop-type"> <view class="shop-type">
<view class="shop-collapse" @tap="clickCollapse"> <view class="shop-collapse" @tap="clickCollapse" v-for="items in item.saleDetailQueryDTO">
<text>{{item.saleDetailQueryDTO.attributeList}}</text> <text>{{items.name}}</text>
<text style="color: red;">¥{{item.price * item.num}}</text> <text style="color: red;">¥{{items.price}}</text>
<text>{{item.num}}</text> <text>{{items.productCount}}</text>
</view> </view>
</view> </view>
</view> </view>
@ -48,33 +48,33 @@
<!-- 账号权限是否可以维护成本价格(主账号和被授权的账号可以维护),参数名:shop_admin_cost,维护在用户表中,存在前后端缓存里,把备注栏挪出来,谁都可以备注 --> <!-- 账号权限是否可以维护成本价格(主账号和被授权的账号可以维护),参数名:shop_admin_cost,维护在用户表中,存在前后端缓存里,把备注栏挪出来,谁都可以备注 -->
<view class="price-box-list"> <view class="price-box-list">
<view class="content-list"> <view class="content-list">
<view class="list-name">实付金额</view> <view class="list-name">应付金额</view>
<view class="list-val"> <view class="list-val">
<input type="text" value="0"> <input type="text" v-model="shouldPay">
</view> </view>
</view> </view>
<view class="content-list"> <view class="content-list">
<view class="list-name">未付金额</view> <view class="list-name">已付金额</view>
<view class="list-val"> <view class="list-val">
<input type="text" value="0"> <input type="text" v-model="alreadyPay" @blur="changePay">
</view> </view>
</view> </view>
<view class="content-list"> <view class="content-list">
<view class="list-name">欠款</view> <view class="list-name">欠款</view>
<view class="list-val"> <view class="list-val">
<input type="text" value="0"> <input type="text" v-model="noPay" disabled>
</view> </view>
</view> </view>
<view class="content-list"> <view class="content-list">
<view class="list-name">其他费用</view> <view class="list-name">其他费用</view>
<view class="list-val"> <view class="list-val">
<input type="text" value="0"> <input type="text" v-model="otherPay">
</view> </view>
</view> </view>
<view class="content-list"> <view class="content-list">
<view class="list-name">备注</view> <view class="list-name">备注</view>
<view class=""> <view class="">
<textarea /> <textarea v-model="remask"/>
</view> </view>
</view> </view>
</view> </view>
@ -82,8 +82,8 @@
</view> </view>
<view class="bottom-box"> <view class="bottom-box">
<view class="bottom-left"> <view class="bottom-left">
<text>合计:2</text> <text>合计:{{totalAmount}}</text>
<text style="color: #ffa200;">¥20.00</text> <text style="color: #ffa200;">¥{{shouldPay}}</text>
</view> </view>
<view class="bottom-right"> <view class="bottom-right">
<button class="bottom-btn" @tap='inventorySubmit'>入库</button> <button class="bottom-btn" @tap='inventorySubmit'>入库</button>
@ -108,12 +108,25 @@
single: '' single: ''
}, },
khName:[], khName:[],
carList:[] carList:[],
remask:'',
otherPay: 0,
noPay: 0,
alreadyPay: 0,
realAmount: 0,
shouldPay:0,
totalAmount:0
} }
}, },
onShow(){ onShow(){
this.khName = JSON.parse(JSON.stringify(this.khName)) || '' this.khName = JSON.parse(JSON.stringify(this.khName)) || ''
this.carList = this.carList || '' this.carList = this.carList || ''
console.log(this.carList)
for (let i=0;i<this.carList.length;i++) {
this.totalAmount += this.carList[i].num
this.shouldPay += this.carList[i].price
}
this.noPay = this.shouldPay
}, },
onLoad(){ onLoad(){
@ -137,9 +150,13 @@
}, },
goodsAdd() { goodsAdd() {
uni.navigateTo({ uni.navigateTo({
url:"/pages/billing/changeGoods1?type=" + 'inventory' url:"/pages/inventory/changeGoods1"
}) })
}, },
//计算欠款
changePay(){
this.noPay = this.shouldPay - this.alreadyPay
},
//跳转选择供应商 //跳转选择供应商
goPopleList(popleType) { goPopleList(popleType) {
uni.navigateTo({ uni.navigateTo({
@ -149,27 +166,28 @@
inventorySubmit() { inventorySubmit() {
console.log(this.khName) console.log(this.khName)
console.log(this.carList) console.log(this.carList)
let that = this;
let purchase = { let purchase = {
alreadyPay:0, //已付金额 alreadyPay:this.alreadyPay,//已付金额
discount: 10, //折扣 noPay:this.noPay, //欠款
noPay:2000, //未支付金额 shouldPay:this.shouldPay, //应付金额
realAmount:2000, //实际金额 totalAmount:this.totalAmount, //总数量
shouldPay: 2000, //应付金额 remask:this.remask
totalAmount: 200, //总数量
} }
let purchaseDetails = [{ let purchaseDetails = []
allPrice: 1000, for (let i = 0;i<this.carList.length;i++) {
attributeList:'{"颜色":"白色","尺码":"m"}', for (let m = 0;m<this.carList[i].saleDetailQueryDTO.length;m++) {
productCount:100, let obj = {
productId:"1718617874370793472", allPrice: this.carList[i].saleDetailQueryDTO[m].price * this.carList[i].saleDetailQueryDTO[m].productCount,
purchasePrice: 10, //进货价 attributeList:this.carList[i].saleDetailQueryDTO[m].attributeList,
},{ productCount:this.carList[i].saleDetailQueryDTO[m].productCount,
allPrice: 1000, productId:this.carList[i].id,
attributeList:'{"颜色":"黑色","尺码":"m"}', purchasePrice: this.carList[i].saleDetailQueryDTO[m].price, //进货价
productCount:100, }
productId:"1718617874370793472", purchaseDetails.push(obj)
purchasePrice: 10, //进货价 }
}]
}
this.tui.request("/app/stock/putIn", "post", { this.tui.request("/app/stock/putIn", "post", {
purchase: purchase, purchase: purchase,
purchaseDetails: purchaseDetails purchaseDetails: purchaseDetails

772
pages/inventory/changeGoods1.vue

@ -0,0 +1,772 @@
<template>
<view class="page1">
<view class="title-box">
<uni-search-bar class="uni-mt-10" radius="5" placeholder="请输入商品名称/编号" cancelButton="none"
@confirm="search" />
</view>
<view class="content-box">
<view class="content-left">
<view class="left-box" v-for="(item, index) in indexList" :key="item"
:class="item.parentId ? 'left-box-hover':''" @tap="clickLeftBtn(index)">
<text style="padding: 0 40rpx;" :class="item.parentId ? 'red' :''">{{item.categoryName}}</text>
</view>
</view>
<view class="content-right">
<view class="right-box" v-for="item in shopList" :key="item" @tap="toggle('bottom',item)">
<view class="box-left">
<img :src="item.productPicture" alt="">
</view>
<view class="box-right">
<view class="box-right-name">{{item.productName}}</view>
<view class="box-right-num">{{item.productSn}}</view>
<view class="box-right-price">
<view class="price-box">
<text>{{item.purchasePrice}}</text>
<text>采购价</text>
</view>
<view class="price-box">
<text>{{item.wholesalePrice}}</text>
<text>批发价</text>
</view>
<view class="price-box">
<text>{{item.price}}</text>
<text>零售价</text>
</view>
<view class="price-box">
<text>{{item.stockCount}}</text>
<text>库存</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="bottom-box">
<view class="bottom-left" @tap="toggle('carPopup')">
<view class="bottom-left-box">
<uni-icons type="cart" size="20" color="#646566"></uni-icons>
<text class="uni-tab__text">已选择</text>
</view>
<text style="background-color:#ff0000;color:#fff;position: absolute;top: 0;right: 10rpx;"
class="uni-tab__dot">{{carList.length}}</text>
</view>
<view class="bottom-right">
<view class="bottom-btn" @tap="backPrevPage">选好了</view>
</view>
</view>
<!-- 弹出层 -->
<view>
<uni-popup ref="popup" background-color="#fff" @change="change">
<view class="popup-content">
<view class="popup-title">
<view class="popup-title-left">
<img src="/static/images/logo.png" alt="">
</view>
<view class="popup-title-right">
<view class="popup-title-right-box" style="color: #088FEB;">{{goodsDetail.productName}}
</view>
<view class="popup-title-right-box">{{goodsDetail.productSn}}</view>
<view class="popup-title-right-box" style="color: darkorange;" @tap="inputDialogToggle">
<!-- <text style="margin-right:20rpx;">¥{{goodsDetail.price}}</text> -->
</view>
</view>
</view>
<view class="popup-container">
<view class="purchase-price" v-if="storageType == 0">
<view style="margin-right: 20rpx;">采购价</view>
<uni-easyinput type="text" v-model="purchasePrice" placeholder="请输入采购价" />
</view>
<ul style="border-top:20rpx;">
<li v-for="(items,index) in goodsDetail.attributeList" :key="index">
<view class="title-fur">
<view class="name">{{items.name}}</view>
</view>
<view class="attrs">
<uni-data-checkbox v-model="value" :localdata="range"
@change="change"></uni-data-checkbox>
<text v-for="(itemTag, index1) in items.value" :key="index1"
@tap.stop="attrNameChange(index,index1) "
:class="itemTag.isChecked ? 'checkedText' : '' "> {{itemTag.value}}</text>
</view>
</li>
</ul>
<view class="checkList" v-for="item in temporaryList">
<view class="checkList-box">
{{item.name}}
</view>
<uni-number-box v-model="item.productCount" @change="temporaryChange" />
</view>
</view>
<view class="popup-bottom" v-for="item in temporaryList">
<view class="popup-bottom-left">
<text>{{zNum}} 件</text>
<text>¥{{zPrice}}</text>
</view>
<view class="popup-bottom-right">
<view class="bottom-btn" @tap="temporaryCheck">选好了</view>
</view>
</view>
</view>
</uni-popup>
</view>
<!-- 弹出输入框 -->
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="input" title="采购价" placeholder="请输入采购价"
@confirm="changePrice"></uni-popup-dialog>
</uni-popup>
<!-- 购物车弹出层 -->
<uni-popup ref="carPopup" background-color="#fff" @change="change">
<view class="popup-content">
<view v-for="item in carList" style="position: relative;">
<view class="popup-title">
<view class="popup-title-left">
<img src="/static/images/logo.png" alt="">
</view>
<view class="popup-title-right">
<view class="popup-title-right-box" style="color: #088FEB;">{{item.productName}}</view>
<view class="popup-title-right-box">{{item.productSn}}</view>
<view class="popup-title-right-box" style="color: darkorange;" @tap="inputDialogToggle">
<text style="margin-right:20rpx;">¥{{item.price}}</text>
<!-- <uni-icons color="#088FEB" type="compose" size="16"></uni-icons> -->
<view style="position: absolute;top: 30rpx;right: 30rpx;" @tap.stop="delShop(item.id)">
<uni-icons color="red" type="trash" size="26"></uni-icons>
</view>
</view>
</view>
</view>
<view class="popup-container" v-for="items in item.saleDetailQueryDTO">
<view class="checkList">
<view style="margin-right:5%;" @tap="delShopSpec(items.name)">
<uni-icons color="red" type="minus" size="26"></uni-icons>
</view>
<view class="checkList-box">
{{items.name}}
</view>
<uni-number-box v-model="items.productCount" @change="change" />
</view>
</view>
</view>
<view class="popup-bottom">
<view class="popup-bottom-left">
<text>2 款 9 件</text>
</view>
<view class="popup-bottom-right">
<view class="bottom-btn" @tap="">选好了</view>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
indexList: [],
pageNum: 1, //分页的页码
shopList: [],
info: 0,
categoryId: '', //分类id
searchName: '', //搜索框输入值
shopId: '', //店铺id,
checkbox: [], //需要分享的商品id
temporaryNum: 0,
goodsDetail: [],
attrNameList: [],
temporaryList: [],
carList: [],
columns: [],
keyList: [],
specsList: [],
evalue: [],
attributeList: [],
purchasePrice: 0,
zPrice:0,
zNum:0,
storageType:0
}
},
onLoad() {
this.getGategoryList()
this.storageType = uni.getStorageSync('type')
},
methods: {
//初始化获取分类列表
getGategoryList() {
this.tui.request("/app/productCategory/list", "get", {
// shopId: 1,
}, false, true).then((res) => {
if (res.code == 200) {
this.indexList = res.result;
for (var i = 0; i < this.indexList.length; i++) {
if (i == 0) {
this.indexList[i].parentId = true
} else {
this.indexList[i].parentId = false
}
}
this.getShareList(this.indexList[0].id);
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
attrNameChange(index, index1) {
this.goodsDetail.attributeList[index].value.forEach(item => {
item.isChecked = false;
})
this.goodsDetail.attributeList[index].isChecked = true;
this.goodsDetail.attributeList[index].value[index1].isChecked = true;
var name = '',
evalue = [],
obj = {},
specsList = []
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
for (var m = 0, Ien = this.goodsDetail.attributeList[i].value; m < Ien.length; m++) {
if (Ien[m].isChecked == true) {
evalue.push(Ien[m].value)
name += Ien[m].value
}
}
}
this.keyList.map((item, index) => {
obj[item] = evalue[index]
})
let jishuqi = 0;
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
if (this.goodsDetail.attributeList[i].isChecked == true) {
jishuqi++
}
}
if (this.goodsDetail.attributeList.length == jishuqi) {
let data = {}
this.attributeList = {
attributeList: JSON.stringify(obj),
productCount: this.temporaryNum,
name:name,
price:this.purchasePrice
}
if (this.temporaryList.length == 0) {
this.temporaryList.push(this.attributeList);
} else {
for (var i = 0; i < this.temporaryList.length; i++) {
if (this.temporaryList[i].name.indexOf(this.attributeList.name) != -1) {
this.temporaryList[i] = this.attributeList
return
} else {
if (this.temporaryList.length == (i+1)) {
this.temporaryList.push(this.attributeList);
return
}
}
}
}
}
},
temporaryChange(val) {
console.log(val)
this.zNum = 0
console.log(this.temporaryList)
for (var i=0;i<this.temporaryList.length;i++) {
this.zNum += this.temporaryList[i].productCount
}
this.zPrice = this.zNum * this.purchasePrice
},
//点击底部选好了,返回上一页
backPrevPage() {
let pages = getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
let prevPage = pages[pages.length - 2]; //上一页页面实例
prevPage.$vm.carList = this.carList
uni.navigateBack({
delta: 1
})
},
//点击分类获取商品列表
getShareList(id) {
this.tui.request("/app/product/getShareList", "POST", {
categoryId: id,
supplierName: this.searchName,
pageNum: this.pageNum,
pageSize: '10'
}, false, false).then((res) => {
if (res.code == 200) {
console.log(res.result.records)
this.shopList = res.result.records
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
//获取弹出层状态
change(e) {
console.log('当前模式:' + e.type + ',状态:' + e.show);
},
//弹出购物车或者商品规格选择弹窗
toggle(type, item) {
this.type = type
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
if (type == 'carPopup') {
this.$refs.carPopup.open('bottom')
} else {
this.checkGoods(item);
this.$refs.popup.open('bottom')
}
},
//选择商品查询商品规格
checkGoods(item) {
this.goodsDetail = item
if (typeof(this.goodsDetail.attributeList) == 'string') {
let newObj = JSON.parse(this.goodsDetail.attributeList)
let newArr = []
for (let val in newObj) {
let valueObj = [];
for (var i = 0; i < newObj[val].length; i++) {
valueObj.push({
value: newObj[val][i],
isChecked: false
})
this.attrNameList.push({
value: newObj[val][i],
name: val,
isChecked: false
})
}
newArr.push({
name: val,
value: valueObj
})
}
this.goodsDetail.attributeList = newArr;
this.goodsDetail.attributeList.forEach((item, index) => {
this.columns[index] = item.value;
this.keyList[index] = item.name;
})
}
},
//顶部搜索框
search(res) {
this.searchName = res.value
uni.showToast({
title: '搜索:' + res.value,
icon: 'none'
})
},
//点击左侧菜单切换
clickLeftBtn(index) {
for (var i = 0; i < this.indexList.length; i++) {
if (i == index) {
this.indexList[i].parentId = true
} else {
this.indexList[i].parentId = false
}
}
this.getShareList(this.indexList[index].id)
},
inputDialogToggle() {
this.$refs.inputDialog.open()
},
//临时改价
changePrice(val) {
this.goodsDetail.price = this.temporaryList[0].price = val
},
//弹窗选择规格后,点击弹窗中选好了按钮
temporaryCheck() {
if(this.storageType == 0 && this.purchasePrice == 0){
uni.showToast({
title: "请输入采购价!",
icon: 'none'
})
}else{
let data = {
id: this.goodsDetail.id,
price: this.zPrice,
num: this.zNum,
productName: this.goodsDetail.productName,
productSn: this.goodsDetail.productSn,
productPicture: this.goodsDetail.productPicture,
supplierName: this.goodsDetail.supplierName,
saleDetailQueryDTO:this.temporaryList
}
this.carList.push(data)
this.temporaryList = []
this.purchasePrice = ''
this.zPrice = ''
this.zNum = ''
for(let i=0;i<this.goodsDetail.attributeList.length;i++){
this.goodsDetail.attributeList[i].isChecked = false;
for (let m=0;m<this.goodsDetail.attributeList[i].value.length;m++) {
this.goodsDetail.attributeList[i].value[m].isChecked = false
}
}
this.$refs.popup.close()
}
},
//删除整条商品
delShop(id){
var that = this;
console.log(this.carList)
for (let i=0;i<this.carList.length;i++) {
if(this.carList[i].id == id){
uni.showModal({
title: "提示",
content: "确定删除此条商品吗?",
success: function(res) {
that.carList.splice(i,1)
}
})
}
}
},
//删除商品下的某一个规格
delShopSpec(name){
var that = this;
console.log(this.carList)
for (let i=0;i<this.carList.length;i++) {
for (let m=0;m<this.carList[i].saleDetailQueryDTO.length;m++) {
if(this.carList[i].saleDetailQueryDTO[m].name == name){
uni.showModal({
title: "提示",
content: "确定删除此条商品吗?",
success: function(res) {
that.carList[i].saleDetailQueryDTO.splice(m,1)
if(that.carList[i].saleDetailQueryDTO.length == 0){
that.carList.splice(i,1)
}
}
})
}
}
}
}
}
}
</script>
<style lang="scss">
page {
height: 100%;
}
.page1 {
display: flex;
flex-direction: column;
height: 92%;
}
.uni-tab__dot {
padding: 0 4px;
line-height: 15px;
color: #ffffff;
text-align: center;
font-size: 12px;
background-color: #ff0000;
border-radius: 15px;
}
.popup-content {
align-items: center;
justify-content: center;
padding: 15px;
height: 1200rpx;
background-color: #fff;
}
.popup-title-right-box {
height: 50rpx;
line-height: 50rpx;
}
.popup-title-right {
width: 400rpx;
margin-left: 30rpx;
}
.popup-title-left {
width: 150rpx;
height: 150rpx;
}
.popup-title-left image {
width: 150rpx;
height: 150rpx;
}
.popup-title {
display: flex;
height: 180rpx;
border-bottom: 1px solid #eee;
margin-top: 20rpx;
}
.popup-container {
width: 100%;
background: #fff;
height: 50rpx;
}
.uni-tab__text {
font-size: 12px;
color: #646566;
}
.title-box {
background: #fff;
}
.bottom-box {
width: 100%;
position: fixed;
bottom: 0;
display: flex;
}
.bottom-left {
width: 15%;
position: relative;
}
.bottom-right {
width: 85%;
.bottom-btn {
width: 85%;
line-height: 35px;
height: 70rpx;
text-align: center;
margin-top: 10rpx;
color: #fff;
font-size: 28rpx;
margin: 0 auto;
background: linear-gradient(90deg, #60F3FF, #088FEB);
border-radius: 70rpx;
}
}
.bottom-left-box {
display: flex;
flex-direction: column;
text-align: center;
}
.content-box {
background: #fff;
flex: 1;
display: flex;
}
.content-left {
width: 170rpx;
background: #eee;
height: 100%;
}
.left-box {
width: 100%;
height: 90rpx;
font-size: 30rpx;
text-align: center;
line-height: 90rpx;
border-bottom: 1px solid #fff;
}
.purchase-price {
display: flex;
line-height: 40px;
height: 80rpx;
width: 95%;
margin: 20rpx auto;
}
.left-box-hover {
width: 100%;
height: 90rpx;
font-size: 30rpx;
text-align: center;
line-height: 90rpx;
border-bottom: 1px solid #fff;
background-color: #fff;
}
.red {
border-right: 3px solid red;
}
.content-right {
width: 550rpx;
overflow-y: scroll;
}
.right-box {
width: 100%;
height: 190rpx;
display: flex;
border-bottom: 1px solid #eee;
position: relative;
}
.box-left {
width: 130rpx;
height: 131rpx;
background-size: 100%;
margin: 25rpx 30rpx 35rpx 10rpx;
border-radius: 20rpx;
}
.box-left img {
width: 100%;
height: 100%;
}
.box-right {
margin-top: 17rpx;
}
.box-right-name {
font-size: 30rpx;
font-weight: bold;
}
.box-right-num {
padding: 5rpx 0;
color: #777;
}
.box-right-price {
display: flex;
font-size: 25rpx;
}
.checkbox {
width: 40rpx;
height: 40rpx;
position: absolute;
top: 20rpx;
right: 30rpx;
}
.price-box {
display: flex;
flex-direction: column;
margin-right: 20rpx;
}
.price-box text:first-child {
color: #ffa200
}
.uni-tab__cart-button-right,
.uni-tab__cart-sub-right {
display: none;
flex: none;
}
.title-fur {
width: 95%;
height: 70rpx;
margin: 0 auto;
}
.name {
font-size: 30rpx;
width: 50%;
float: left;
height: 70rpx;
line-height: 70rpx;
}
.content-fur {
padding-bottom: 25rpx;
}
.content-low {
width: auto;
border: 1px solid #eee;
display: inline-block;
min-width: 90rpx;
padding: 5rpx;
font-size: 35rpx;
text-align: center;
color: #777;
margin: 20rpx 0 0 20rpx;
}
.content-low:hover {
background: #eee;
}
.checkList {
display: flex;
height: 50rpx;
font-size: 28rpx;
line-height: 50rpx;
margin: 20rpx 0;
}
.checkList-box {
height: 50rpx;
width: 60%;
}
.popup-bottom {
width: 100%;
height: 100rpx;
position: fixed;
bottom: 0;
display: flex;
}
.popup-bottom-left {
width: 50%;
line-height: 80rpx;
}
.popup-bottom-right {
width: 50%;
line-height: 100rpx;
.bottom-btn {
width: 70%;
line-height: 35px;
height: 70rpx;
text-align: center;
/* margin-top: 10rpx; */
color: #fff;
font-size: 28rpx;
margin: 0 auto;
background: linear-gradient(90deg, #60F3FF, #088FEB);
border-radius: 70rpx;
}
}
.attrs {
text {
display: inline-block;
border: 1px solid #5fd9ee;
margin: 20rpx;
background-color: #fff;
color: #5fd9ee;
width: 100rpx;
line-height: 70rpx;
height: 70rpx;
text-align: center;
}
.checkedText {
background-color: $u-primary;
color: #fff;
}
}
</style>
Loading…
Cancel
Save