平板端快衣店
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1538 lines
40 KiB

<template>
<view class="page1">
<view class="top" ref="top">
<view @tap="backPage" style="width: 80rpx;height: 80rpx;margin: 98rpx 0 0 30rpx;">
<uni-icons type="left" color="#fff" size="27"></uni-icons>
</view>
<view class="top1">
<view class="hello-box">
<view class="hello-left">
<text
style="font-size: 40rpx;font-weight: 800;line-height: 56rpx;color: rgba(86, 132, 255, 1);">Hi</text>
</view>
<view class="hello-name">
你好,{{shopName}}
</view>
<view class="hello-right"></view>
</view>
<view class="hello-text">
欢迎使用快衣店AI助手~
</view>
<view class="ai-bot"></view>
</view>
</view>
<view class="banner">
<view class="banner-left" @tap="AiOpenOrder('AI')">
<view class="bottom-box">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/27e2655fe19f454d93970f968d91fbef.png"
alt="" style="width: 100%;height: 100%;animation: none;">
</view>
<view class="banner-text">
<view style='font-weight: 800;'>AI</view>
<view style='font-size:22rpx;'>语音或输入文字开单</view>
</view>
</view>
<view class="banner-right" @tap='AiOpenOrder'>
<view class="bottom-box">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/da77271d34b14b13827543389948802d.jpg"
alt="" style="width: 100%;height: 100%;">
</view>
<view class="banner-text">
<view style='font-weight: 800;'>扫码</view>
<view style='font-size:22rpx;'>扫描二维码或条形码</view>
</view>
</view>
</view>
<view class="content">
<view style="height: 80rpx;line-height: 80rpx;font-size: 32rpx;font-weight: bold;padding-left: 30rpx;">
挂单列表
</view>
<view class="content-list" v-for="(item,index) in regList" :key="index">
<view class="image-box">
<view class="image" v-if="item.aiFlag == 0">扫</view>
<view class="image" v-else>AI</view>
</view>
<view class="content-text">
<view class="text" style="font-weight: bold;font-size: 32rpx;color: #000;margin-top:36rpx;">
{{item.userName}}
</view>
<view class="text">{{item.createTime}}</view>
</view>
<view class="content-btn" v-if="item.aiFlag == 1">
<text class="blink">识别中...</text>
</view>
<view class="content-btn" v-if="item.aiFlag != 1">
<text style="position: absolute;top: 40rpx;right: 20rpx;">
{{item.aiFlag == 2?'识别成功':item.aiFlag == 3?'识别失败':''}}
</text>
</view>
<view style="width: 100%;height: 100rpx;float: left;border-top: 1px solid #eee;">
<view class="btn" @tap="clickCollapse(item)" style="width: 70rpx;">
<uni-icons type="down" size="11" color="#fff"></uni-icons>
</view>
<view class="btn" @tap.stop="toggle('center',item)" v-if="item.aiFlag == 0">语音备注</view>
<view class="btn" @tap.stop="scanCodeAdd(item)" v-if="item.aiFlag == 0">扫码选货</view>
<view class="btn" v-if="item.aiFlag != 1" @tap.stop="goGoods(item)">去开单</view>
<view class="btn" @tap.stop="delItem(item.id)" style="background: linear-gradient(90deg, #FF9797, #FFC1E0);">
删除
</view>
</view>
<view class="order-collapse-item" v-if="item.isCollapse">
<view class="collapse-1">
<view class="order-notes">
<text style="color: red;">备注:</text>
{{item.remark==null?'暂无':item.remark}}
</view>
<view class="shop-list" v-for="(items,index1) in item.saleDetailDTOList" :key="index1">
<view class="order-name">
<text style="float: left;"><text style="width: 80%;">{{items.productName}}({{items.productSn}})</text>单价:{{items.discountAmount || items.wholesalePrice}}</text>
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/6b5ab32ff93a4c51b90e562e0b22e850.png" @tap.stop="largeImg(items.productPicture)" alt="">
</view>
<view class="specs-name" v-for="(itemss,index2) in items.stockLogList1" :key="index2">
<view style="margin-right:5%;" @tap="delGoodsPrecs(item,index1,index2)">
<uni-icons color="red" type="minus" size="26"></uni-icons>
</view>
{{itemss.attributeList | sliceMsg}} * {{itemss.productCount}}
</view>
<view class="del-icon" @tap.stop="delGoods(item,items.productId)">
<uni-icons color="red" type="trash" size="26"></uni-icons>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 查看大图弹出层 -->
<uni-popup ref="imgPopup" background-color="#fff">
<view class="img-popup-content">
<img class="img-radius" :src="bigImg" alt="" style="width: 100%;height: 100%;">
</view>
</uni-popup>
<!-- 语音识别弹出层 -->
<uni-popup ref="popup" background-color="#fff">
<view class="popup-content">
<view class="popup-title">
<text>语音录入</text>
<uni-icons @tap='close' type="closeempty" color='red' size="16"
style="height:40rpx;line-height: 40rpx;position: absolute !important;bottom:0;right: 30rpx;"></uni-icons>
</view>
<view class="popup-container">
<textarea name="" id="" style="width:100%;border:1px solid #eee;" v-model="voiceText"
placeholder="等待语音识别中..."></textarea>
<view>
<text style="color:red;font-size:22rpx;">*长按“语音”按钮录入,系统将自动识别</text>
</view>
<view class="popup-bottom">
<view class="popup-btn" @tap="clearText">清空</view>
<view class="popup-btn" @tap="setDetail">确认</view>
</view>
</view>
<view class="voice-btn" @touchstart="kaishi" @touchend="jieshu">
<img src="/static/images/maikefeng.png" style="width: 80%;height: 80%;margin: 10%;" alt="">
</view>
</view>
</uni-popup>
<view class="voice-model" v-if="recordState == true">
<img src="/static/images/maikefeng.png" alt="">
<view class="voice-text">语音识别中...</view>
</view>
<!-- 弹出层 -->
<uni-popup ref="shopPopup" background-color="#fff">
<view class="shop-popup-content">
<view class="shop-popup-title">
<view class="shop-popup-title-left">
<img class="img-radius" :src="goodsDetail.productPicture" alt="" v-if="goodsDetail.productPicture">
<view class="noPic" v-else>暂无图片</view>
</view>
<view class="shop-popup-title-right">
<view class="shop-popup-title-right-box" style="color: #088FEB;">{{goodsDetail.productName}}
</view>
<view class="shop-popup-title-right-box">{{goodsDetail.productSn}}</view>
<view class="popup-title-right-box" style="color: darkorange;"
@tap="inputDialogToggle('payDialog')">
<text style="margin-right:20rpx;">修改价格</text>
</view>
</view>
</view>
<view class="shop-popup-container" style="position: relative;">
<view class="shop-purchase-price" v-if="storageType == 0">
<view style="margin-right: 20rpx;">实际价格</view>
<uni-easyinput type="text" v-model="purchasePrice" @blur="checkPay(purchasePrice)" placeholder="请输入实际价格" />
</view>
<view @tap="saveCheck"
style="position: absolute;top: 120rpx;right: 20rpx;color: #088FEB;text-decoration: underline;">
保存已选
</view>
<ul style="border-top:20rpx;">
<li v-for="(items,index) in goodsDetail.attributeList" :key="index">
<view class="shop-title-fur">
<view class="shop-name">{{items.name}}</view>
</view>
<view class="shop-attrs">
<uni-data-checkbox v-model="value" :localdata="range"
></uni-data-checkbox>
<text v-for="(itemTag, index1) in items.value" :key="index1"
@tap.stop="attrNameChange(index,itemTag.value,index1) "
:class="itemTag.isChecked ? 'checkedText' : '' "> {{itemTag.value}}</text>
</view>
</li>
</ul>
<view style="padding-bottom: 100rpx;">
<view class="shop-checkList" v-if="temporaryList != ''">
<view class="shop-checkList-box" style="width:67%;">
<text style="width: 300rpx;display: inline-block;font-size: 30rpx;font-weight: bold;padding-left: 40rpx;">规格</text>
<text style="font-size: 30rpx;color: #000;font-weight: bold;width: 110rpx;display: inline-block;text-align: right;">库存</text>
</view>
<uni-number-box max='1000000' @minus='minusNum' @plus="plusNum" v-model="allChangeNum" @blur="allChange" />
</view>
<view class="shop-checkList" v-for="(item,index) in temporaryList" :key="index">
<view @tap.stop="delCarData(index)" style="margin-right: 20rpx">
<uni-icons color="red" type="minus" size="26"></uni-icons>
</view>
<view class="shop-checkList-box">
<text style="width: 300rpx;display: inline-block;">{{item.name}}</text> <text style="color:#777;font-size: 12px;">库存:{{item.productNum}}</text>
</view>
<uni-number-box max='1000000' v-model="item.productCount" @change="temporaryChange" />
</view>
</view>
</view>
</view>
<view class="shop-popup-bottom" v-for="(item,index) in temporaryList" :key="index">
<view class="shop-popup-bottom-left">
<text>{{zNum}} 件</text>
<text>¥{{zPrice}}</text>
</view>
<view class="shop-popup-bottom-right">
<view class="bottom-btn" @tap="temporaryCheck">选好了</view>
</view>
</view>
</uni-popup>
<!-- 弹出输入框 -->
<uni-popup ref="payDialog" background-color="#fff">
<view class="popup-pay-content">
<view class="popup-pay-title">
<text>选择商品价格</text>
</view>
<view class="popup-pay-container" @tap="checkPay(goodsDetail.price)">
<text style="display: inline-block">零售价:¥{{goodsDetail.price}}</text>
</view>
<view class="popup-pay-container" @tap="checkPay(goodsDetail.wholesalePrice)">
<text style="display: inline-block">批发价:¥{{goodsDetail.wholesalePrice}}</text>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
var plugin = requirePlugin("WechatSI")
let manager = plugin.getRecordRecognitionManager()
export default {
components: {},
data() {
return {
khName:[],
regList:[],
pageNumber: 1,
recordState: false,
voiceText: ' ',
list: [],
value: '',
temporaryNum: 0,
goodsDetail: [],
attrNameList: [],
temporaryList: [],
carList: [],
specsList: [],
evalue: [],
attributeList: [],
purchasePrice: 0,
zPrice: 0,
zNum: 0,
storageType: 0,
hangId: '',
bigImg: '',
productId:'',
productNum:0,
pageOldTemList: [],
oldTemList: [],
goodsList: [],
newTemList: [],
pecsList: [],
dataObj: new Map(),
allChangeNum:0,
shopName:''
}
},
filters: {
sliceMsg(val) {
var name = ''
if (typeof(val) == 'string') {
let newObj = JSON.parse(val)
for (let as in newObj) {
name += newObj[as] + '/'
}
}
return name;
}
},
onPullDownRefresh(){
this.getRegList()
},
onShow() {
this.khName = JSON.parse(JSON.stringify(this.khName)) || ''
if(uni.getStorageSync('hangOrderType') == 'scanCode'){
if(this.khName != ''){
this.addReg()
}
uni.removeStorageSync('hangOrderType')
return;
}else if(uni.getStorageSync('hangOrderType') == 'changeGoods'){
uni.removeStorageSync('hangOrderType')
return;
}
if(this.khName != ''){
uni.navigateTo({
url: '/package1/AI/AiChat?khName='+ JSON.stringify(this.khName)
})
}
this.khName = []
this.getRegList()
},
onLoad() {
this.shopName = uni.getStorageSync('shopName')
this.initRecord();
},
methods: {
//挂单列表
getRegList() {
let obj = {
status: "7",
pageVo: {
pageNumber: this.pageNumber,
pageSize: 10
}
}
this.tui.request("/app/sale/listPages", "POST", obj, false, false).then((res) => {
if (res.code == 200) {
for (let i = 0; i < res.result.records.length; i++) {
res.result.records[i].isCollapse = false
}
this.regList = res.result.records;
} else {
this.tui.toast(res.message)
}
}).catch((res) => {
this.tui.toast(res)
})
uni.stopPullDownRefresh()
},
addReg() {
this.tui.request("/app/sale/saveOrder", "POST", {
userId:this.khName.id,
userName:this.khName.name,
aiFlag:0,
status: 7,
area:this.khName.area,
city:this.khName.city,
province:this.khName.province,
receiveAddress:this.khName.address
}, false, false).then((res) => {
if (res.code == 200) {
this.getRegList()
} else {
this.tui.toast(res.message)
}
}).catch((res) => {
this.tui.toast(res)
})
},
//关闭弹出层
close() {
this.$refs.popup.close()
},
//按住语音识别,开始
kaishi() {
this.recordState = true
manager.start({
duration: 60000,
lang: "zh_CN"
});
},
//松开语音识别,结束
jieshu() {
this.recordState = false
manager.stop()
},
//语音内容为空
showRecordEmptyTip() {
uni.showToast({
title: "请重新说一遍",
icon: 'error'
})
},
//语音识别功能初始化
initRecord() {
let that = this;
manager.stop()
// 识别结束事件
manager.onStop = (res) => {
if (res.result == '') {
that.showRecordEmptyTip()
return
}
if(that.voiceText == ''){
that.voiceText = res.result
}else if(that.voiceText == null){
that.voiceText = res.result
}else{
res.result = ' ' + res.result
that.voiceText += res.result
}
}
// 识别错误事件
manager.onError = (res) => {
if (res.retcode == '-40001') {
uni.showToast({
title: '使用次数超限制,请联系管理员!',
icon: 'none'
})
}
}
},
//扫一扫功能
scanCodeAdd(item) {
let that = this;
uni.setStorageSync('hangOrderType','changeGoods')
uni.scanCode({
success: (res) => {
that.hangId = item.id
if(res.scanType == "QR_CODE"){ //二维码
let shopId = res.result.split(',')[1]
if(shopId == uni.getStorageSync('shopId')){
that.productId = res.result.split(',')[0]
that.toggle('bottom', res.result.split(',')[0]);
if (item.saleDetailDTOList) {
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
that.carList.push(item.saleDetailDTOList[i])
}
}
}else{
that.tui.toast('您的店铺中暂无该商品!')
}
}else{
that.tui.request("/app/product/getByBarcode", "POST", {
barcode:res.result
}, false, true).then((res1) => {
if (res1.code == 200) {
that.productId = res1.result[0].id
if(res1.result == ''){
that.tui.toast('您的店铺中暂无该商品!')
}else{
that.toggle('bottom', res1.result[0].id);
if (item.saleDetailDTOList) {
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
that.carList.push(item.saleDetailDTOList[i])
}
}
}
} else {
that.tui.toast(res.message)
}
}).catch((res) => {
that.tui.toast(res)
})
}
},
fail: (res) => {
uni.showToast({
title: '扫描失败',
icon: 'none'
})
}
})
},
//点击规格选择后,下方出现所选规格和库存数
attrNameChange(index, data1,index1) {
this.goodsDetail.attributeList[index].isChecked = !this.goodsDetail.attributeList[index].isChecked;
this.goodsDetail.attributeList[index].value[index1].isChecked = !this.goodsDetail.attributeList[index]
.value[index1].isChecked;
if (this.goodsList[index].specs.indexOf(data1) != -1) {
this.goodsList[index].specs.splice(this.goodsList[index].specs.indexOf(data1), 1)
} else {
this.goodsList[index].specs.push(data1)
}
let jishuqi = 0
for (var i = 0; i < this.goodsList.length; i++) {
if (this.goodsList[i].specs.length > 0) {
jishuqi++
}
}
var resultList = []
if (jishuqi == this.goodsList.length) {
resultList = this.combination(this.goodsList);
}
var evalue = []
var value = []
for (var m = 0; m < resultList.length; m++) {
var name = ''
let value1 = "{"
for (var j = 0; j < resultList[m].length; j++) {
if (j != resultList[m].length - 1) {
name += resultList[m][j] + '/'
value1 += '"' + this.dataObj.get(resultList[m][j]) + '":"' + resultList[m][j] + '",'
} else {
name += resultList[m][j]
value1 += '"' + this.dataObj.get(resultList[m][j]) + '":"' + resultList[m][j] + '"'
}
}
value1 += "}"
value.push(value1)
evalue.push(name)
}
console.log(jishuqi)
// if (jishuqi == 0) {
// this.oldTemList = []
// }
// if (this.temporaryList.length == 0) {
if (jishuqi == this.goodsList.length) {
console.log(jishuqi)
for (var i = 0; i < value.length; i++) {
this.attributeList = {
attributeList: value[i],
productCount: this.temporaryNum,
productNum: this.productNum,
name: evalue[i],
price: this.purchasePrice
}
this.temporaryList.push(this.attributeList);
}
}
this.$forceUpdate()
// } else {
// let newProductCount = 0;
// for (var i = 0; i < value.length; i++) {
// for (var m = 0; m < this.temporaryList.length; m++) {
// if (this.temporaryList[m].attributeList == value[i]) {
// newProductCount = this.temporaryList[m].productCount
// }
// }
// this.attributeList = {
// attributeList: value[i],
// productCount: newProductCount,
// productNum: this.productNum,
// name: evalue[i],
// price: this.purchasePrice
// }
// this.newTemList.push(this.attributeList);
// newProductCount = 0;
// }
// for (var i = 0; i < this.oldTemList.length; i++) {
// let oldAttributeList = '';
// let oldProductCount = '';
// let notChcek = true;
// for (var m = 0; m < this.newTemList.length; m++) {
// if (this.oldTemList[i].attributeList == this.newTemList[m].attributeList) {
// this.newTemList[m].productCount = this.oldTemList[i].productCount
// notChcek = false;
// }
// }
// if (this.newTemList.length > 0 && notChcek) {
// this.newTemList.push(this.oldTemList[i]);
// }
// }
// for (var i = 0; i < this.pageOldTemList.length; i++) {
// let oldAttributeList = '';
// let oldProductCount = '';
// let notChcek = true;
// for (var m = 0; m < this.newTemList.length; m++) {
// if (this.pageOldTemList[i].attributeList == this.newTemList[m].attributeList) {
// this.newTemList[m].productCount = this.pageOldTemList[i].productCount
// notChcek = false;
// }
// }
// if (this.newTemList.length > 0 && notChcek) {
// this.newTemList.push(this.pageOldTemList[i]);
// }
// }
// }
this.$nextTick(() => {
for (var i = 0; i < this.temporaryList.length; i++) {
for (var m = 0; m < this.pecsList.length; m++) {
if (this.temporaryList[i].attributeList == this.pecsList[m].attributeList) {
this.temporaryList[i].productNum = this.pecsList[m].stockCount
}
}
}
})
// if (jishuqi != this.goodsList.length) {
// if (this.oldTemList.length == 0 && this.pageOldTemList.length == 0) {
// this.newTemList = []
// this.temporaryList = []
// }
// }
// if (this.newTemList.length != 0 && jishuqi == this.goodsList.length) {
// this.temporaryList = this.newTemList;
// this.oldTemList = []
// this.newTemList = []
// }
},
temporaryChange(val) {
this.zNum = 0
for (var i = 0; i < this.temporaryList.length; i++) {
this.zNum += this.temporaryList[i].productCount
}
this.zPrice = this.zNum * this.purchasePrice
},
//弹窗选择规格后,点击弹窗中选好了按钮
temporaryCheck() {
if (this.storageType == 0 && this.purchasePrice == 0) {
uni.showToast({
title: "请输入实际价格!",
icon: 'none'
})
} else {
for (var i = 0; i < this.temporaryList.length; i++) {
if(this.temporaryList[i].productCount <= 0){
this.tui.toast("商品数量不能为零!")
return
}
}
let data = {
discount: 10,
productId: this.goodsDetail.id,
realPrice: this.zPrice,
productCount: this.zNum,
discountAmount: this.purchasePrice,
unitPrice:this.purchasePrice,
categoryId:this.goodsDetail.categoryId,
productName: this.goodsDetail.productName,
productSn: this.goodsDetail.productSn,
productPicture: this.goodsDetail.productPicture,
supplierName: this.goodsDetail.supplierName,
stockLogList1: this.temporaryList
}
this.carList.push(data)
this.purchasePrice = ''
this.temporaryList = []
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.setSaleDetail()
this.$refs.shopPopup.close()
}
},
//保存扫码选择的商品、删除整条商品数据都用这个方法
setSaleDetail() {
this.tui.request("/app/sale/setSaleDetail", "post", {
saleDetailList: this.carList,
saleId: this.hangId
}, false, false).then((res) => {
if (res.code == 200) {
this.getRegList()
this.carList = []
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
//弹出商品规格选择
toggle(type, id) {
this.type = type
if (type == 'bottom') {
this.allChangeNum = 0
this.getById(id);
} else {
wx.vibrateShort()
this.initRecord();
this.voiceText = id.remark
this.list = id
this.$refs.popup.open(type)
}
},
AiOpenOrder(type){
if(type=='AI'){
uni.navigateTo({
url: '/pages/index/peopleList?popleType=khName'
})
}else{
uni.setStorageSync('hangOrderType','scanCode')
uni.navigateTo({
url: '/pages/index/peopleList?popleType=khName'
})
}
},
backPage(){
uni.navigateBack({
delta: 2
})
},
delItem(id) {
var that = this;
uni.showModal({
title: "提示",
content: "确定删除此条挂单吗?",
success: function(res) {
if (res.confirm) {
that.tui.request("/app/sale/delById", "post", {
id: id,
}, false, true).then((res) => {
if (res.code == 200) {
that.getRegList()
uni.showToast({
title:"删除成功",
icon: 'none'
})
} else {
uni.showToast({
title:"删除失败",
icon: 'none'
})
}
}).catch((res) => {})
}
}
})
},
goGoods(item){
var that = this;
if(item.aiNotRecognition != '' && item.aiNotRecognition != null){
uni.showModal({
title: "提示",
content: item.aiNotRecognition + '确认去开单吗?',
success: function(res) {
if (res.confirm) {
that.goSaleGoods(item)
}
}
})
}else if(item.aiNotRecognition == '' && item.saleDetailDTOList == null){
uni.showModal({
title: "提示",
content: '未识别到商品,确认去开单吗?',
success: function(res) {
if (res.confirm) {
that.goSaleGoods(item)
}
}
})
}else{
that.goSaleGoods(item)
}
},
//带参数跳转到开单页
goSaleGoods(item) {
let dataList = []
if(item.saleDetailDTOList){
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
let obj = {}
let attrMap = new Map()
let newSaleDetailDTOList = []
for(let m = 0; m < item.saleDetailDTOList[i].stockLogList1.length; m++){
if(attrMap.has(item.saleDetailDTOList[i].stockLogList1[m].attributeList) == true){
let hasCount = attrMap.get(item.saleDetailDTOList[i].stockLogList1[m].attributeList)
let trueCount = hasCount.split('-')[0]
let lastConut = Number(trueCount) + Number(item.saleDetailDTOList[i].stockLogList1[m].productCount)
newSaleDetailDTOList[hasCount.split('-')[1]].productCount = lastConut
}else{
newSaleDetailDTOList.push(item.saleDetailDTOList[i].stockLogList1[m])
attrMap.set(item.saleDetailDTOList[i].stockLogList1[m].attributeList,item.saleDetailDTOList[i].stockLogList1[m].productCount+'-'+m)
}
}
obj.saleDetailQueryDTO = newSaleDetailDTOList
obj.num = 0
obj.id = item.saleDetailDTOList[i].productId
obj.price = item.saleDetailDTOList[i].price
obj.lsprice = item.saleDetailDTOList[i].price
obj.categoryId=item.saleDetailDTOList[i].categoryId
obj.zPrice = item.saleDetailDTOList[i].discountAmount
obj.unitPrice = item.saleDetailDTOList[i].discountAmount || item.saleDetailDTOList[i].wholesalePrice
obj.productName = item.saleDetailDTOList[i].productName
obj.productPicture = item.saleDetailDTOList[i].productPicture+'?time='+new Date().getTime()
obj.productSn = item.saleDetailDTOList[i].productSn
obj.wholesalePrice = item.saleDetailDTOList[i].wholesalePrice
obj.saleId = item.id
obj.remark = item.remark
obj.xsyId = item.createBy
obj.createByName = item.createByName
dataList.push(obj)
}
}else{
let obj = {}
obj.num = 0
obj.price = 0
obj.saleId = item.id
obj.remark = item.remark
obj.xsyId = item.createBy
obj.createByName = item.createByName
dataList.push(obj)
}
let khName = {
name:item.userName,
id:item.userId,
area:item.area,
city:item.city,
address:item.receiveAddress,
province:item.province,
}
uni.setStorageSync('carList1', JSON.stringify(dataList))
uni.setStorageSync('khName', JSON.stringify(khName))
uni.setStorageSync('hangOrder', true)
uni.switchTab({
url: '/pages/inventory/goodsList1'
})
},
//点击切换折叠状态
clickCollapse(item) {
item.isCollapse = !item.isCollapse
},
//查看大图
largeImg(img) {
this.bigImg = img
this.$refs.imgPopup.open()
},
//选择是零售价还是批发价
checkPay(price) {
this.purchasePrice = price;
this.$refs.payDialog.close()
this.temporaryChange()
},
//编辑挂单信息
setDetail(e) {
this.tui.request("/app/sale/updateOrder", "POST", {
saleName: e.detail?'':e,
id: this.list.id,
remark: this.voiceText
}, false, false).then((res) => {
if (res.code == 200) {
this.value = ''
this.voiceText = ''
this.tui.toast("编辑成功")
this.getRegList();
this.$refs.popup.close()
} else {
this.tui.toast(res.message)
}
}).catch((res) => {
this.tui.toast(res)
})
},
//新增挂单弹窗
inputDialogToggle(type, list) {
this.value = ''
this.$refs.payDialog.open()
},
//通过商品id查询商品详细信息
getById(id) {
this.tui.request("/app/product/getById/" + id, "POST", {}, false, true).then((res) => {
if (res.code == 200) {
if(res.result.delFlag ==0 || res.result.purchasePrice==null || res.result.inStorageStatus == 0){
this.tui.toast("请将商品上架或入库后再操作!")
return
}
this.goodsDetail = res.result;
this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId", "POST", {
categoryId: this.goodsDetail.categoryId
}, false, true).then((res1) => {
if (res1.code == 200) {
this.goodsList = []
this.$refs.shopPopup.open('bottom')
if (typeof(res1.result) == 'string') {
let newObj = JSON.parse(res1.result)
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.dataObj.set(newObj[val][i], val)
}
newArr.push({
name: val,
value: valueObj
})
}
this.goodsDetail.attributeList = newArr;
this.goodsDetail.attributeList.forEach((item, index) => {
let specs1 = {
specs: []
}
this.goodsList.push(specs1)
})
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
this.getKCList(id);
},
//库存商品详情
getKCList(id) {
this.tui.request("/app/stock/productCount", "GET", {
productId: id
}, false, true).then((res) => {
if (res.code == 200) {
this.pecsList = res.result
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
//保存已选
saveCheck() {
this.pageOldTemList = this.temporaryList
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
this.goodsList[i].specs = []
for (var m = 0; m < this.goodsDetail.attributeList[i].value.length; m++) {
this.goodsDetail.attributeList[i].value[m].isChecked = false
}
}
},
combination(arr) {
let result = [
[]
]
arr.map(x => {
var res = []
result.map(y => {
x.specs.map(z => {
res.push([...y, z])
})
})
result = res
})
return result;
},
allChange(e){
//监听到输入框改变,给所有的都赋值
if(this.isPlusAndMinus == false){
for(var i=0;i<this.temporaryList.length;i++){
this.temporaryList[i].productCount = Number(e.detail.value)
}
}
this.isPlusAndMinus == false
this.temporaryChange()
},
plusNum(){
this.isPlusAndMinus == true
//监听到点击+的操作,给所有的都+1
for(var i=0;i<this.temporaryList.length;i++){
if(this.temporaryList[i].productCount == undefined){
this.temporaryList[i].productCount = 1
}else{
this.temporaryList[i].productCount++
}
}
this.temporaryChange()
},
minusNum(){
this.isPlusAndMinus == true
//监听到点击-的操作,给所有的都-1
for(var i=0;i<this.temporaryList.length;i++){
this.temporaryList[i].productCount--
}
this.temporaryChange()
},
//清空语音输入的文字
clearText(){
this.voiceText = ''
},
//删除整条商品
delGoods(item, productId) {
let that = this;
this.hangId = item.id;
uni.showModal({
title: "提示",
content: "确定删除此条商品吗?",
success: function(res) {
if (res.confirm) {
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
if (item.saleDetailDTOList[i].productId == productId) {
item.saleDetailDTOList.splice(item.saleDetailDTOList[i], 1)
}
}
that.carList = item.saleDetailDTOList
that.setSaleDetail();
}
}
})
},
//选商品的时候能删除规格
delCarData(index) {
this.temporaryList.splice(index, 1);
this.temporaryChange()
},
//删除商品下的单条规格
delGoodsPrecs(item, index, index1) {
let that = this;
this.hangId = item.id;
uni.showModal({
title: "提示",
content: "确定删除此条规格吗?",
success: function(res) {
if (res.confirm) {
item.saleDetailDTOList[index].stockLogList1.splice(item.saleDetailDTOList[index]
.stockLogList1[index1], 1)
that.carList = item.saleDetailDTOList
that.setSaleDetail();
}
}
})
},
}
}
</script>
<style lang="scss">
page,
.page1 {
background: #FAF7F7;
}
.top {
width: 780rpx;
height: 330rpx;
opacity: 1;
background: linear-gradient(90deg, #6484fa 0%, #66e8ff 100%);
overflow: hidden;
}
.top1 {
width: 780rpx;
height: 390rpx;
opacity: 1;
background: linear-gradient(360deg, #FAF7F7 0%, rgba(255, 255, 255, 0) 100%);
}
.ai-bot {
position: absolute;
top: 200rpx;
right: 40rpx;
width: 90rpx;
height: 110rpx;
background-size: 100% !important;
background: url(https://jewel-shop.oss-cn-beijing.aliyuncs.com/66dc640d9e8f4749a234d9ef2af1b257.png) no-repeat;
}
.hello-box {
position: absolute;
left: 42rpx;
top: 205rpx;
width: 220rpx;
height: 56rpx;
.hello-left {
width: 102rpx;
height: 56rpx;
opacity: 1;
background: #fff;
border-radius: 3px;
text-align: center;
transform: skewX(8deg);
}
.hello-right {
position: absolute;
left: 5px;
bottom: 0rpx;
width: 220rpx;
height: 2px;
opacity: 1;
background: linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, #ffffff 100%);
}
.hello-name {
position: absolute;
left: 118rpx;
top: 0;
width: 400rpx;
height: 55rpx;
font-size: 32rpx;
line-height: 55rpx;
color: white;
overflow: hidden;
}
}
.hello-text {
position: absolute;
top: 275rpx;
left: 50rpx;
color: #fff;
font-size: 28rpx;
}
.content-list {
width: 95%;
height: auto;
background: #fff;
border-radius: 10px;
margin: 0 auto 20rpx;
overflow: hidden;
display: block;
}
.image-box {
width: 120rpx;
height: 170rpx;
display: block;
overflow: hidden;
float: left;
}
.image {
width: 100rpx;
height: 100rpx;
margin: 35rpx 0 0 20rpx;
font-size: 36rpx;
background: #8470FF;
border-radius: 50%;
text-align: center;
line-height: 100rpx;
color: #fff;
}
.content-text {
width: 400rpx;
height: 170rpx;
float: left;
line-height: 50rpx;
padding-left: 30rpx;
}
.text {
color: #747474;
font-size: 28rpx;
}
.content-btn {
position: relative;
width: 190rpx;
height: 170rpx;
float: left;
}
.btn {
width: 100rpx;
height: 50rpx;
background: linear-gradient(90deg, #6691fb 0%, #6ad3fe 100%);
color: #fff;
border-radius: 6px;
text-align: center;
line-height: 50rpx;
font-size: 22rpx;
float: right;
margin: 20rpx 20rpx 0 0;
}
@keyframes blinking {
0% {
opacity: 1;
}
50% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.blink {
position: absolute;
top: 40rpx;
right: 20rpx;
animation: blinking 1s infinite;
}
.bottom-box {
background: rgba(255, 255, 255, 0.3);
width: 100rpx;
height: 100rpx;
border-radius: 10px;
margin: 25rpx;
position: relative;
font-size: 60rpx;
color: #fff;
font-weight: 800;
text-align: center;
line-height: 100rpx;
background: #fff;
overflow: hidden;
float: left;
img {
width: 100%;
height: 100%;
border-radius: 10px;
/* background: #fff; */
// margin-top: -16rpx;
animation: jump 1.5s infinite;
}
@keyframes jump {
0% {
margin-top: 0;
}
50% {
margin-top: -15rpx;
}
100% {
margin-top: 0;
}
}
}
.banner {
height: 150rpx;
display: flex;
margin-top: 20rpx;
}
.banner-left,
.banner-right {
width: 49%;
margin-left: 1%;
margin-right: 2%;
background: linear-gradient(126.07deg, rgba(100, 132, 250, 1) 0%, rgba(102, 232, 255, 1) 100%);
border-radius: 10px;
}
.banner-text {
margin-top: 20rpx;
line-height: 60rpx;
font-size: 36rpx;
color: #fff;
}
.content{
margin-top: 20rpx;
}
.order-collapse-item {
background: #fff;
height: auto;
margin: 250rpx auto 0;
padding: 20rpx;
}
.order-notes {
height: 80rpx;
line-height: 80rpx;
text-overflow: ellipsis;
overflow: hidden;
white-space: pre-wrap;
text-overflow: -o-ellipsis-lastline;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
border-top: 1px solid #eee;
}
.shop-list {
margin: 10rpx 0;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
position: relative;
}
.shop-list:last-child {
border-bottom: none;
}
.order-name {
height: 80rpx;
font-size: 32rpx;
font-weight: bold;
line-height: 80rpx;
img {
height: 32rpx;
width: 32rpx;
float: left;
margin: 24rpx;
}
}
.specs-name {
display: flex;
padding-bottom: 20rpx;
height: 60rpx;
line-height: 60rpx;
}
.del-icon {
position: absolute;
top: 10rpx;
right: 10rpx;
}
.img-popup-content {
width: 500rpx;
height: 500rpx;
}
.popup-content {
align-items: center;
justify-content: center;
padding: 15px;
width: 500rpx;
height: 600rpx;
background-color: #fff;
}
.popup-title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
position: relative;
}
.popup-container {
margin-top: 20rpx;
}
.popup-bottom {
display: flex;
height: 80rpx;
color: #fff;
line-height: 80rpx;
margin-top: 50rpx;
}
.popup-btn {
flex: 1;
text-align: center;
background: linear-gradient(90deg, #FF9797, #FFC1E0);
}
.popup-btn:last-child {
background: linear-gradient(90deg, #60F3FF, #088FEB);
}
.voice-model {
width: 300rpx;
height: 300rpx;
display: flex;
justify-content: center;
flex-flow: column;
position: fixed;
left: 50%;
top:50%;
background: rgba(0, 0, 0, 0.5);
border-radius: 20rpx;
color: #fff;
text-align: center;
margin-left: -150rpx;
z-index: 999;
}
.voice-model img {
width: 200rpx;
height: 200rpx;
margin: 0 auto;
}
.voice-btn{
position: absolute;
bottom: -300rpx;
left: 30%;
width: 200rpx;
height: 200rpx;
background: #eee;
border-radius: 50%;
}
.shop-popup-content {
align-items: center;
justify-content: center;
padding: 15px;
height: 1200rpx;
background-color: #fff;
margin-bottom: 30rpx;
overflow: scroll;
}
.shop-popup-title {
display: flex;
height: 180rpx;
border-bottom: 1px solid #eee;
margin-top: 20rpx;
}
.shop-popup-title-left {
width: 150rpx;
height: 150rpx;
}
.shop-popup-title-right {
width: 400rpx;
margin-left: 30rpx;
}
.shop-popup-title-right-box {
height: 50rpx;
line-height: 50rpx;
}
.shop-checkList {
display: flex;
height: 50rpx;
font-size: 28rpx;
line-height: 50rpx;
margin: 20rpx 0;
}
.shop-checkList-box {
height: 50rpx;
width: 60%;
}
.shop-popup-bottom {
width: 95%;
height: 100rpx;
position: fixed;
bottom: 0;
left: 2.5%;
display: flex;
z-index: 99;
background: #fff;
}
.shop-popup-bottom-left {
width: 50%;
line-height: 80rpx;
}
.shop-popup-bottom-right {
width: 50%;
line-height: 100rpx;
.bottom-btn {
width: 70%;
line-height: 35px;
height: 70rpx;
text-align: center;
color: #fff;
font-size: 28rpx;
margin: 0 auto;
background: linear-gradient(90deg, #60F3FF, #088FEB);
border-radius: 70rpx;
}
}
.shop-popup-container {
width: 100%;
background: #fff;
height: 50rpx;
}
.shop-purchase-price {
display: flex;
line-height: 40px;
height: 80rpx;
width: 95%;
margin: 20rpx auto;
}
.shop-title-fur {
width: 95%;
height: 70rpx;
margin: 0 auto;
}
.shop-name {
font-size: 30rpx;
width: 50%;
float: left;
height: 70rpx;
line-height: 70rpx;
}
.shop-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;
border-radius: 20rpx;
}
.checkedText {
background-color: $u-primary;
color: #fff;
border-radius: 20rpx;
}
}
.shop-popup-title-left img {
width: 150rpx;
height: 150rpx;
}
.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;
}
.noPic{
border-radius: 10px;
width: 150rpx;
height: 150rpx;
// margin: 30rpx 0 0 30rpx;
text-align: center;
line-height: 140rpx;
color: #777;
background: #eee;
}
</style>