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.
 
 
 
 
 

2214 lines
62 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" @tap="goDetail(item.id,item.userId)">
<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 class="text" style="position: absolute;top: 85rpx;right: 20rpx;">操作人:{{item.createByName}}</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,index)" 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 class="btn" @tap.stop="shareHangOrder(item)">
分享
</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">
<view style="width: 80%;float: left;">
<view style="" v-if="items.productSn != null">
【销】{{items.productName}}({{items.productSn}})
</view>
<view style="" v-else>
库存中没有货号为:0001的商品
</view>
<view style="font-size: 30rpx;font-weight: 400;">
单价:{{items.discountAmount || items.wholesalePrice || ""}}
<!-- 数量:{{items.realPrice/items.discountAmount || items.realPrice/items.wholesalePrice}}
总价:{{items.realPrice}} -->
</view>
</view>
<view class="big-img" @tap="largeImg(items.productPicture)"></view>
</view>
<view style="display: flex;height: 60rpx;line-height: 60rpx;text-align: center;border-top: 1px solid #eee;">
<view style="width: 10%;">操作</view>
<view style="width: 60%;">规格</view>
<view style="width: 30%;">数量</view>
</view>
<view class="specs-name" v-for="(itemss,index2) in items.stockLogList1" :key="index2">
<view style="width: 10%;" @tap="delGoodsPrecs(item,index1,index2)">
<uni-icons color="red" type="minus" size="26"></uni-icons>
</view>
<view style="width: 60%;">
{{itemss.attributeList | sliceMsg}}
</view>
<view style="width: 30%;">
{{itemss.productCount}}
</view>
</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>
<u-loadmore :status="status" />
<!-- 查看大图弹出层 -->
<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" @change="yuyinChange">
<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 maxlength="-1" 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" @change="clickClose">
<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;color:#000;">¥{{purchasePrice}}</text>
<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="digit" v-model="purchasePrice" @blur="checkPay(purchasePrice)" placeholder="请输入实际价格" />
</view> -->
<view @tap="saveCheck"
style="position: absolute;top: 10rpx;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>
<view class="suibian" v-for="(itemTag, index1) in items.value" :key="index1"
@tap.stop="attrNameChange(index,itemTag.value,index1) "
:class="itemTag.isChecked ? 'checkedText' : '' " style="position: relative;">
{{itemTag.value}}
<view class="kucun" v-if="itemTag.isKucun"></view>
</view>
</view>
</li>
</ul>
<view style="padding-bottom: 100rpx;">
<view class="shop-checkList" v-if="temporaryList != ''">
<view class="shop-checkList-box" style="width: 69.5%;">
<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>
<view class="zuni-numbox">
<view @tap="minusNum" class="zuni-numbox__minus zuni-numbox-btns" style="background: #f5f5f5;">
<text class="zuni-numbox--text">-</text>
</view>
<input v-model="allChangeNum" @focus="obtainPrice($event,'zongjishu')" @blur="allChange" class="zuni-numbox__value" type="number" />
<view @tap="plusNum" class="zuni-numbox__plus zuni-numbox-btns" style="background: #f5f5f5;">
<text class="zuni-numbox--text">+</text>
</view>
</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;width: 7%;">
<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==null?'无库存':item.productNum}}</text>
</view>
<!-- <uni-number-box max='1000000' min="-10000" v-model="item.productCount" @change="temporaryChange" /> -->
<view class="zuni-numbox">
<view @tap="oneMinusNum(index)" class="zuni-numbox__minus zuni-numbox-btns" style="background: #f5f5f5;">
<text class="zuni-numbox--text">-</text>
</view>
<input v-model="item.productCount" @blur="numChange($event,index)" @focus="obtainPrice($event,'danjishu',index)" class="zuni-numbox__value" type="number" />
<view @tap="onePlusNum(index)" class="zuni-numbox__plus zuni-numbox-btns" style="background: #f5f5f5;">
<text class="zuni-numbox--text">+</text>
</view>
</view>
</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 class="popup-pay-container" style="background: #fff;display: flex;width: 100%;">
<input type="digit" style="height: 100rpx;line-height: 100rpx;color:#000;width: 296rpx;" placeholder="请输入价格"
@input="changePay">
<view style="flex: 1;color: #fff;background: #088FEB;border-radius: 10px;width: 144rpx;"
@tap.stop="checkPay(purchasePrice)">确定</view>
</view>
</view>
</uni-popup>
<!-- 分享确认弹窗 -->
<uni-popup ref="sharePopup" background-color="#fff">
<view class="type-popup">
<view style="height: 120rpx;font-size: 36rpx;font-weight: bold;line-height: 120rpx;text-align: center;">
提示
</view>
<view style="height: 80rpx;font-size: 28rpx;text-align: center;font-weight: bold;">
确认要将此条挂单分享给微信好友吗
</view>
<view
style="font-size:30rpx;width: 100%;height: 90rpx;line-height: 90rpx;text-align: center;border-radius: 0;background: linear-gradient(90deg, #60F3FF, #088FEB);color: #fff;display: flex;position: absolute;bottom: 0;">
<view style="width:50%;" @tap="$refs.sharePopup.close()">取消</view>
<view style="width:50%;">
<button open-type="share" style="background: linear-gradient(90deg, #FF9797, #FFC1E0);color:#fff;border-radius: 0;font-size: 17.7px;">
确认
</button>
</view>
</view>
</view>
</uni-popup>
<view class="mask-model" v-if="isVoice">貌似没有检测到您上次的语音录入信息正在反复识别中</view>
<view style="position: absolute;top: -1500px;z-index: -1;opacity: 0;">
<canvas canvas-id="myCanvas1" style="width: 1515px; height: 1210px;"></canvas>
</view>
</view>
</template>
<script>
var plugin = requirePlugin("WechatSI")
let manager = plugin.getRecordRecognitionManager()
import base from '@/utils/ossUploadFile/base64.js';
export default {
components: {},
data() {
return {
khName:[],
isVoice:false,
regList:[],
pageNumber: 1,
status: 'loadmore',
recordState: false,
voiceText: ' ',
list: [],
linshiPrice:0,
value: '',
isInventory:false,
returnNum: 0,
returnPrice: 0,
temporaryNum: 0,
customPrice: 0, //选择自定义金额
goodsDetail: [],
attrNameList: [],
temporaryList: [],
carList: [],
returnList:new Map(),
specsList: [],
evalue: [],
attributeList: [],
purchasePrice: 0,
zPrice: 0,
zNum: 0,
storageType: 0,
hangId: '',
bigImg: '',
productId:'',
productNum:null,
pageOldTemList: [],
oldTemList: [],
goodsList: [],
newTemList: [],
pecsList: [],
dataObj: new Map(),
yanseList:new Map(),
chimaList:new Map(),
allChangeNum:0,
isPlusAndMinus:false,
shopName:'',
pages:1,
sales: {}
}
},
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.pageNumber = 1;
this.regList = []
this.getRegList()
},
onReachBottom() {
if (this.pageNumber >= this.pages) return;
this.status = 'loading';
this.pageNumber ++
this.getRegList();
},
async onShareAppMessage() {
let shopName = this.sales.shopName== null ? uni.getStorageSync('shopName'):this.sales.shopName
let titleText = shopName +' '+ this.sales.createTime.split(' ')[0]+'\n销售单'
const imageUrl = await this.senrPath()
this.$refs.sharePopup.close()
return {
title:titleText,
imageUrl: imageUrl,
path: '/package1/index/orderDetail?popleType=khName&id=' + this.sales.id + '&shopId=' +uni.getStorageSync('shopId') + '&shopName=' + this.sales.shopName + '&shopOwnerPhone='+ this.shopOwnerPhone + '&mini_program_openid=' + this.mini_program_openid + '&unionid=' + this.unionid +'&official_account_openid='+ this.official_account_openid + '&userId='+ this.sales.userId
}
},
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.pageNumber = 1;
this.regList = []
this.getRegList()
},
onLoad() {
this.shopName = uni.getStorageSync('shopName')
this.initRecord();
},
methods: {
goDetail(id,userId){
uni.navigateTo({
url: '/package1/index/orderDetail?id=' + id +'&userId='+userId
})
},
senrPath(){
return new Promise(async (resolve, reject) => {
let that = this
uni.showLoading({
title:'生成中...'
})
const ctx = uni.createCanvasContext('myCanvas1', this);
//背景图
let imgA = 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/38568f1580bc423698d2a499197a5b44.png';
uni.downloadFile({
url: imgA,
success: (res2) => {
if (res2.statusCode === 200) {
// // 绘制第一张图片
ctx.drawImage(res2.tempFilePath, 0, 0, 1515, 1210);
ctx.draw(true);
// 设置字体样式
ctx.font = 'bold 80px SimSun';
// 设置文字颜色
ctx.fillStyle = '#FF5809';
let beginHeight = 450
if(that.sales.productCount != null && that.sales.productCount != ''){
var textWidth = 350;
// 计算居中位置
beginHeight += 100
// 绘制文字
ctx.fillText('销售', textWidth, beginHeight);
ctx.draw(true)
// 设置字体样式
ctx.font = 'bold 60px SimSun';
// 设置文字颜色
ctx.fillStyle = '#FF5809';
beginHeight+=90
var text = '总件数:'+that.sales.productCount+' 总金额:'+that.sales.totalAmount
// 绘制文字
ctx.fillText(text, textWidth, beginHeight);
ctx.draw(true)
}
if(that.returnNum != null && that.returnNum != ''){
beginHeight+=110
var textWidth = 350;
// 绘制文字
// 设置字体样式
ctx.font = 'bold 80px SimSun';
// 设置文字颜色
ctx.fillStyle = '#FF5809';
ctx.fillText('退货', textWidth, beginHeight);
ctx.draw(true)
beginHeight+=90
// 设置字体样式
ctx.font = 'bold 60px SimSun';
// 设置文字颜色
ctx.fillStyle = '#FF5809';
var text = '总件数:'+that.returnNum+' 总金额:'+that.returnPrice
// 绘制文字
ctx.fillText(text, textWidth, beginHeight);
ctx.draw(true)
}
if(that.sales.realAmount != null){
var textWidth = 350;
beginHeight+=120
// 绘制文字
// 设置字体样式
ctx.font = 'bold 80px SimSun';
// 设置文字颜色
ctx.fillStyle = 'black';
ctx.fillText('本单应收:'+that.sales.realAmount, textWidth, beginHeight);
ctx.draw(true)
}
if(that.sales.alreadyEarn != null){
beginHeight+=100
var textWidth = 350;
// 绘制文字
// 设置字体样式
ctx.font = 'bold 80px SimSun';
// 设置文字颜色
ctx.fillStyle = 'black';
ctx.fillText('本单实收:'+that.sales.alreadyEarn, textWidth, beginHeight);
ctx.draw(true)
beginHeight+=120
}
setTimeout(ress=>{
uni.canvasToTempFilePath({
x: 0,
y: 0,
width: 1515,
height: 1210,
destWidth: 1515,
destHeight: 1210,
canvasId: 'myCanvas1',
success: (res3) => {
uni.hideLoading()
return resolve(res3.tempFilePath)
}
});
},500)
}
}
});
})
},
//挂单列表
getRegList() {
let obj = {
status: "7",
pageVo: {
pageNumber: this.pageNumber,
pageSize: 10
},
fromWhere:2,
shopId:uni.getStorageSync('shopId')
}
this.tui.request("/app/sale/listPages", "POST", obj, false, false).then((res) => {
if (res.code == 200) {
this.status = 'nomore';
for (let i = 0; i < res.result.records.length; i++) {
res.result.records[i].isCollapse = false
}
if (this.pages == 1) {
this.regList = res.result.records;
} else {
this.regList = [...this.regList, ...res.result.records]
}
this.pages = res.result.pages
} 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.pageNumber = 1;
this.regList = []
this.getRegList()
} else {
this.tui.toast(res.message)
}
}).catch((res) => {
this.tui.toast(res)
})
},
//关闭弹出层
close() {
this.$refs.popup.close()
},
//按住语音识别,开始
kaishi() {
if(this.isVoice == false){
this.recordState = true
uni.vibrateShort();
manager.start({
duration: 60000,
lang: "zh_CN"
});
}
},
//松开语音识别,结束
jieshu() {
this.recordState = false
manager.stop()
},
replaceCharAfterNumber(str, charToFind, charToReplace) {
const regex = new RegExp(`\\d${charToFind}`, 'g');
return str.replace(regex, (match) => {
return match.replace(charToFind, charToReplace);
});
},
//语音识别功能初始化
initRecord() {
let that = this;
// 识别结束事件
manager.onStop = (res) => {
if(that.voiceText == ''){
that.voiceText = res.result
}else if(that.voiceText == null){
that.voiceText = res.result
}else{
res.result = this.removeSpacesAndCommas(res.result)
res.result = ' ' + res.result
that.voiceText += res.result
}
}
// 识别错误事件
manager.onError = (res) => {
if(res.retcode == '-30011'){
that.isVoice = true
}
if(res.retcode == '-30004'){
that.isVoice = false
uni.hideToast()
uni.showToast({
title: "未识别到声音信息,请重新录入",
icon: 'none'
})
}
if (res.retcode == '-40001') {
uni.showToast({
title: '使用次数超限制,请联系管理员!',
icon: 'none'
})
}
}
},
//AI挂单,无库存不显示radio,所有颜色所有尺码,无库存太多删除麻烦
invenRadio(){
this.isInventory = !this.isInventory
},
//扫一扫功能
scanCodeAdd(item) {
let that = this;
uni.setStorageSync('hangOrderType','changeGoods')
uni.scanCode({
success: (res) => {
that.hangId = item.id
if(res.scanType == "QR_CODE"){ //二维码
let shopId = base.decode(res.result.split(',')[1])
if(shopId == uni.getStorageSync('shopId').substring('10','12')){
that.productId = base.decode(res.result.split(',')[0])
that.toggle('bottom', base.decode(res.result.split(',')[0]));
if (item.saleDetailDTOList) {
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
that.carList.push(item.saleDetailDTOList[i])
}
}
}else{
setTimeout(res=>{
that.tui.toast('您的店铺中暂无该商品!')
},1000)
}
}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);
}
this.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)
this.evalue.push(name)
}
if (jishuqi == this.goodsList.length) {
for (var i = 0; i < value.length; i++) {
let isTrue = false
for (var m = 0; m < this.temporaryList.length; m++) {
if(this.temporaryList[m].attributeList == value[i]){
isTrue = true
}
}
if(isTrue == false){
this.attributeList = {
attributeList: value[i],
productCount: this.temporaryNum,
productNum: null,
name: this.evalue[i],
price: this.purchasePrice
}
this.temporaryList.push(this.attributeList);
}
}
}
this.$forceUpdate()
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
}
}
}
})
},
//输入商品自定义金额
changePay(e) {
this.purchasePrice = e.detail.value
},
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
},
shareHangOrder(item){
this.tui.request("/app/sale/get/" + item.id, "GET", {
customerId: item.userId
}, false, false).then((res) => {
if (res.code == 200 && res.result != null && res.result != undefined) {
this.sales = res.result.sale
let customer = res.result.customer
this.mini_program_openid = res.result.customer.miniProgramOpenid
this.official_account_openid = res.result.customer.officialAccountOpenid
this.unionid = res.result.customer.unionid
//ai挂单,没有金额,需计算
if(this.sales.aiFlag == '2'){
this.sales.productCount = 0
this.sales.totalAmount = 0
for(let i=0;i<res.result.saleDetailDTOList.length;i++){
if(res.result.saleDetailDTOList[i].discountAmount == null){
if(customer.categoryId != ''){ //有客户价格
let customerCategoryRule = JSON.parse(res.result.saleDetailDTOList[i].customerCategoryRule)
for(let s=0;s<customerCategoryRule.length;s++){
let isCategoryPrice = false
if(customer.categoryId == customerCategoryRule[s].categoryId){
res.result.saleDetailDTOList[i].discountAmount = customerCategoryRule[s].categoryPrice
isCategoryPrice = true
}
if((s+1) == customerCategoryRule.length && isCategoryPrice == false){
res.result.saleDetailDTOList[i].discountAmount =res.result.saleDetailDTOList[i].wholesalePrice
}
}
}else{ //没有客户价格
res.result.saleDetailDTOList[i].discountAmount = res.result.saleDetailDTOList[i].wholesalePrice
}
}
res.result.saleDetailDTOList[i].productCount = 0
for(let m=0;m<res.result.saleDetailDTOList[i].stockLogList1.length;m++){
res.result.saleDetailDTOList[i].productCount += res.result.saleDetailDTOList[i].stockLogList1[m].productCount
}
setTimeout(res1=>{
res.result.saleDetailDTOList[i].realPrice = res.result.saleDetailDTOList[i].productCount * res.result.saleDetailDTOList[i].discountAmount
this.sales.totalAmount += res.result.saleDetailDTOList[i].realPrice
this.sales.productCount += res.result.saleDetailDTOList[i].productCount
},100)
}
}
this.getReturnOrder1(item.id)
}
}).catch((res) => {})
this.$refs.sharePopup.open()
},
//退款接口
async getReturnOrder1(id) {
let that = this;
await this.tui.request("/app/return/list", "post", {
remark: 3,
saleId: id
}, false, false).then((res) => {
if (res.code == 200 && res.result != null && res.result != undefined) {
if (res.result != '') {
this.returnPrice = 0
this.returnNum = 0
res.result.forEach(item => {
that.returnPrice += item.totalAmount
that.returnNum += item.productCount
})
}
} else {
this.tui.toast(res.message)
}
})
},
clickClose(){
this.evalue = []
this.allChangeNum = 0
},
//弹窗选择规格后,点击弹窗中选好了按钮
temporaryCheck() {
this.evalue = []
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.pageNumber = 1;
this.regList = []
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: '/package1/index/peopleList?popleType=khName'
})
}else{
uni.setStorageSync('hangOrderType','scanCode')
uni.navigateTo({
url: '/package1/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.pageNumber = 1;
that.regList = []
that.getRegList()
uni.showToast({
title:"删除成功",
icon: 'none'
})
} else {
uni.showToast({
title:"删除失败",
icon: 'none'
})
}
}).catch((res) => {})
}
}
})
},
async 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{
await this.getReturnOrder(item)
}
},
async getReturnOrder(id) {
let that = this;
await this.tui.request("/app/return/list", "post", {
remark: 3,
saleId: id.id
}, false, false).then((res) => {
if (res.code == 200 && res.result != null && res.result != undefined) {
if (res.result != '') {
if(res.result == []){
this.$nextTick(() => {
uni.showModal({
title: "提示",
content: '确认去开单吗?',
success: function(res) {
if (res.confirm) {
that.goSaleGoods(id)
}else{
that.returnList = new Map()
}
}
})
})
}else{
res.result.forEach(item => {
this.tui.request("/app/return/get/" + item.id, "GET", null, false,false).then((res) => {
if (res.code == 200 && res.result != null && res.result != undefined) {
for(let i=0;i<res.result.saleDetailDTOList.length;i++){
res.result.saleDetailDTOList[i].returnPrice = res.result.saleDetailDTOList[i].discountAmount
res.result.saleDetailDTOList[i].stockLogList = new Map()
that.returnList.set(res.result.saleDetailDTOList[i].productId,res.result.saleDetailDTOList[i])
for(let m=0;m<res.result.saleDetailDTOList[i].stockLogList1.length;m++){
res.result.saleDetailDTOList[i].stockLogList1[m].productCount = 0-res.result.saleDetailDTOList[i].stockLogList1[m].productCount
that.returnList.get(res.result.saleDetailDTOList[i].productId).stockLogList.set(res.result.saleDetailDTOList[i].stockLogList1[m].attributeList,res.result.saleDetailDTOList[i].stockLogList1[m])
}
}
this.$nextTick(() => {
uni.showModal({
title: "提示",
content: '确认去开单吗?',
success: function(res) {
if (res.confirm) {
that.goSaleGoods(id)
}else{
that.returnList = new Map()
}
}
})
})
}
}).catch((res) => {})
})
}
}else{
this.$nextTick(() => {
uni.showModal({
title: "提示",
content: '确认去开单吗?',
success: function(res) {
if (res.confirm) {
that.goSaleGoods(id)
}else{
that.returnList = new Map()
}
}
})
})
}
} else {
this.$nextTick(() => {
uni.showModal({
title: "提示",
content: '确认去开单吗?',
success: function(res) {
if (res.confirm) {
that.goSaleGoods(id)
}else{
that.returnList = new Map()
}
}
})
})
this.tui.toast(res.message)
}
})
},
sliceMsg(val) {
var name = ''
if (typeof(val) == 'string') {
let newObj = JSON.parse(val)
for (let as in newObj) {
name += newObj[as] + '/'
}
}
return name;
},
//把unitPrice变成折前价,用于去开单的时候切换折扣
getUnitPrice(item,items){
if(item.discount != 10){
if(item.discount == null || item.discount == 0 || item.discount ==undefined){
return items.discountAmount
}else{
return ((items.discountAmount * 10000) / (item.discount * 100) / 10).toFixed(2)
}
}else if(items.discount!= 10){
if(items.discount == null || items.discount == 0 || items.discount ==undefined){
return items.discountAmount
}else{
return ((items.discountAmount * 10000) / (items.discount * 100) / 10).toFixed(2)
}
}else{
return items.discountAmount || items.wholesalePrice
}
},
//带参数跳转到开单页
goSaleGoods(item) {
let dataList = []
if(item.saleDetailDTOList == null || item.saleDetailDTOList == ''){
item.saleDetailDTOList = []
}
this.returnList.forEach(function(value, key) {
item.saleDetailDTOList.push(value)
})
item.discount = item.discount==null?10:item.discount
if (item.saleDetailDTOList.length>0) {
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
let obj = {}
let attrMap = new Map()
let newSaleDetailDTOList = []
let num = 0
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)
newSaleDetailDTOList[hasCount].productCount = Number(newSaleDetailDTOList[hasCount]
.productCount) + Number(item.saleDetailDTOList[i].stockLogList1[m].productCount)
} else {
item.saleDetailDTOList[i].stockLogList1[m].name = this.sliceMsg(item.saleDetailDTOList[i]
.stockLogList1[m].attributeList)
newSaleDetailDTOList.push(item.saleDetailDTOList[i].stockLogList1[m])
attrMap.set(item.saleDetailDTOList[i].stockLogList1[m].attributeList, num)
num++
}
}
obj.attrId = item.saleDetailDTOList[i].attrId
obj.saleDetailQueryDTO = newSaleDetailDTOList
obj.num = 0
obj.buyCount = item.saleDetailDTOList[i].buyCount
obj.customerCategoryRule = item.saleDetailDTOList[i].customerCategoryRule != null ?JSON.parse(item.saleDetailDTOList[i].customerCategoryRule):null
obj.discount = item.saleDetailDTOList[i].discount
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 = this.getUnitPrice(item,item.saleDetailDTOList[i])
obj.discountAmount = item.saleDetailDTOList[i].discountAmount
obj.productName = item.saleDetailDTOList[i].productName
if(item.saleDetailDTOList[i].productPicture != null && item.saleDetailDTOList[i].productPicture != ''){
obj.productPicture = item.saleDetailDTOList[i].productPicture + '?time=' + new Date().getTime()
}else{
obj.productPicture = ""
}
obj.productSn = item.saleDetailDTOList[i].productSn
obj.wholesalePrice = item.saleDetailDTOList[i].wholesalePrice
obj.returnPrice = item.saleDetailDTOList[i].returnPrice
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)
}
setTimeout(res11=>{
this.tui.request("/app/debt/selectByUserId", "post", {
shopId:uni.getStorageSync('shopId'),
userId:item.userId
}, false, true).then((res) => {
if (res.code == 200) {
this.returnList = new Map()
res.result.name = res.result.userName
res.result.id = res.result.userId
res.result.noEarn = res.result.amountOwed
uni.setStorageSync('khName', JSON.stringify(res.result))
uni.setStorageSync('carList1', JSON.stringify(dataList))
uni.setStorageSync('discountAll', item.discount != null ?item.discount:10)
uni.setStorageSync('hangOrder', true)
let windowWidth = '1'
if(uni.getStorageSync('shopName').indexOf('杰娜世家') != -1){
windowWidth = '0'
}
if(windowWidth == '1'){
uni.switchTab({
url: '/pages/inventory/goodsList1'
})
}else{
uni.navigateTo({
url: '/package2/inventory/goodsList1HENG'
})
}
}
})
},500)
},
//点击切换折叠状态
clickCollapse(item,index) {
item.isCollapse = !item.isCollapse
this.getReturnOrders(item.id,index)
},
//退款接口
async getReturnOrders(id,index) {
let that = this;
this.regList[index].returnList = []
await this.tui.request("/app/return/list", "post", {
remark: 3,
saleId: id
}, false, false).then((res1) => {
if (res1.code == 200 && res1.result != null && res1.result != undefined) {
if (res1.result != '') {
this.inventoryList = res1.result
this.inventoryList.forEach(item => {
this.tui.request("/app/return/get/" + item.id, "GET", null, false,
false).then((res) => {
if (res.code == 200 && res.result != null && res.result !=
undefined) {
this.regList[index].returnList.push(res.result.saleDetailDTOList)
}
}).catch((res) => {})
})
}
} else {
this.tui.toast(res.message)
}
})
},
//查看大图
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查询商品详细信息
async getById(id) {
this.temporaryList = []
await 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("请将商品上架或入库后再操作!")
}else{
this.goodsDetail = res.result;
this.purchasePrice = this.goodsDetail.wholesalePrice
this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId", "POST", {
categoryId: this.goodsDetail.attrId
}, false, true).then((res1) => {
if (res1.code == 200) {
this.goodsList = []
this.$refs.shopPopup.open('bottom')
if (typeof(res1.result.attributeAndValue) == 'string') {
let newObj = JSON.parse(res1.result.attributeAndValue)
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)
})
}
this.getKCList(res1.result.stock);
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
//库存商品详情
getKCList(list) {
this.yanseList = new Map()
this.chimaList = new Map()
this.pecsList = list
for(let i=0;i<list.length;i++){
let attributeList = JSON.parse(list[i].attributeList)
Object.keys(attributeList).forEach(key => {
if(key == '颜色'){
if(this.yanseList.has(attributeList[key]) != true){
this.yanseList.set(attributeList[key],attributeList[key])
}
}else{
if(this.chimaList.has(attributeList[key]) != true){
this.chimaList.set(attributeList[key],attributeList[key])
}
}
})
}
for(let i=0;i<this.goodsDetail.attributeList[0].value.length;i++){ //颜色
if(this.yanseList.has(this.goodsDetail.attributeList[0].value[i].value) == true){
this.goodsDetail.attributeList[0].value[i].isKucun = true
}
}
for(let i=0;i<this.goodsDetail.attributeList[1].value.length;i++){ //尺码
if(this.chimaList.has(this.goodsDetail.attributeList[1].value[i].value) == true){
this.goodsDetail.attributeList[1].value[i].isKucun = true
}
}
},
//保存已选
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;
},
obtainPrice(e,type,num){
this.linshiPrice = e.target.value
if(type=='zongjishu'){
this.allChangeNum = ''
}else if(type=='danjishu'){
this.temporaryList[num].productCount = ''
this.$forceUpdate()
}
},
numChange(e,index){
if(this.linshiPrice == e.target.value){
this.temporaryList[index].productCount = Number(e.target.value)
}else{
if(e.detail.value == ''){
this.temporaryList[index].productCount = Number(this.linshiPrice)
}else if(e.detail.value == 0){
this.temporaryList[index].productCount = 0
}else{
this.temporaryList[index].productCount = Number(e.detail.value);
}
this.$forceUpdate()
}
this.temporaryChange()
},
yuyinChange(){
this.isVoice = false
},
async oneMinusNum(index,index1){
let that = this;
this.carList.get(index).productCount = 0
this.carList.get(index).returnCount = 0
this.carList.get(index).stockLogList.get(index1).productCount --
await this.carList.get(index).stockLogList.forEach(function(value, key) {
if(value.productCount < 0){
that.carList.get(index).returnCount = that.carList.get(index).returnCount + Math.abs(value.productCount)
}else{
that.carList.get(index).productCount = that.carList.get(index).productCount + value.productCount
}
})
await this.$nextTick(()=>{
// if (that.discountType != 0) { //单品折扣
that.carList.get(index).price = that.carList.get(index).productCount * that.carList
.get(index).discountAmount
// }
})
this.$forceUpdate()
this.getAllPrice()
},
onePlusNum(index,index1){
let that = this;
this.carList.get(index).productCount = 0
this.carList.get(index).returnCount = 0
this.carList.get(index).stockLogList.get(index1).productCount ++
this.carList.get(index).stockLogList.forEach(function(value, key) {
if(value.productCount < 0){
that.carList.get(index).returnCount = that.carList.get(index).returnCount + Math.abs(value.productCount)
}else{
that.carList.get(index).productCount = that.carList.get(index).productCount + value.productCount
}
})
this.$nextTick(()=>{
// if (that.discountType != 0) { //单品折扣
that.carList.get(index).price = that.carList.get(index).productCount * that.carList
.get(index).discountAmount
// }
})
this.getAllPrice()
},
allChange(e){
if(this.linshiPrice == e.target.value){
this.allChangeNum = e.target.value
}else{
if(e.target.value == ''){
this.allChangeNum = this.linshiPrice
}else{
this.allChangeNum = e.target.value
}
}
//监听到输入框改变,给所有的都赋值
if(this.isPlusAndMinus == false){
for(var i=0;i<this.temporaryList.length;i++){
if(this.evalue.length == 0){
this.temporaryList[i].productCount = Number(this.allChangeNum)
}else{
for(var j=0;j<this.evalue.length;j++){
if(this.evalue[j] == this.temporaryList[i].name){
this.temporaryList[i].productCount = Number(this.allChangeNum)
}
}
}
}
}
this.isPlusAndMinus == false
this.temporaryChange()
},
plusNum(){
this.isPlusAndMinus == true
//监听到点击+的操作给所有的都+1
for(var i=0;i<this.temporaryList.length;i++){
if(this.evalue.length == 0){
if(this.temporaryList[i].productCount == undefined){
this.temporaryList[i].productCount = 1
}else{
this.temporaryList[i].productCount++
}
}else{
for(var j=0;j<this.evalue.length;j++){
if(this.evalue[j] == this.temporaryList[i].name){
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++){
if(this.evalue.length == 0){
this.temporaryList[i].productCount--
}else{
for(var j=0;j<this.evalue.length;j++){
if(this.evalue[j] == this.temporaryList[i].name){
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(index1, 1)
that.carList = item.saleDetailDTOList
that.setSaleDetail();
}
}
})
},
}
}
</script>
<style lang="scss">
page,
.page1 {
background: #FAF7F7;
font-size: 28rpx;
}
.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;
position: relative;
}
.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: 5px solid #eee;
position: relative;
}
.shop-list:last-child {
border-bottom: none;
}
.order-name {
height: 160rpx;
font-size: 32rpx;
font-weight: bold;
line-height: 80rpx;
img {
height: 32rpx;
width: 32rpx;
margin: 24rpx;
}
}
.specs-name {
display: flex;
padding-bottom: 20rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
}
.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: 50rpx;
margin: 0 auto;
}
.shop-name {
font-size: 30rpx;
width: 50%;
float: left;
height: 50rpx;
line-height: 70rpx;
}
.shop-attrs {
.suibian {
display: inline-block;
border: 1px solid #5fd9ee;
margin: 20rpx;
margin-bottom: 0;
margin-left: 0;
background-color: #fff;
color: #5fd9ee;
padding: 0 10px;
min-width: 100rpx;
line-height: 35px;
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;
}
.big-img{
width: 50rpx;
height: 50rpx;
float: left;
background: url(https://jewel-shop.oss-cn-beijing.aliyuncs.com/6b5ab32ff93a4c51b90e562e0b22e850.png);
background-repeat: no-repeat;
background-size: 100%;
margin: 7px;
}
.kucun{
background: url(https://jewel-shop.oss-cn-beijing.aliyuncs.com/9428d632981647728829da336a1d24b3.png) no-repeat;
width: 50rpx;
height: 25rpx;
position: absolute;
top: -14rpx;
right: -15rpx;
background-size: 100%;
}
.zuni-numbox {
height: 60rpx;
display: flex;
flex-direction: row;
}
.zuni-numbox-btns {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
padding: 0 8px;
cursor: pointer;
}
.zuni-numbox__value {
margin: 0 2px;
width: 40px;
text-align: center;
font-size: 20px;
line-height: 30px;
height: 60rpx;
border-left-width: 0;
border-right-width: 0;
}
.zuni-numbox--text {
line-height: 20px;
font-size: 32px;
font-weight: 300;
}
.zuni-numbox .zuni-numbox--disabled {
color: #c0c0c0 !important;
cursor: not-allowed;
}
.mask-model{
width: 60%;
height: 100rpx;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
text-align: center;
background: rgba(0,0,0,0.7);
color: #eee;
padding: 5px;
border-radius: 5px;
z-index: 99;
}
.type-popup {
width: 500rpx;
height: 360rpx;
background: #fff;
border-radius: 10px;
position: relative;
border-radius: 10px;
}
</style>