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.
9222 lines
292 KiB
9222 lines
292 KiB
<!-- 新增库存页 -->
|
|
<template>
|
|
<view class="page1">
|
|
<!-- <view class="content"> -->
|
|
<view class="content-box" style="z-index: 98;width: 100%;margin-bottom: 0;">
|
|
<view class="content-list" @tap="goPopleList('gysName')">
|
|
<view class="list-name">供应商</view>
|
|
<view class="list-val">
|
|
<input type="text" placeholder="请选择供应商" disabled
|
|
style="border-bottom: 1px solid #fff;padding-left: 100rpx;" :value="khName.consigneeName">
|
|
<uni-icons type="right" size="16" style="margin-left: 80rpx;line-height: 80rpx;"></uni-icons>
|
|
</view>
|
|
</view>
|
|
<view class="content-list">
|
|
<view class="list-name">生成货号</view>
|
|
<view class="list-val" style="width:560rpx;display: flex;">
|
|
<radio-group style="display: flex;padding-left: 100rpx;">
|
|
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in isGenerateSn"
|
|
:key="item.value" style="margin-right:0">
|
|
<view>
|
|
<radio :value="item.value" @tap.stop="isChange(index)"
|
|
:checked="index === isGenerateSnRadio" />
|
|
</view>
|
|
<view style="width: 100rpx;">{{item.name}}</view>
|
|
</label>
|
|
</radio-group>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="isGenerateSnRadio == 0">
|
|
<view class="list-name">货号规则</view>
|
|
<uni-data-select class="uni-data-select" :clear="false" :delItem="true" :addItem="true"
|
|
:localdata="snList" v-model="snName" placeholder="请选择货号规则" @change='changeSn' @addSn='addSn'
|
|
@delItemSn='delItemSn'></uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view class="scroll-content" style="padding-bottom: 100px;">
|
|
|
|
<view class="content-box" style="margin-bottom: 0;">
|
|
<view class="shop-box" style="border-top:10rpx solid #eee;" v-for="(value,key) in Array.from(carList)"
|
|
:key="key">
|
|
<view class="shop-name">
|
|
<view class="new-logo" v-if="value[1].isNew">新</view>
|
|
<view class="u-upload"
|
|
v-if="(value[1].productPicture == '' || value[1].productPicture == undefined) && value[1].isNew == true"
|
|
@tap="uploadFilePromise(value)"></view>
|
|
<view class="u-upload"
|
|
v-if="value[1].productPicture != '' && value[1].productPicture != undefined && value[1].isNew == true"
|
|
@longpress="uploadFilePromise(value)" @tap="getZhuBigImage(value[1].productPicture)">
|
|
|
|
</view>
|
|
<view class="" style="width: 140rpx;height: 280rpx;margin: 30rpx 0 0 30rpx;">
|
|
<view @longpress="uploadFilePromise(value)"
|
|
v-if="value[1].isNew != true || (value[1].isNew == true && value[1].productPicture != '' && value[1].productPicture != undefined && value[1].productPicture != null)"
|
|
style="position: absolute;top: 130rpx;left: 31rpx;color: #fff;background: red;width: 140rpx;height: 40rpx;font-size: 22rpx;text-align: center;line-height: 40rpx;border-radius: 5px;">
|
|
长按编辑
|
|
</view>
|
|
<img @tap="getZhuBigImage(value[1].productPicture)" @longpress="uploadFilePromise(value)"
|
|
v-if="value[1].productPicture !=null && value[1].productPicture !=''" class="img-radius"
|
|
style="width: 140rpx;height: 140rpx;display: block;overflow: hidden;"
|
|
:src="value[1].productPicture" alt="">
|
|
|
|
<view v-else @longpress="uploadFilePromise(value)"
|
|
style="width: 100%;height: 140rpx;border-radius: 10px;border: 1px solid #eee;line-height: 140rpx;text-align: center;">
|
|
<text v-if="value[1].isNew != true">暂无图片</text>
|
|
<uni-icons v-if="value[1].isNew" type='plusempty' size='26'></uni-icons>
|
|
</view>
|
|
<view
|
|
style="width: 140rpx;height:34rpx;line-height: 34rpx;display: flex;margin-top: 20rpx;">
|
|
<view @tap.stop="delShop(value[0])" style="background:#088FEB" class="left-btn">
|
|
删除
|
|
</view>
|
|
<view @tap="toggle('mergePopup',value[0])" class="left-btn" style="margin-left: 20rpx;">
|
|
合并
|
|
</view>
|
|
</view>
|
|
<view class="one-goods" @tap="pictureAdd(value[0])">
|
|
上传多图
|
|
<view class="jiaobiao" v-if="value[1].productPictures != ''">
|
|
{{value[1].productPictures.length}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="shop-productName">
|
|
<view
|
|
style="position: absolute;top: 20rpx;right: 0;border: 1px solid #eee;width: 76rpx;height: 56rpx;line-height: 56rpx;border-radius: 5px;padding: 0 5rpx;color: #777;font-size: 26rpx;">
|
|
<uni-icons type="closeempty" size=""></uni-icons>
|
|
<text>{{value[1].productCount}}</text>
|
|
</view>
|
|
<view style="display: flex;height: 55rpx;line-height: 55rpx;">
|
|
品名:<input type="text" v-if="value[1].isNew" :value="value[1].productName"
|
|
@blur="getName($event,value[0])"
|
|
style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 318rpx;padding-left: 20rpx;">
|
|
<input type="text" v-else :value="value[1].productName" @blur="getName($event,value[0])"
|
|
style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 318rpx;padding-left: 20rpx;">
|
|
</view>
|
|
<view style="display: flex;height: 55rpx;line-height: 55rpx;">
|
|
货号:<input type="text" v-if="value[1].isNew" @input="sninput($event,value[0])"
|
|
@blur="getSnIsRepeat($event,value[0])" v-model="carList.get(value[0]).productSn"
|
|
style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 274rpx;padding-left: 20rpx;">
|
|
<input type="text" v-else disabled v-model="value[1].productSn"
|
|
style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 318rpx;padding-left: 20rpx;">
|
|
<uni-icons type="refresh" color="#777" size='25' v-if="value[1].isNew"
|
|
@tap="generateSn(value[0])"></uni-icons>
|
|
</view>
|
|
<view style="display: flex;height: 55rpx;line-height: 55rpx;" v-if="value[1].isNew">
|
|
分类: <text
|
|
style="color: #777;padding-left: 20rpx;">{{value[1].categoryName==null?'':value[1].categoryName}}</text>
|
|
<uni-icons type="compose" color="#777" size='25'
|
|
@tap="toggle('typePopup',value[0])"></uni-icons>
|
|
</view>
|
|
<view v-if='userType==0' style="display: flex;height: 55rpx;line-height: 55rpx;">
|
|
单价:<input type="digit" v-model="value[1].purchasePrice"
|
|
@blur="clickCollapse($event,value[0])"
|
|
@focus="obtainPrice($event,'danjia',value[0])"
|
|
style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 300rpx;padding-left: 20rpx;">
|
|
</view>
|
|
<view style="display: flex;height: 55rpx;line-height: 55rpx;">
|
|
批发价: <input type="digit" @blur="PriceAndWho($event,value[0],'pi')"
|
|
@focus="obtainPrice($event,'pifa',value[0])" v-model="value[1].wholesalePrice"
|
|
style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 100rpx;padding-left: 20rpx;">
|
|
零售价:<input type="digit" @blur="PriceAndWho($event,value[0])"
|
|
@focus="obtainPrice($event,'lingshou',value[0])" v-model="value[1].lsprice"
|
|
style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 100rpx;padding-left: 20rpx;">
|
|
</view>
|
|
<view @tap="addCustomPrice(value[0])" v-if="customerCategoryList != null"
|
|
style="height: 54rpx;width: 140rpx;background: #088FEB;color: #fff;border-radius: 5px;text-align: center;position: absolute;top: 99rpx;right: 0px;line-height: 54rpx;">
|
|
客户价格
|
|
</view>
|
|
<view @tap="toggle('oneGoods',value[0])"
|
|
style="height: 54rpx;width: 140rpx;background: #088FEB;color: #fff;border-radius: 5px;text-align: center;position: absolute;top: 170rpx;right: 0px;line-height: 54rpx;">
|
|
语音录入
|
|
</view>
|
|
<view @tap="AiAddSpec(value[1])"
|
|
style="height: 54rpx;width: 140rpx;background: #088FEB;color: #fff;border-radius: 5px;text-align: center;position: absolute;top: 240rpx;right: 0px;line-height: 54rpx;">
|
|
添加规格
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="shop-type">
|
|
<view class="shop-checkList" v-if="value[1].stockLogList !=''">
|
|
<view class="shop-checkList-box" style="width: 67%;">
|
|
<text
|
|
style="text-align:center;width: 400rpx;display: inline-block;font-size: 30rpx;font-weight: bold;padding-left: 40rpx;">
|
|
规格
|
|
</text>
|
|
<text
|
|
style="font-size: 30rpx;color: #000;font-weight: bold;width: 60rpx;display: inline-block;text-align: center;">
|
|
库存
|
|
</text>
|
|
</view>
|
|
<view
|
|
style="font-size: 30rpx;color: #000;font-weight: bold;width: 152rpx;display: inline-block;text-align: right;">
|
|
数量
|
|
</view>
|
|
</view>
|
|
<view class="" v-for="(values,keys) in Array.from(value[1].stockLogList)" :key="keys"
|
|
:id="values[1].uuid">
|
|
<view class="shop-collapse">
|
|
<view @tap.stop="delShopSpec(value[0],values[0])">
|
|
<uni-icons color="red" type="minus" size="26"></uni-icons>
|
|
</view>
|
|
<text @tap="checkSpec('颜色',value[0],values[0],numData(values[0])[0])">
|
|
{{numData(values[0])[0]}}
|
|
</text>
|
|
<text @tap="checkSpec('尺码',value[0],values[0],numData(values[0])[1])">
|
|
{{numData(values[0])[1]}}
|
|
</text>
|
|
<text style="width: 25%;font-size: 22rpx;color:red"
|
|
v-if="values[1].productNum == null || values[1].productNum === '' || values[1].productNum == undefined">
|
|
无库存
|
|
</text>
|
|
<text style="width: 25%;font-size: 22rpx;"
|
|
v-if="values[1].productNum != null && values[1].productNum !== ''">
|
|
{{values[1].productNum}}
|
|
</text>
|
|
<!-- <text style="color: red;">单价:¥{{item.price}}</text> -->
|
|
<view style="text-align: left;padding-left: 10rpx;width:40%;display: flex;">
|
|
<!-- <uni-number-box max="100000" style="margin-top:16rpx;"
|
|
v-model="values[1].productCount"
|
|
@change="GoodsNumChange($event,value,values[0])" /> -->
|
|
<view class="zuni-numbox">
|
|
<view @tap="oneMinusNum(value[0],values[0])"
|
|
class="zuni-numbox__minus zuni-numbox-btns" style="background: #f5f5f5;">
|
|
<text class="zuni-numbox--text">-</text>
|
|
</view>
|
|
<input v-model="values[1].productCount"
|
|
@blur="mapnumChange($event,value[0],values[0])"
|
|
@focus="obtainPrice($event,'mapdanjishu',value[0],values[0])"
|
|
class="zuni-numbox__value" type="number" />
|
|
<view @tap="onePlusNum(value[0],values[0])"
|
|
class="zuni-numbox__plus zuni-numbox-btns" style="background: #f5f5f5;">
|
|
<text class="zuni-numbox--text">+</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="shop-box"
|
|
style="border-bottom: 1px solid #eee;border-top: 1px solid #eee;margin-bottom: 20rpx;">
|
|
<u-grid :col="4" border>
|
|
<u-grid-item index="add" @tap.stop="scanCodeAdd">
|
|
<u-icon name="scan" size="25"></u-icon>
|
|
<text>扫一扫</text>
|
|
</u-grid-item>
|
|
<u-grid-item index="add" @tap.stop="pictureAdd('')">
|
|
<u-icon name="photo" size="25"></u-icon>
|
|
<text>图片添加</text>
|
|
</u-grid-item>
|
|
<u-grid-item @tap.stop="isSnList('')">
|
|
<u-icon name="plus" size="25"></u-icon>
|
|
<text>新增商品</text>
|
|
</u-grid-item>
|
|
<u-grid-item @tap.stop="goodsAdd">
|
|
<u-icon name="tags" size="25"></u-icon>
|
|
<text>选库存</text>
|
|
</u-grid-item>
|
|
</u-grid>
|
|
</view>
|
|
<view style="height: 150rpx;width: 100%;display: flex;position: relative;" @tap="toggle('center',item)">
|
|
<view style="width: 70rpx;height: 70rpx;margin: 40rpx;display: block;overflow: hidden;">
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/27e2655fe19f454d93970f968d91fbef.png"
|
|
alt="" style="width: 100%;height: 100%;" />
|
|
</view>
|
|
<view style="padding-left: 11rpx;">
|
|
<view style="height: 80rpx;font-size: 30rpx;font-weight: bold;line-height: 80rpx;">
|
|
AI语音入库
|
|
</view>
|
|
<view>
|
|
<radio @tap.stop="voiceGetOne" :checked="voiceGetOneData" />
|
|
<text>补货-根据货号模糊搜索</text>
|
|
</view>
|
|
<view @tap.stop="toggle('voiceBottom',item)"
|
|
style="padding: 10rpx 20rpx;display: inline-block;background: #088FEB;border-radius: 7px;color: #fff;position: absolute;top: 20rpx;right: 20rpx;">
|
|
上传提示图
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="content-box" style="margin-bottom:110rpx;">
|
|
<view class="price-box-list" style="margin-top:10rpx;">
|
|
<view class="price-box" v-if="userType == 0">
|
|
<view style="flex: 1;text-align: left;padding-left: 20rpx;">
|
|
供应商:{{khName.consigneeName?khName.consigneeName:''}}
|
|
</view>
|
|
<view v-if="zhiqianqiankuan >= 0" style="flex: 1;text-align: right;padding-right: 20rpx;">
|
|
之前欠款:{{zhiqianqiankuan}}
|
|
</view>
|
|
<view v-if="zhiqianqiankuan < 0" style="flex: 1;text-align: right;padding-right: 20rpx;">
|
|
客户余额:{{Math.abs(zhiqianqiankuan)}}
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="userType == 0">
|
|
<view class="list-name">应付金额</view>
|
|
<view class="list-val">
|
|
<input type="digit" placeholder="请输入应付金额" v-model="shouldPay"
|
|
@focus="obtainPrice($event,'shouldPay')" @blur="changessPrice($event)">
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="userType == 0">
|
|
<view class="list-name">已付金额</view>
|
|
<view class="list-val">
|
|
<input type="digit" placeholder="请输入已付金额" v-model="alreadyPay"
|
|
@focus="obtainPrice($event,'alreadyPay')" @blur="changePay($event)">
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="yuedikou != 0 && userType == 0">
|
|
<view class="list-name">余额抵扣</view>
|
|
<view class="list-val">
|
|
<input type="digit" v-model="yuedikou" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="zhiqianqiankuan > 0 && userType == 0">
|
|
<view class="list-name">累计欠款</view>
|
|
<view class="list-val">
|
|
<input type="digit" v-model="leijiqiankuan" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="leijiqiankuan < 0 && userType == 0">
|
|
<view class="list-name">累计余额</view>
|
|
<view class="list-val">
|
|
<input type="digit" v-model="Math.abs(leijiqiankuan)" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="noPay >= 0 && userType == 0">
|
|
<view class="list-name">本次欠款</view>
|
|
<view class="list-val">
|
|
<input type="digit" v-model="noPay" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="noPay < 0 && userType == 0">
|
|
<view class="list-name">本次余额</view>
|
|
<view class="list-val">
|
|
<input type="digit" v-model="Math.abs(noPay)" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="content-list">
|
|
<view class="list-name">其他费用</view>
|
|
<view class="list-val">
|
|
<input type="digit" v-model="otherPay">
|
|
</view>
|
|
</view>
|
|
<view class="content-list" style="height: 200rpx;">
|
|
<view class="list-name">备注</view>
|
|
<view class="">
|
|
<textarea maxlength="-1" v-model="remark" />
|
|
</view>
|
|
</view>
|
|
<view class="content-list" style="height: 100rpx;padding-top: 10rpx;">
|
|
<view class="list-name">入库时间</view>
|
|
<uni-datetime-picker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- </view> -->
|
|
<view class="bottom-box">
|
|
<view class="bottom-left">
|
|
<text>合计:{{totalAmount}}</text>
|
|
<text style="color: #ffa200;" v-if="userType == 0">¥{{shouldPay}}</text>
|
|
</view>
|
|
<view class="bottom-right">
|
|
<view class="bottom-btn" @tap='inventorySubmit'>入库</view>
|
|
</view>
|
|
</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 == undefined || goodsDetail.productName == null)?'':goodsDetail.productName}}
|
|
</view>
|
|
<view class="shop-popup-title-right-box">{{goodsDetail.productSn}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="shop-popup-container" style="position: relative;">
|
|
<view @tap="saveCheck"
|
|
style="position: absolute;top: 10rpx;right: 20rpx;color: #088FEB;text-decoration: underline;z-index: 99;">
|
|
保存已选
|
|
</view>
|
|
<ul style="border-top:20rpx;">
|
|
<li v-for="(items,index) in goodsDetail.attributeList" :key="index"
|
|
style="position: relative;" v-if="goodsDetail.isNew != true">
|
|
<view class="shop-title-fur">
|
|
<view class="shop-title-name">{{items.name}}</view>
|
|
</view>
|
|
<view @tap="getScanCodeCategroyId(items.name)"
|
|
style="position: absolute;top: 18rpx;left: 100rpx;color: #088FEB;text-decoration: underline;font-size: 24rpx;">
|
|
新增{{items.name}}
|
|
</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>
|
|
<li v-for="(items,index) in goodsDetail.attributeList" :key="index"
|
|
style="position: relative;" v-if="goodsDetail.isNew == true">
|
|
<view class="shop-title-fur">
|
|
<view class="shop-title-name">{{items.name}}</view>
|
|
</view>
|
|
<view @tap="getScanCodeCategroyId(items.name)"
|
|
style="position: absolute;top: 18rpx;left: 100rpx;color: #088FEB;text-decoration: underline;font-size: 24rpx;">
|
|
新增{{items.name}}
|
|
</view>
|
|
<view class="shop-attrs">
|
|
<uni-data-checkbox v-model="value" :localdata="range"></uni-data-checkbox>
|
|
<text @longpress="longPrec(index,itemTag.value,index1)"
|
|
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: 69.5%;">
|
|
<text
|
|
style="width: 69%;display: inline-block;font-size: 30rpx;font-weight: bold;padding-left: 40rpx;">规格</text>
|
|
<text
|
|
style="font-size: 30rpx;color: #000;font-weight: bold;width: 25%;display: inline-block;text-align: center;">库存</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" @blur="allChange"
|
|
@focus="obtainPrice($event,'zongjishu')" 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">
|
|
<uni-icons color="red" type="minus" size="26"></uni-icons>
|
|
</view>
|
|
<view class="shop-checkList-box">
|
|
<text style="width: 69%;display: inline-block;">{{item.name}}</text>
|
|
<text
|
|
style="color:#777;font-size: 24rpx;color:red;width: 25%;display: inline-block;"
|
|
v-if="item.productNum == null || item.productNum === '' || item.productNum == undefined">
|
|
无库存
|
|
</text>
|
|
<text style="color:#777;font-size: 24rpx;" v-if="item.productNum != null">
|
|
{{item.productNum}}
|
|
</text>
|
|
</view>
|
|
<!-- <uni-number-box max='1000000' v-model="item.productCount"
|
|
@change="temporaryChange($event,item)" /> -->
|
|
<view class="zuni-numbox">
|
|
<view @tap="mapMinusNum(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="mapPlusNum(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">
|
|
<view class="shop-popup-bottom-left">
|
|
<text>数量:{{zNum}} 件</text>
|
|
</view>
|
|
<view class="shop-popup-bottom-right">
|
|
<view class="bottom-btn" @tap="temporaryCheck">选好了</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
</view>
|
|
<!-- 维护客户价格弹出层 -->
|
|
<uni-popup ref="customPopup" background-color="#fff">
|
|
<view class="popup-content" style="height: auto;max-height: 600rpx;margin-bottom: 0;">
|
|
<view v-for="(item,index) in customerCategoryList" :key="index">
|
|
<view style="height: 60rpx;line-height: 60rpx;">
|
|
{{item.categoryName}}
|
|
</view>
|
|
<input type="digit" v-model='item.categoryPrice' placeholder="请输入客户价格"
|
|
style="height: 60rpx;padding-left: 20rpx;border: 1px solid #eee;border-radius: 10rpx;">
|
|
</view>
|
|
<view @tap="updateCate"
|
|
style="text-align:center;margin-top:20rpx;width: 100%;height: 60rpx;line-height: 60rpx;background: #088FEB;color: #fff;">
|
|
确认
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- 弹出分类选择 -->
|
|
<uni-popup ref="typePopup" background-color="#fff" :is-mask-click="true">
|
|
<view class="type-popup" style="margin-bottom: 0;">
|
|
<view style="height: 80rpx;font-size: 36rpx;font-weight: bold;line-height: 80rpx;text-align: center;">
|
|
选择分类
|
|
</view>
|
|
<view style="position: absolute;bottom: 0;height: 90rpx;width: 100%;background: #fff;z-index: 99;">
|
|
<view @tap="toggle('addGateDialog')"
|
|
style="width: 95%;height: 70rpx;line-height: 70rpx;text-align: center;background: linear-gradient(90deg, #60F3FF, #088FEB);border-radius: 5px;color: #fff;margin: 10rpx auto 0;">
|
|
新增分类
|
|
</view>
|
|
</view>
|
|
<view style="overflow: scroll;height: 630rpx;padding-bottom: 90rpx;">
|
|
<view v-for="(item,index) in indexList" :key="index" @tap="clickGategroy(item)"
|
|
style="height: 80rpx;font-size: 32rpx;width: 90%;line-height:80rpx;margin: 0 auto;border-top: 1px solid #eee;">
|
|
<view style="width: 89%;padding-left: 20rpx;float:left">{{item.categoryName}}</view>
|
|
<uni-icons type="right" size="18"></uni-icons>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- 新增分类输入框 -->
|
|
<uni-popup ref="addGateDialog" type="dialog">
|
|
<view class="type-popup"
|
|
style="width:100%;margin-bottom: 0;border-radius: 0;height: 400rpx;border-radius: 10px;">
|
|
<view style="height: 80rpx;font-size: 36rpx;font-weight: bold;line-height: 80rpx;text-align: center;">
|
|
修改规格值
|
|
</view>
|
|
<view style="width: 90%;margin: 80rpx auto;">
|
|
<uni-easyinput type="text" v-model="categoryText" @blur="handleBlur" placeholder="请输入规格值" />
|
|
</view>
|
|
<view
|
|
style="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.addGateDialog.close()">取消</view>
|
|
<view style="width:50%;background: linear-gradient(90deg, #FF9797, #FFC1E0);" @tap="addGategory">确认
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- 弹出合并商品 -->
|
|
<uni-popup ref="mergePopup" background-color="#fff" :is-mask-click="true">
|
|
<view class="type-popup" style="max-height: 1000rpx;overflow: scroll;margin-bottom: 0;border-radius: 0;">
|
|
<view style="height: 80rpx;font-size: 36rpx;font-weight: bold;line-height: 80rpx;text-align: center;">
|
|
请选择要合并到的商品
|
|
</view>
|
|
<view class="shop-box" v-for="(value,key) in Array.from(carList)" :key="key"
|
|
v-if="value[1].id != mergeId" @tap="clickMerge(value[0])">
|
|
<view class="shop-name" style="height: 150rpx;">
|
|
<view class="" style="width: 100rpx;height: 100rpx;margin: 20rpx 0 0 20rpx;font-size: 22rpx;">
|
|
<img @tap="getZhuBigImage(value[1].productPicture)" v-if="value[1].productPicture"
|
|
class="img-radius" style="width: 100rpx;height: 100rpx;display: block;overflow: hidden;"
|
|
:src="value[1].productPicture" alt="">
|
|
<view v-else class="img-radius"
|
|
style="width: 100rpx;height: 100rpx;display: block;overflow: hidden;text-align: center;line-height: 100rpx;border: 1px solid #eee;">
|
|
暂无图片</view>
|
|
</view>
|
|
<view class="shop-productName" style="height: 130rpx;">
|
|
<view style="display: flex;height: 55rpx;line-height: 55rpx;">
|
|
{{value[1].productName}}
|
|
</view>
|
|
<view style="display: flex;height: 55rpx;line-height: 55rpx;">
|
|
货号:{{value[1].productSn}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view style="line-height: 80rpx;font-size: 22rpx;color: #777;text-align: center;">
|
|
没有要合并的商品?那就去库存里看看吧~ ↓↓
|
|
</view>
|
|
<view @tap="goChooseGoods"
|
|
style="width: 100%;height: 70rpx;line-height: 70rpx;text-align: center;border-radius: 0;background: linear-gradient(90deg, #60F3FF, #088FEB);color: #fff;">
|
|
<view>同库存商品合并</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- 弹出生成货号 -->
|
|
<uni-popup ref="SNDialog" background-color="#fff" :is-mask-click="true">
|
|
<view class="type-popup" style="max-height: 1000rpx;overflow: scroll;margin-bottom: 0;border-radius: 0;">
|
|
<view style="height: 80rpx;font-size: 36rpx;font-weight: bold;line-height: 80rpx;text-align: center;">
|
|
请输入货号生成规则
|
|
</view>
|
|
<view class="content-list">
|
|
<view class="list-name" style="width: 156rpx;">前缀</view>
|
|
<view class="list-val" style="width: 245rpx;">
|
|
<input type="text" placeholder="请输入前缀规则" v-model="prefixRule" style="width:245rpx;">
|
|
</view>
|
|
</view>
|
|
<view class="content-list">
|
|
<view class="list-name" style="width: 156rpx;">生成位数</view>
|
|
<view class="list-val" style="width: 245rpx;">
|
|
<input type="number" placeholder="请输入位数规则" v-model="numRule" style="width: 245rpx;">
|
|
</view>
|
|
</view>
|
|
<view @tap="startGetSn"
|
|
style="width: 100%;height: 70rpx;line-height: 70rpx;margin-top:20rpx;text-align: center;border-radius: 0;background: linear-gradient(90deg, #60F3FF, #088FEB);color: #fff;">
|
|
<view>开始生成</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- 弹出规格选择 -->
|
|
<uni-popup ref="getaPopup" background-color="#fff" :is-mask-click="true">
|
|
<view class="type-popup" style="margin-bottom: 0;border-radius: 0;">
|
|
<view style="height: 80rpx;font-size: 36rpx;font-weight: bold;line-height: 80rpx;text-align: center;">
|
|
修改当前规格
|
|
</view>
|
|
<view style="text-align:center;color:red;font-size: 22rpx;">*如果当前规格中没有您想要的,可以手动输入</view>
|
|
<view class="card-list">
|
|
<ul>
|
|
<li v-for="items in attrList" :key="items.id">
|
|
<view class="title-fur">
|
|
<view class="name">{{items.attributeName}}</view>
|
|
<!-- <view class="rightBox">
|
|
<u-icon size="20" name="plus" color="#5fd9ee"
|
|
@tap="inputDialogToggle(items.id)"></u-icon>
|
|
</view> -->
|
|
</view>
|
|
<view class="content-fur">
|
|
<view class="content-low" v-for="item in attributeValue" :key="item.id"
|
|
@tap="changeSpec(item.value)">{{item.value}}
|
|
</view>
|
|
</view>
|
|
</li>
|
|
</ul>
|
|
</view>
|
|
<view style="color: #333;width: 90%;margin: 0 auto 20rpx;">
|
|
<uni-easyinput v-model="specifications" placeholder="请输入规格值"></uni-easyinput>
|
|
</view>
|
|
<view @tap="changeSpec(specifications)"
|
|
style="width: 100%;height: 70rpx;line-height: 70rpx;text-align: center;border-radius: 0;background: linear-gradient(90deg, #60F3FF, #088FEB);color: #fff;">
|
|
<view>确认修改</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<uni-popup ref="inputDialog" background-color="#fff" :is-mask-click="true">
|
|
<view class="type-popup"
|
|
style="width:100%;margin-bottom: 0;border-radius: 0;height: 450rpx;border-radius: 10px;">
|
|
<view style="height: 120rpx;font-size: 36rpx;font-weight: bold;line-height: 120rpx;text-align: center;">
|
|
新增规格值
|
|
</view>
|
|
<view style="height: 80rpx;font-size: 28rpx;line-height: 80rpx;text-align: center;">
|
|
请在下方输入框中输入新规格
|
|
</view>
|
|
<view style="width: 90%;margin: 40rpx auto 0;">
|
|
<uni-easyinput type="text" v-model="categoryText" @blur="handleBlur" placeholder="请输入规格值"
|
|
ref="clearInput" />
|
|
</view>
|
|
<view
|
|
style="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="dialogClose">取消</view>
|
|
<view style="width:50%;background: linear-gradient(90deg, #FF9797, #FFC1E0);"
|
|
@tap="dialogInputConfirm">确认</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- 语音识别弹出层 -->
|
|
<uni-popup ref="popup" background-color="#fff" @change="yuyinChange">
|
|
<view class="voice-popup-content" :style="{'margin-bottom':isChangeHeight?'700rpx':'0'}">
|
|
<view class="voice-popup-title">
|
|
<text>语音录入</text>
|
|
<uni-icons @tap='$refs.popup.close()' type="closeempty" color='red' size="16"
|
|
style="height:40rpx;line-height: 40rpx;position: absolute !important;bottom:0;right: 30rpx;"></uni-icons>
|
|
</view>
|
|
<view style="text-align: center;width: 100%;line-height: 40rpx;font-size: 22rpx;color: #777;">
|
|
示例:货号0237,数量10件,单价88,名称:裙子,批发价:12
|
|
</view>
|
|
<view class="voice-popup-container">
|
|
<textarea maxlength="-1" name="" id=""
|
|
style="width:100%;height:240rpx;border:1px solid #eee;margin:0;" @focus="isChangeHeight = true"
|
|
@blur="isChangeHeight = false" v-model="voiceText1" @input="getText"
|
|
placeholder="等待语音识别中..."></textarea>
|
|
<view>
|
|
<text style="color:red;font-size:22rpx;">*长按“语音”按钮录入,系统将自动识别</text>
|
|
</view>
|
|
<view class="voice-popup-bottom">
|
|
<view class="voice-popup-btn" @tap="clearText">清空</view>
|
|
<view class="voice-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>
|
|
<!-- 底部语音识别弹出层 -->
|
|
<uni-popup ref="voiceBottomPopup" background-color="#fff" @change="yuyinChange">
|
|
<view class="voice-popup-content1">
|
|
<view style="height: 600rpx;overflow: scroll;width: 100%;">
|
|
<view v-if="promptImg!=''">
|
|
<view style="text-align: center;height: auto;color:red;width:100%;">
|
|
*长按可更换图片
|
|
</view>
|
|
<image mode='widthFix' :src="promptImg" @tap="getZhuBigImage(promptImg)"
|
|
@longpress="uploadFile(value)" alt="" style="width: 100%;" />
|
|
</image>
|
|
</view>
|
|
<view v-if="promptImg == ''"
|
|
style="text-align: center;height: 150rpx;width:100%;line-height: 150rpx;font-size: 36rpx;font-weight: bold;">
|
|
温馨提示
|
|
</view>
|
|
<view v-if="promptImg == ''" style="text-align: center;height: auto;color:red;width:100%;">
|
|
如果您的入库单为电子版,或者查看入库单不方便,可以点击下方“+”号上传图片,对照进行语音入库,已经上传的图片可“长按更换”
|
|
</view>
|
|
<view v-if="promptImg == ''" @tap="uploadFile"
|
|
style="margin-top:20rpx;width: 100%;height: 200rpx;border: 1px solid #777;border-radius: 10px;text-align: center;line-height: 200rpx;">
|
|
<uni-icons type='plusempty' size='50'></uni-icons>
|
|
</view>
|
|
</view>
|
|
<view class="voice-popup-title">
|
|
<text>语音录入</text>
|
|
<text @tap='$refs.voiceBottomPopup.close()'
|
|
style="font-size: 28rpx;color: red;height: 40rpx;line-height: 40rpx;position: absolute !important;bottom: 10rpx;right: 30rpx;">
|
|
关闭
|
|
</text>
|
|
</view>
|
|
|
|
<view style="text-align: center;width: 100%;line-height: 40rpx;font-size: 22rpx;color: #777;">
|
|
示例:货号0237,数量10件,单价88,名称:裙子,批发价:12
|
|
</view>
|
|
<view class="voice-popup-container">
|
|
<textarea maxlength="-1" name="" id="" @input="getText"
|
|
style="width:100%;height:240rpx;border:1px solid #eee;margin:0;" v-model="voiceText1"
|
|
placeholder="等待语音识别中..."></textarea>
|
|
<view>
|
|
<text style="color:red;font-size:22rpx;">*长按“语音”按钮录入,系统将自动识别</text>
|
|
</view>
|
|
<view class="voice-popup-bottom">
|
|
<view class="voice-popup-btn" @tap="clearText"
|
|
style="border-top-left-radius: 70rpx;border-bottom-left-radius: 70rpx;">清空</view>
|
|
<view class="voice-popup-btn" style="background:linear-gradient(90deg, #60F3FF, #088FEB)"
|
|
@tap="setDetail">确认</view>
|
|
<view class="voice-popup-btn"
|
|
style="background:linear-gradient(90deg, #FF9797, #FFC1E0);border-top-right-radius: 70rpx;border-bottom-right-radius: 70rpx;"
|
|
@touchstart="kaishi" @touchend="jieshu">语音</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- 顶部语音开单单商品选择弹窗 -->
|
|
<uni-popup ref="oneDataPopup" background-color="#fff" :is-mask-click="true" v-show="showTan"
|
|
@change="changeMore">
|
|
<view class="type-popup" style="margin-bottom: 0;border-radius: 0;max-height: 1000rpx;overflow: scroll;">
|
|
<view style="height: 80rpx;font-size: 36rpx;font-weight: bold;line-height: 80rpx;text-align: center;">
|
|
查询到多个商品
|
|
</view>
|
|
<view class="card-list" style="margin:0 auto;">
|
|
<view class="right-box" v-for="(item,index) in moreData[currentPopupIndex]" :key='index'
|
|
@tap="clickGetOne(item)">
|
|
<view class="box-left">
|
|
<img :src="item.productPicture" alt="" v-if="item.productPicture">
|
|
<view class="noPic" style="margin:0;" v-else>暂无图片</view>
|
|
</view>
|
|
<view class="box-right">
|
|
<view class="box-right-name">
|
|
{{item.productSn}}
|
|
<text style="color: red;" v-if="item.delFlag == 0">(已下架)</text>
|
|
</view>
|
|
<view class="box-right-num">{{item.productName == null ?'':item.productName}}</view>
|
|
<view class="box-right-price">
|
|
<view class="voice-price-box" v-if="storageType== 0">
|
|
<text>{{item.inStorageStatus==0?'待入库':item.purchasePrice == null ?'新商品':item.purchasePrice}}</text>
|
|
<text>采购价</text>
|
|
</view>
|
|
<view class="voice-price-box">
|
|
<text>{{item.wholesalePrice}}</text>
|
|
<text>批发价</text>
|
|
</view>
|
|
<view class="voice-price-box">
|
|
<text>{{item.price}}</text>
|
|
<text>零售价</text>
|
|
</view>
|
|
<view class="voice-price-box">
|
|
<text>{{item.stockCount}}</text>
|
|
<text>库存</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- 弹出多图轮播 -->
|
|
<uni-popup ref="showImgDiaLog" background-color="#fff">
|
|
<view class="showImg-box">
|
|
<swiper indicator-dots class="swiper-box" @change="lunbochange" circular autoplay
|
|
:current="swiperDotIndex">
|
|
<swiper-item v-for="(item, index) in productPictures" :key="index">
|
|
<view class="swiper-item">
|
|
<image mode='aspectFit' :src="item.productPicture" alt=""
|
|
style="width: 100%;height: 100%;" />
|
|
</image>
|
|
</view>
|
|
</swiper-item>
|
|
</swiper>
|
|
<view @tap="pictureAdd(childrenId,'huan')" class="lb-btn">更换图片</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>
|
|
<view class="mask-model" v-if="isVoice">貌似没有检测到您上次的语音录入信息,正在反复识别中</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
mapState
|
|
} from 'vuex';
|
|
import {
|
|
generateUUID
|
|
} from '@/utils/global.js'
|
|
import base from '@/utils/ossUploadFile/base64.js';
|
|
var plugin = requirePlugin("WechatSI")
|
|
let manager = plugin.getRecordRecognitionManager()
|
|
export default {
|
|
computed: mapState(['shopName']),
|
|
data() {
|
|
return {
|
|
isVoice: false,
|
|
allChangeNum: 0,
|
|
voiceText: '',
|
|
voiceText1: '',
|
|
khName: [],
|
|
isChangeHeight: false,
|
|
carList: new Map(),
|
|
remark: '',
|
|
voiceGetOneData: false,
|
|
otherPay: '',
|
|
noPay: 0,
|
|
promptImg: '',
|
|
customerCategoryList: [],
|
|
customerCategoryList1: [], //存放金额为空的客户分类,用于新增商品
|
|
alreadyPay: '',
|
|
realAmount: 0,
|
|
shouldPay: '',
|
|
userType: '',
|
|
totalAmount: 0,
|
|
customTypeId: '',
|
|
index: '',
|
|
index1: '',
|
|
recordState: false,
|
|
goodsDetail: [],
|
|
temporaryList: [],
|
|
zNum: 0,
|
|
snList: [],
|
|
carList1: [],
|
|
zhuImg: '',
|
|
zhuImgList: [],
|
|
productNum: null,
|
|
prefixRule: '',
|
|
numRule: '',
|
|
yuedikou: 0,
|
|
isChangePriceOk: false,
|
|
leijiqiankuan: 0,
|
|
productId: '',
|
|
oneGoodsId: '',
|
|
showTan: false,
|
|
currentPopupIndex: 0,
|
|
moreData: [],
|
|
goodsId: '',
|
|
pageOldTemList: [],
|
|
oldTemList: [],
|
|
attrList: [],
|
|
goodsList: [],
|
|
mergeId: '',
|
|
newTemList: [],
|
|
pecsList: [],
|
|
single: '',
|
|
childrenId: '',
|
|
isGenerateSnRadio: 1,
|
|
productPictures: [],
|
|
categoryText: '',
|
|
dataObj: new Map(),
|
|
isPlusAndMinus: false,
|
|
indexList: [],
|
|
evalue: [],
|
|
attributeValue: [],
|
|
specifications: '',
|
|
current: 0,
|
|
swiperDotIndex: 0,
|
|
zhiqianqiankuan: 0,
|
|
currentAnchor: '',
|
|
temporaryNum: 0,
|
|
isBottom: false,
|
|
isGenerateSn: [{
|
|
value: '0',
|
|
name: '生成'
|
|
},
|
|
{
|
|
value: '1',
|
|
name: '不生成'
|
|
}
|
|
],
|
|
snName: 'ty',
|
|
defaultList: [{
|
|
name: '颜色',
|
|
value: [{
|
|
value: '均色',
|
|
checked: false,
|
|
}, {
|
|
value: '白色',
|
|
checked: false,
|
|
}, {
|
|
value: '绿色',
|
|
checked: false,
|
|
}, {
|
|
value: '黄色',
|
|
checked: false,
|
|
}, {
|
|
value: '卡其色',
|
|
checked: false,
|
|
}, {
|
|
value: '黑色',
|
|
checked: false,
|
|
}, {
|
|
value: '浅蓝',
|
|
checked: false,
|
|
}, {
|
|
value: '蓝色',
|
|
checked: false,
|
|
}, {
|
|
value: '灰色',
|
|
checked: false,
|
|
}, {
|
|
value: '咖色',
|
|
checked: false,
|
|
}, {
|
|
value: '紫色',
|
|
checked: false,
|
|
}, {
|
|
value: '红色',
|
|
checked: false,
|
|
}, {
|
|
value: '米色',
|
|
checked: false,
|
|
}]
|
|
}, {
|
|
name: '尺码',
|
|
value: [{
|
|
value: '均码',
|
|
checked: false,
|
|
}, {
|
|
value: 'XS码',
|
|
checked: false
|
|
}, {
|
|
value: 'S码',
|
|
checked: false,
|
|
}, {
|
|
value: 'M码',
|
|
checked: false,
|
|
}, {
|
|
value: 'L码',
|
|
checked: false,
|
|
}, {
|
|
value: 'XL码',
|
|
checked: false,
|
|
}, {
|
|
value: '2XL码',
|
|
checked: false,
|
|
}, {
|
|
value: '3XL码',
|
|
checked: false,
|
|
}, {
|
|
value: '4XL码',
|
|
checked: false,
|
|
}, {
|
|
value: '5XL码',
|
|
checked: false,
|
|
}]
|
|
}],
|
|
temporary: [] //修改单个规格值临时存放要修改的对象
|
|
}
|
|
},
|
|
filters: {
|
|
sliceMsg(val) {
|
|
var name = ''
|
|
if (typeof(val) == 'string') {
|
|
let newObj = JSON.parse(val)
|
|
for (let as in newObj) {
|
|
name += newObj[as] + '/'
|
|
}
|
|
}
|
|
return name;
|
|
}
|
|
},
|
|
onShow() {
|
|
uni.authorize({
|
|
scope: 'scope.record',
|
|
success() {
|
|
|
|
},
|
|
fail() {
|
|
this.tui.toast("您未授权,语音功能可能会出现错误")
|
|
}
|
|
})
|
|
uni.authorize({
|
|
scope: 'scope.writePhotosAlbum',
|
|
success() {
|
|
|
|
},
|
|
fail() {
|
|
this.tui.toast("您未授权,图片上传功能可能会出现错误")
|
|
}
|
|
})
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
let that = this,
|
|
isTrue = false
|
|
|
|
if (this.merge == 1) {
|
|
this.$refs.mergePopup.close();
|
|
if (this.carList.has(this.carList1.id) == true) { //跟当前页面有相同的商品
|
|
that.carList.get(that.mergeId).stockLogList.forEach(function(value1, key1) {
|
|
that.carList.get(that.carList1.id).stockLogList.forEach(function(value, key) {
|
|
if (key1 == key) {
|
|
if (that.mergeId != that.carList1.id) {
|
|
that.carList.get(that.carList1.id).stockLogList.get(key).productCount =
|
|
Number(that.carList.get(that.carList1.id).stockLogList.get(key)
|
|
.productCount) + Number(value1.productCount)
|
|
isTrue = true
|
|
that.carList.get(that.carList1.id).productCount += Number(value1
|
|
.productCount)
|
|
}
|
|
}
|
|
})
|
|
if (isTrue == false) {
|
|
that.carList.get(that.carList1.id).stockLogList.set(key1, value1)
|
|
that.carList.get(that.carList1.id).productCount += Number(value1.productCount)
|
|
}
|
|
})
|
|
|
|
} else {
|
|
this.carList.get(this.mergeId).productId = this.carList1.id
|
|
this.carList.get(this.mergeId).id = this.carList1.id
|
|
this.carList.get(this.mergeId).productName = this.carList1.productName
|
|
this.carList.get(this.mergeId).productPicture = this.carList1.productPicture
|
|
this.carList.get(this.mergeId).productSn = this.carList1.productSn
|
|
this.carList.get(this.mergeId).categoryId = this.carList1.categoryId
|
|
this.carList.get(this.mergeId).wholesalePrice = this.carList1.wholesalePrice || 0
|
|
this.carList.get(this.mergeId).lsprice = this.carList1.price || 0
|
|
this.carList.get(this.mergeId).isNew = false
|
|
this.carList.set(this.carList1.id, this.carList.get(this.mergeId))
|
|
|
|
}
|
|
if (this.mergeId != this.carList1.id) {
|
|
this.carList.delete(this.mergeId)
|
|
}
|
|
that.carList.get(that.carList1.id).price1 = Number(that.carList.get(that.carList1.id).productCount) * that
|
|
.carList
|
|
.get(that.carList1.id).purchasePrice
|
|
this.getAllPrice()
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 300)
|
|
this.$forceUpdate()
|
|
this.merge = 0
|
|
return;
|
|
}
|
|
if (uni.getStorageSync('carList1') != '') {
|
|
this.carList1 = JSON.parse(uni.getStorageSync('carList1'))
|
|
} else {
|
|
this.carList1 = this.carList1
|
|
|
|
}
|
|
if (this.carList1 != '') {
|
|
isTrue = true
|
|
}
|
|
if (uni.getStorageSync('khName') != '') {
|
|
this.khName = JSON.parse(uni.getStorageSync('khName'))
|
|
} else {
|
|
this.khName = JSON.parse(JSON.stringify(this.khName)) || ''
|
|
}
|
|
|
|
if (this.khName != '') {
|
|
if (this.khName.noEarn != null && this.zhiqianqiankuan != this.khName.noEarn) {
|
|
isTrue = true
|
|
}
|
|
if (this.khName.noEarn == null) {
|
|
this.zhiqianqiankuan = 0
|
|
} else {
|
|
this.zhiqianqiankuan = this.khName.noEarn
|
|
}
|
|
}
|
|
setTimeout(res => {
|
|
this.getByCondition()
|
|
}, 500);
|
|
if (this.carList.size == 0) { //当前页没有数据
|
|
for (let i = 0; i < this.carList1.length; i++) {
|
|
let obj = {
|
|
purchasePrice: this.userType == 0 ? this.carList1[i].purchasePrice : '', //进货价
|
|
price1: 0,
|
|
price: this.carList1[i].price,
|
|
productCount: 0,
|
|
customerCategoryList: this.carList1[i].customerCategoryRule != null ? this.checkPriceRule(this
|
|
.carList1[i]
|
|
.customerCategoryRule) : this.getNewProductRule(),
|
|
id: this.carList1[i].productId != null ? this.carList1[i].productId : this.carList1[i].id,
|
|
isNew: this.carList1[i].isNew, //是否是新商品
|
|
productId: this.carList1[i].productId == null ? '' : this.carList1[i].productId,
|
|
productName: this.carList1[i].productName,
|
|
wholesalePrice: this.carList1[i].wholesalePrice || 0,
|
|
categoryName: this.carList1[i].categoryName,
|
|
categoryId: this.carList1[i].categoryId,
|
|
attrId: this.carList1[i].attrId,
|
|
lsprice: this.carList1[i].price || 0,
|
|
productPicture: this.carList1[i].productPicture,
|
|
productSn: this.carList1[i].productSn,
|
|
productPictures: [],
|
|
stockLogList: new Map(),
|
|
stockLogList1: []
|
|
}
|
|
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
|
|
let productCount = Number(this.carList1[i].saleDetailQueryDTO[m].productCount)
|
|
if (obj.stockLogList.has(this.carList1[i].saleDetailQueryDTO[m].attributeList) == true) {
|
|
productCount += Number(obj.stockLogList.get(this.carList1[i].saleDetailQueryDTO[m]
|
|
.attributeList)
|
|
.productCount)
|
|
}
|
|
var data1 = {
|
|
productCount: productCount,
|
|
name: this.carList1[i].saleDetailQueryDTO[m].name,
|
|
productNum: this.carList1[i].saleDetailQueryDTO[m].productNum
|
|
}
|
|
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
|
|
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount == null ? 0 : Number(this
|
|
.carList1[i].saleDetailQueryDTO[m].productCount)
|
|
obj.price1 = Number(obj.productCount) * this.carList1[i].purchasePrice
|
|
}
|
|
let id = this.carList1[i].isNew == true ? this.carList1[i].id : this.carList1[i].productId
|
|
this.carList.set(id, obj)
|
|
|
|
}
|
|
this.carList1 = []
|
|
} else { //当前页有数据
|
|
for (let i = 0; i < this.carList1.length; i++) {
|
|
let id = this.carList1[i].isNew == true ? this.carList1[i].id : this.carList1[i].productId
|
|
if (this.carList.has(this.carList1[i].id) == true) { //商品相同
|
|
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
|
|
if (this.carList.get(this.carList1[i].id).stockLogList.has(this.carList1[i].saleDetailQueryDTO[
|
|
m].attributeList) == true) { //规格相同
|
|
|
|
var data1 = {
|
|
productCount: Number(this.carList.get(this.carList1[i].id).stockLogList.get(this
|
|
.carList1[
|
|
i].saleDetailQueryDTO[m].attributeList).productCount) + Number(this
|
|
.carList1[i]
|
|
.saleDetailQueryDTO[m].productCount),
|
|
name: this.carList1[i].saleDetailQueryDTO[m].name,
|
|
productNum: this.carList1[i].saleDetailQueryDTO[m].productNum
|
|
}
|
|
|
|
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[
|
|
m].attributeList, data1)
|
|
} else { //规格不同
|
|
var data1 = {
|
|
productCount: Number(this.carList1[i].saleDetailQueryDTO[m].productCount),
|
|
name: this.carList1[i].saleDetailQueryDTO[m].name,
|
|
productNum: this.carList1[i].saleDetailQueryDTO[m].productNum
|
|
}
|
|
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[
|
|
m].attributeList, data1)
|
|
|
|
}
|
|
this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[
|
|
m].productCount == null ? 0 : Number(this.carList1[i].saleDetailQueryDTO[
|
|
m].productCount)
|
|
this.carList.get(this.carList1[i].id).price1 = Number(this.carList.get(this.carList1[i].id)
|
|
.productCount) * this.carList.get(this.carList1[i].id).purchasePrice
|
|
}
|
|
} else { //商品不同
|
|
let obj = {
|
|
purchasePrice: this.userType == 0 ? this.carList1[i].purchasePrice : '', //进货价
|
|
price1: 0,
|
|
price: this.carList1[i].price,
|
|
productCount: 0,
|
|
customerCategoryList: this.carList1[i].customerCategoryRule != null ? this.checkPriceRule(
|
|
this.carList1[i]
|
|
.customerCategoryRule) : this.getNewProductRule(),
|
|
id: this.carList1[i].productId != null ? this.carList1[i].productId : this.carList1[i].id,
|
|
productId: this.carList1[i].productId == null ? '' : this.carList1[i].productId,
|
|
isNew: this.carList1[i].isNew,
|
|
productName: this.carList1[i].productName,
|
|
wholesalePrice: this.carList1[i].wholesalePrice || 0,
|
|
categoryName: this.carList1[i].categoryName,
|
|
categoryId: this.carList1[i].categoryId,
|
|
attrId: this.carList1[i].attrId,
|
|
lsprice: this.carList1[i].price || 0,
|
|
productPicture: this.carList1[i].productPicture,
|
|
productSn: this.carList1[i].productSn,
|
|
stockLogList: new Map(),
|
|
stockLogList1: [],
|
|
productPictures: [],
|
|
name: ''
|
|
}
|
|
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
|
|
var data1 = {
|
|
productCount: Number(this.carList1[i].saleDetailQueryDTO[m].productCount),
|
|
name: this.carList1[i].saleDetailQueryDTO[m].name,
|
|
productNum: this.carList1[i].saleDetailQueryDTO[m].productNum
|
|
}
|
|
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
|
|
|
|
obj.name = this.carList1[i].saleDetailQueryDTO[m].name
|
|
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount == null ? 0 : Number(
|
|
this
|
|
.carList1[i].saleDetailQueryDTO[m].productCount)
|
|
obj.price1 = Number(obj.productCount) * this.carList1[i].purchasePrice
|
|
}
|
|
|
|
this.carList.set(id, obj)
|
|
}
|
|
}
|
|
|
|
}
|
|
this.$nextTick(() => {
|
|
|
|
this.carList1 = []
|
|
uni.removeStorageSync('carList1')
|
|
uni.removeStorageSync('khName')
|
|
uni.removeStorageSync('hangOrder')
|
|
if (isTrue) {
|
|
this.getAllPrice()
|
|
}
|
|
if (this.carList1 != '') {
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 2000)
|
|
} else {
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 300)
|
|
}
|
|
this.$forceUpdate()
|
|
})
|
|
},
|
|
onLoad(options) {
|
|
this.userType = uni.getStorageSync('type')
|
|
this.getSnList()
|
|
this.getShopCategory()
|
|
this.getCustomerCategoryList()
|
|
this.getDefaultCategory()
|
|
this.getMonth()
|
|
},
|
|
methods: {
|
|
uploadFile() {
|
|
let that = this;
|
|
uni.chooseMedia({
|
|
count: 1,
|
|
mediaType: ['image'],
|
|
sourceType: ['album'],
|
|
camera: 'back',
|
|
success(res) {
|
|
uni.compressImage({
|
|
src: res.tempFiles[0].tempFilePath,
|
|
quality: 50,
|
|
success: res1 => {
|
|
|
|
uni.uploadFile({
|
|
url: that.tui.interfaceUrl() + '/upload/file',
|
|
filePath: res1.tempFilePath,
|
|
name: 'file',
|
|
header: {
|
|
"content-type": "multipart/form-data",
|
|
'accessToken': that.tui.getToken()
|
|
},
|
|
formData: {},
|
|
success: (uploadFileRes) => {
|
|
let path = JSON.parse(uploadFileRes.data)
|
|
//后端返回的地址,存入图片地址
|
|
that.promptImg = path.result
|
|
that.$forceUpdate()
|
|
}
|
|
});
|
|
}
|
|
})
|
|
|
|
}
|
|
})
|
|
},
|
|
getMonth() {
|
|
let date = new Date()
|
|
let year = date.getFullYear().toString() //'年'
|
|
let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : (date.getMonth() + 1)
|
|
.toString() //'月'
|
|
let da = date.getDate() < 10 ? '0' + date.getDate().toString() : date.getDate().toString() //'日'
|
|
this.single = year + '-' + month + '-' + da //当天
|
|
},
|
|
//店铺规格库
|
|
getShopCategory() {
|
|
this.tui.request("/app/productCategory/getCategoryOfshop", "POST", {}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
//this.specifiList[0] this.defaultList[1] 尺码
|
|
//this.specifiList[1] this.defaultList[0] 颜色
|
|
this.specifiList = res.result.productAttributeOfAddVos
|
|
if (this.specifiList[0].attributeName == '尺码') {
|
|
for (let m = 0; m < this.specifiList[0].productAttributeValueVoList
|
|
.length; m++) { //尺码库
|
|
let isysTrue = true
|
|
for (let i = 0; i < this.defaultList[1].value.length; i++) { //合并尺码 默认尺码
|
|
if (this.defaultList[1].value[i].value == this.specifiList[0]
|
|
.productAttributeValueVoList[m].value) {
|
|
isysTrue = false
|
|
}
|
|
}
|
|
this.$nextTick(() => {
|
|
if (isysTrue) {
|
|
this.defaultList[1].value.push(this.specifiList[0]
|
|
.productAttributeValueVoList[m])
|
|
}
|
|
})
|
|
}
|
|
} else {
|
|
for (let m = 0; m < this.specifiList[0].productAttributeValueVoList
|
|
.length; m++) { //颜色库
|
|
let isTrue = true
|
|
for (let i = 0; i < this.defaultList[0].value.length; i++) { //合并颜色 默认颜色
|
|
if (this.defaultList[0].value[i].value == this.specifiList[0]
|
|
.productAttributeValueVoList[m].value) {
|
|
isTrue = false
|
|
}
|
|
}
|
|
this.$nextTick(() => {
|
|
if (isTrue) {
|
|
this.defaultList[0].value.push(this.specifiList[0]
|
|
.productAttributeValueVoList[m])
|
|
}
|
|
})
|
|
|
|
}
|
|
}
|
|
if (this.specifiList[1].attributeName == '尺码') {
|
|
for (let m = 0; m < this.specifiList[1].productAttributeValueVoList
|
|
.length; m++) { //尺码库
|
|
let isysTrue = true
|
|
for (let i = 0; i < this.defaultList[1].value.length; i++) { //合并尺码 默认尺码
|
|
if (this.defaultList[1].value[i].value == this.specifiList[1]
|
|
.productAttributeValueVoList[m].value) {
|
|
isysTrue = false
|
|
}
|
|
}
|
|
this.$nextTick(() => {
|
|
if (isysTrue) {
|
|
this.defaultList[1].value.push(this.specifiList[1]
|
|
.productAttributeValueVoList[m])
|
|
}
|
|
})
|
|
}
|
|
} else {
|
|
for (let m = 0; m < this.specifiList[1].productAttributeValueVoList
|
|
.length; m++) { //颜色库
|
|
let isTrue = true
|
|
for (let i = 0; i < this.defaultList[0].value.length; i++) { //合并颜色 默认颜色
|
|
if (this.defaultList[0].value[i].value == this.specifiList[1]
|
|
.productAttributeValueVoList[m].value) {
|
|
isTrue = false
|
|
}
|
|
}
|
|
this.$nextTick(() => {
|
|
if (isTrue) {
|
|
this.defaultList[0].value.push(this.specifiList[1]
|
|
.productAttributeValueVoList[m])
|
|
}
|
|
})
|
|
|
|
}
|
|
}
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
//获取客户分类
|
|
getCustomerCategoryList() {
|
|
this.tui.request("/app/customerCategory/getCustomerCategoryListByShopId", "POST", {
|
|
shopId: uni.getStorageSync('shopId')
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.result.length > 0) {
|
|
for (let i = 0; i < res.result.length; i++) {
|
|
let data = {
|
|
categoryName: res.result[i].categoryName,
|
|
categoryId: res.result[i].id,
|
|
categoryPrice: ""
|
|
}
|
|
this.customerCategoryList[i] = data
|
|
this.customerCategoryList1[i] = data
|
|
}
|
|
} else {
|
|
this.customerCategoryList = null
|
|
this.customerCategoryList1 = null
|
|
}
|
|
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
//店铺默认分类
|
|
getDefaultCategory() {
|
|
this.tui.request("/app/productCategory/getDefaultCategory", "POST", {}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
this.categoryList = res.result
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
//进入页面,查询货号列表
|
|
getSnList() {
|
|
// snList
|
|
this.snList = []
|
|
this.snName = ''
|
|
this.tui.request("/app/productSn/getProductSnByShopId", "POST", {}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
if (res1.result != '') {
|
|
for (let i = 0; i < res1.result.length; i++) {
|
|
let data = {
|
|
text: '前缀:' + res1.result[i].snPre + ',位数:' + res1.result[i].snSufLength,
|
|
value: res1.result[i].snPre
|
|
}
|
|
this.snList.push(data)
|
|
}
|
|
this.snName = res1.result[0].snPre
|
|
}
|
|
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
this.$forceUpdate()
|
|
}).catch((res) => {})
|
|
},
|
|
//根据规则生成货号
|
|
startGetSn() {
|
|
var that = this;
|
|
uni.showLoading({
|
|
title: '加载中...',
|
|
mask: true
|
|
})
|
|
that.$refs.SNDialog.close()
|
|
if (this.prefixRule == '') {
|
|
this.tui.toast('请输入货号生成前缀规则')
|
|
return
|
|
}
|
|
if (this.numRule == '') {
|
|
this.tui.toast('请输入货号生成位数规则')
|
|
return
|
|
}
|
|
this.tui.request("/app/productSn/addAndGetNewProductSn", "POST", {
|
|
snPre: this.prefixRule,
|
|
snSufLength: this.numRule
|
|
}, false, false).then((res1) => {
|
|
if (res1.code == 200) {
|
|
// this.snList = res1.result
|
|
if (res1.message == '货号前缀已存在!') { //被删除,调启用方法
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "货号前缀已存在!",
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
that.tui.request("/app/productSn/useAgainProductSn", "POST", {
|
|
id: res1.result.id
|
|
}, false, true).then((res2) => {
|
|
if (res2.code == 200) {
|
|
that.tui.toast('成功')
|
|
that.prefixRule = ''
|
|
that.numRule = ''
|
|
setTimeout(res => {
|
|
that.getSnList()
|
|
}, 1000)
|
|
} else {
|
|
that.tui.toast(res2.message)
|
|
}
|
|
that.$forceUpdate()
|
|
}).catch((res) => {})
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
if (that.zhuImgList != [] && that.zhuImgList.length > 0) {
|
|
for (let i = 0; i < that.zhuImgList.length; i++) {
|
|
that.upLoadFile(that.zhuImgList[i], i + 1)
|
|
}
|
|
setTimeout(res => {
|
|
that.zhuImgList = []
|
|
}, 2000)
|
|
|
|
} else {
|
|
this.addPageGoods(this.zhuImg, res1.result)
|
|
}
|
|
that.getSnList()
|
|
}
|
|
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
this.$nextTick(() => {
|
|
uni.hideLoading()
|
|
})
|
|
},
|
|
//生成货号弹出层
|
|
generateSn(id) {
|
|
if (this.snList.length > 0) {
|
|
this.tui.request("/app/productSn/getNewProductSn", "POST", {
|
|
snPre: this.snName
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
this.tui.request('/app/product/getByProductSn', "post", {
|
|
productSn: res1.result
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.result != '') {
|
|
this.generateSn(value)
|
|
} else {
|
|
this.carList.get(id).productSn = res1.result
|
|
this.$forceUpdate()
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
} else {
|
|
this.zhuImg = ''
|
|
this.$refs.SNDialog.open('center')
|
|
}
|
|
|
|
},
|
|
addSn() {
|
|
this.$refs.SNDialog.open('center')
|
|
},
|
|
AiVoice() {
|
|
if (this.carList.size == 0) { //当前页没有数据
|
|
for (let i = 0; i < this.carList1.length; i++) {
|
|
let obj = {
|
|
purchasePrice: this.userType == 0 ? this.carList1[i].purchasePrice : '', //进货价
|
|
price1: 0,
|
|
price: this.carList1[i].price,
|
|
productCount: 0,
|
|
customerCategoryList: this.carList1[i].customerCategoryList != null ? this.carList1[i]
|
|
.customerCategoryList : this.getNewProductRule(),
|
|
id: this.carList1[i].productId != null ? this.carList1[i].productId : this.carList1[i].id,
|
|
isNew: this.carList1[i].isNew, //是否是新商品
|
|
productId: this.carList1[i].productId == null ? '' : this.carList1[i].productId,
|
|
productName: this.carList1[i].productName,
|
|
wholesalePrice: this.carList1[i].wholesalePrice || 0,
|
|
categoryName: this.carList1[i].categoryName,
|
|
categoryId: this.carList1[i].categoryId,
|
|
attrId: this.carList1[i].attrId,
|
|
lsprice: this.carList1[i].price || 0,
|
|
productPicture: this.carList1[i].productPicture,
|
|
productSn: this.carList1[i].productSn,
|
|
stockLogList: new Map(),
|
|
productPictures: [],
|
|
stockLogList1: []
|
|
}
|
|
|
|
|
|
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
|
|
let productCount = Number(this.carList1[i].saleDetailQueryDTO[m].productCount)
|
|
if (obj.stockLogList.has(this.carList1[i].saleDetailQueryDTO[m].attributeList) == true) {
|
|
productCount += Number(obj.stockLogList.get(this.carList1[i].saleDetailQueryDTO[m]
|
|
.attributeList).productCount)
|
|
}
|
|
var data1 = {
|
|
productCount: productCount,
|
|
name: this.carList1[i].saleDetailQueryDTO[m].name,
|
|
productNum: this.carList1[i].saleDetailQueryDTO[m].productNum
|
|
}
|
|
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
|
|
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount == null ? 0 : Number(
|
|
this.carList1[i].saleDetailQueryDTO[m].productCount)
|
|
obj.price1 = Number(obj.productCount) * this.carList1[i].purchasePrice
|
|
}
|
|
let id = this.carList1[i].isNew == true ? this.carList1[i].id : this.carList1[i].productId
|
|
this.carList.set(id, obj)
|
|
// that.carList.get(id).price = that.carList.get(id).purchasePrice *
|
|
// that.carList.get(id).productCount;
|
|
}
|
|
this.carList1 = []
|
|
} else { //当前页有数据
|
|
for (let i = 0; i < this.carList1.length; i++) {
|
|
let id = this.carList1[i].isNew == true ? this.carList1[i].id : this.carList1[i].productId
|
|
if (this.carList.has(this.carList1[i].id) == true) { //商品相同
|
|
if (this.carList.get(this.carList1[i].id).purchasePrice == '') {
|
|
this.carList.get(this.carList1[i].id).purchasePrice = this.carList1[i].purchasePrice
|
|
}
|
|
|
|
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
|
|
if (this.carList.get(this.carList1[i].id).stockLogList.has(this.carList1[i]
|
|
.saleDetailQueryDTO[m].attributeList) == true) { //规格相同
|
|
var data1 = {
|
|
productCount: Number(this.carList.get(this.carList1[i].id).stockLogList.get(
|
|
this
|
|
.carList1[i].saleDetailQueryDTO[m].attributeList).productCount) +
|
|
Number(this
|
|
.carList1[i].saleDetailQueryDTO[m].productCount),
|
|
name: this.carList1[i].saleDetailQueryDTO[m].name,
|
|
productNum: this.carList1[i].saleDetailQueryDTO[m].productNum
|
|
}
|
|
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i]
|
|
.saleDetailQueryDTO[m].attributeList, data1)
|
|
} else { //规格不同
|
|
var data1 = {
|
|
productCount: Number(this.carList1[i].saleDetailQueryDTO[m].productCount),
|
|
name: this.carList1[i].saleDetailQueryDTO[m].name,
|
|
productNum: this.carList1[i].saleDetailQueryDTO[m].productNum
|
|
}
|
|
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i]
|
|
.saleDetailQueryDTO[m].attributeList, data1)
|
|
}
|
|
this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[
|
|
m].productCount == null ? 0 : Number(this.carList1[i].saleDetailQueryDTO[m]
|
|
.productCount)
|
|
this.carList.get(this.carList1[i].id).price1 = Number(this.carList.get(this.carList1[i].id)
|
|
.productCount) * this.carList.get(this.carList1[i].id).purchasePrice
|
|
}
|
|
} else { //商品不同
|
|
let obj = {
|
|
purchasePrice: this.userType == 0 ? this.carList1[i].purchasePrice : '', //进货价
|
|
price1: 0,
|
|
price: this.carList1[i].price,
|
|
productCount: 0,
|
|
customerCategoryList: this.carList1[i].customerCategoryList != null ? this.carList1[i]
|
|
.customerCategoryList : this.getNewProductRule(),
|
|
id: this.carList1[i].productId != null ? this.carList1[i].productId : this.carList1[i]
|
|
.id,
|
|
productId: this.carList1[i].productId == null ? '' : this.carList1[i].productId,
|
|
isNew: this.carList1[i].isNew,
|
|
productName: this.carList1[i].productName,
|
|
wholesalePrice: this.carList1[i].wholesalePrice || 0,
|
|
categoryName: this.carList1[i].categoryName,
|
|
categoryId: this.carList1[i].categoryId,
|
|
attrId: this.carList1[i].attrId,
|
|
lsprice: this.carList1[i].price || 0,
|
|
productPicture: this.carList1[i].productPicture,
|
|
productSn: this.carList1[i].productSn,
|
|
stockLogList: new Map(),
|
|
stockLogList1: [],
|
|
productPictures: [],
|
|
name: ''
|
|
}
|
|
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
|
|
var data1 = {
|
|
productCount: Number(this.carList1[i].saleDetailQueryDTO[m].productCount),
|
|
name: this.carList1[i].saleDetailQueryDTO[m].name,
|
|
productNum: this.carList1[i].saleDetailQueryDTO[m].productNum
|
|
}
|
|
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
|
|
|
|
obj.name = this.carList1[i].saleDetailQueryDTO[m].name
|
|
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount == null ? 0 :
|
|
Number(this
|
|
.carList1[i].saleDetailQueryDTO[m].productCount)
|
|
obj.price1 = Number(obj.productCount) * this.carList1[i].purchasePrice
|
|
}
|
|
|
|
this.carList.set(id, obj)
|
|
}
|
|
// that.carList.get(id).price = that.carList.get(id).purchasePrice *
|
|
// that.carList.get(id).productCount;
|
|
|
|
}
|
|
|
|
}
|
|
this.$nextTick(() => {
|
|
|
|
this.carList1 = []
|
|
uni.removeStorageSync('carList1')
|
|
this.getAllPrice()
|
|
if (this.carList1 != '') {
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 2000)
|
|
} else {
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 300)
|
|
}
|
|
this.$forceUpdate()
|
|
})
|
|
},
|
|
numData(val) {
|
|
var name = []
|
|
if (typeof(val) == 'string') {
|
|
let newObj = JSON.parse(val)
|
|
for (let as in newObj) {
|
|
name.push(newObj[as])
|
|
}
|
|
}
|
|
return name;
|
|
},
|
|
checkSpec(type, id, attr, value) {
|
|
if (this.carList.get(id).categoryId == '' || this.carList.get(id).categoryId == null) {
|
|
this.tui.toast('请先选择商品分类')
|
|
return;
|
|
}
|
|
this.temporary = [id, attr, type, value]
|
|
let num = type == '颜色' ? 0 : 1
|
|
this.getGategoryLowList()
|
|
},
|
|
getScanCodeCategroyId(num) {
|
|
num = num == '颜色' ? 0 : 1
|
|
this.isOpenId = num
|
|
this.goodsId = this.goodsDetail.id
|
|
this.$refs.inputDialog.open('bottom')
|
|
this.isBottom = true
|
|
},
|
|
//初始化获取子分类列表
|
|
getGategoryLowList() {
|
|
this.attrList = []
|
|
let num = this.temporary[2] == '颜色' ? 0 : 1
|
|
this.tui.request("/app/productAttribute/selectByCategoryId", "POST", {
|
|
categoryId: this.carList.get(this.temporary[0]).attrId
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
this.attrList.push(res1.result[num])
|
|
if (res1.result.length > 0) {
|
|
this.attributeValue = []
|
|
this.tui.request(
|
|
"/app/productAttributeValue/selectByAttributeId",
|
|
"get", {
|
|
id: this.attrList[0].id
|
|
}, false, true).then((res2) => {
|
|
if (res2.code == 200) {
|
|
this.attributeValue = res2.result;
|
|
this.$forceUpdate()
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
|
|
}).catch((res) => {})
|
|
}
|
|
setTimeout(() => {
|
|
this.showList = this.attrList;
|
|
}, 1000)
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
this.$forceUpdate()
|
|
this.specifications = this.temporary[3]
|
|
this.$refs.getaPopup.open()
|
|
},
|
|
sliceMsg(val) {
|
|
var name = ''
|
|
if (typeof(val) == 'string') {
|
|
let newObj = JSON.parse(val)
|
|
for (let as in newObj) {
|
|
name += newObj[as] + '/'
|
|
}
|
|
}
|
|
return name;
|
|
},
|
|
//点击某一个规格,可修改
|
|
async changeSpec(item) {
|
|
let that = this;
|
|
if (item == '') {
|
|
this.tui.toast('请输入要修改的规格值')
|
|
return;
|
|
}
|
|
let data = this.temporary
|
|
let specMap = new Map() //新的临时存放值那个更改过的值的map
|
|
await this.carList.get(data[0]).stockLogList.forEach(function(value, key) {
|
|
if (data[2] == '颜色') {
|
|
if (that.numData(key)[0] == data[3]) {
|
|
let stringKey = key.replace(data[3], item) //拿到了更改过的key
|
|
|
|
if (specMap.has(stringKey) == true) {
|
|
data[1] = stringKey
|
|
specMap.get(stringKey).name = that.sliceMsg(stringKey)
|
|
specMap.get(stringKey).productCount += Number(value.productCount)
|
|
} else {
|
|
data[1] = stringKey
|
|
specMap.set(stringKey, value)
|
|
specMap.get(stringKey).name = that.sliceMsg(stringKey)
|
|
}
|
|
if (that.carList.get(data[0]).isNew != true) {
|
|
that.tui.request("/app/stock/productCount", "post", {
|
|
productId: that.carList.get(data[0]).productId,
|
|
attributeList: stringKey
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
value.productNum = res.result
|
|
that.$forceUpdate()
|
|
} else {
|
|
that.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
}
|
|
|
|
} else {
|
|
if (specMap.has(key) == true) {
|
|
specMap.get(key).productCount += Number(value.productCount)
|
|
} else {
|
|
specMap.set(key, value)
|
|
specMap.get(key).name = that.sliceMsg(key)
|
|
}
|
|
}
|
|
} else if (data[2] == '尺码') {
|
|
if (that.numData(key)[1] == data[3]) {
|
|
let stringKey = key.replace(data[3], item) //拿到了更改过的key
|
|
if (specMap.has(stringKey) == true) {
|
|
data[1] = stringKey
|
|
specMap.get(stringKey).name = that.sliceMsg(stringKey)
|
|
specMap.get(stringKey).productCount += Number(value.productCount)
|
|
} else {
|
|
data[1] = stringKey
|
|
|
|
specMap.set(stringKey, value)
|
|
specMap.get(stringKey).name = that.sliceMsg(stringKey)
|
|
}
|
|
if (that.carList.get(data[0]).isNew != true) {
|
|
that.tui.request("/app/stock/productCount", "post", {
|
|
productId: that.carList.get(data[0]).productId,
|
|
attributeList: stringKey
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
value.productNum = res.result
|
|
that.$forceUpdate()
|
|
} else {
|
|
that.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
}
|
|
} else {
|
|
if (specMap.has(key) == true) {
|
|
specMap.get(key).productCount += Number(value.productCount)
|
|
} else {
|
|
specMap.set(key, value)
|
|
specMap.get(key).name = that.sliceMsg(key)
|
|
}
|
|
}
|
|
}
|
|
})
|
|
await that.$nextTick(() => {
|
|
this.carList.get(data[0]).stockLogList = specMap
|
|
this.$forceUpdate()
|
|
this.$refs.getaPopup.close()
|
|
})
|
|
},
|
|
updateCate() {
|
|
this.carList.get(this.customTypeId).customerCategoryList = this.customerCategoryList
|
|
|
|
this.$refs.customPopup.close()
|
|
this.$forceUpdate()
|
|
},
|
|
delDefaultCate(index, value, index1) {
|
|
let data = this.goodsDetail.attributeList[index].value[index1]
|
|
this.goodsDetail.attributeList[index].value.splice(index1, 1);
|
|
this.tui.request("/app/productAttributeValue/delById", "post", {
|
|
attributeId: data.attributeId,
|
|
value: data.value,
|
|
id: data.id,
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
this.getShopCategory()
|
|
uni.showToast({
|
|
title: "删除成功",
|
|
icon: 'none'
|
|
})
|
|
} else {
|
|
uni.showToast({
|
|
title: "删除失败",
|
|
icon: 'none'
|
|
})
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
handleBlur(e) {
|
|
this.categoryText = e.detail.value
|
|
},
|
|
inputDialogToggle(item) {
|
|
this.inputVal = '';
|
|
this.isOpenId = item;
|
|
this.$refs.inputDialog.open('bottom')
|
|
},
|
|
//弹出客户分类弹窗
|
|
addCustomPrice(id) {
|
|
this.customTypeId = id
|
|
|
|
this.customerCategoryList = this.carList.get(id).customerCategoryList
|
|
this.$refs.customPopup.open()
|
|
},
|
|
getByCondition() {
|
|
this.tui.request("/app/supplier/getByCondition", "post", {
|
|
searchStr: this.khName.consigneeName,
|
|
pageNumber: 1,
|
|
pageSize: 10
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
for (let i = 0; i < res.result.content.length; i++) {
|
|
if (res.result.content[i].id == this.khName.id) {
|
|
|
|
this.khName.noEarn = res.result.content[i].noEarn
|
|
this.zhiqianqiankuan = res.result.content[i].noEarn
|
|
}
|
|
}
|
|
|
|
} else {
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
}
|
|
}).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
|
|
}
|
|
}
|
|
},
|
|
showPopup(index) {
|
|
this.currentPopupIndex = index;
|
|
this.showTan = true;
|
|
},
|
|
clickGetOne(item) {
|
|
// 如果还有下一个弹出层,则显示下一个
|
|
if (this.currentPopupIndex + 1 < this.moreData.length) {
|
|
this.showTan = false; // 先关闭当前弹出层
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
let data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
productCount: Number(item.productCount) || 1,
|
|
productNum: item.defaultStockCount
|
|
}
|
|
item.productId = item.id
|
|
item.saleDetailQueryDTO = []
|
|
item.saleDetailQueryDTO.push(data)
|
|
let purchaseDetails = []
|
|
purchaseDetails.push(item)
|
|
let id = this.oneGoodsId
|
|
if (this.oneGoodsId) {
|
|
if (this.carList.get(id).productSn != '') {
|
|
for (let j = 0; j < purchaseDetails.length; j++) {
|
|
for (let i = 0; i < purchaseDetails[j]
|
|
.stockLogList1.length; i++) {
|
|
if (this.carList.get(id)
|
|
.productName == '') {
|
|
this.carList.get(id)
|
|
.productName =
|
|
purchaseDetails[0]
|
|
.productName
|
|
}
|
|
if (this.carList.get(id).attrId ==
|
|
'') {
|
|
this.carList.get(id).attrId =
|
|
purchaseDetails[0].attrId
|
|
}
|
|
if (this.carList.get(id)
|
|
.purchasePrice == '' || this
|
|
.carList.get(id)
|
|
.purchasePrice == null) {
|
|
if (voiceData.purchasePrice) {
|
|
this.carList.get(id)
|
|
.purchasePrice =
|
|
voiceData.purchasePrice
|
|
} else {
|
|
this.carList.get(id)
|
|
.purchasePrice =
|
|
purchaseDetails[0]
|
|
.purchasePrice
|
|
}
|
|
|
|
}
|
|
if (this.carList.get(id)
|
|
.productPicture == '') {
|
|
this.carList.get(id)
|
|
.productPicture =
|
|
purchaseDetails[0]
|
|
.productPicture
|
|
}
|
|
this.carList.get(id)
|
|
.customerCategoryRule =
|
|
this.checkPriceRule(JSON.parse(purchaseDetails[0]
|
|
.customerCategoryRule))
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.name = this.sliceMsg(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList)
|
|
if (this.carList.get(id)
|
|
.stockLogList.size == 0) {
|
|
this.carList.get(id)
|
|
.stockLogList.set(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList,
|
|
purchaseDetails[j]
|
|
.stockLogList1[i])
|
|
} else {
|
|
if (this.carList.get(id)
|
|
.stockLogList.has(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList) == true
|
|
) {
|
|
this.carList.get(id)
|
|
.stockLogList.get(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList)
|
|
.productCount +=
|
|
Number(purchaseDetails[
|
|
j]
|
|
.stockLogList1[i]
|
|
.productCount)
|
|
} else {
|
|
this.carList.get(id)
|
|
.stockLogList.set(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList,
|
|
purchaseDetails[j]
|
|
.stockLogList1[i])
|
|
}
|
|
}
|
|
this.carList.get(id)
|
|
.productCount +=
|
|
Number(purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount)
|
|
}
|
|
}
|
|
this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
.productNum = purchaseDetails[0].defaultStockCount
|
|
if (this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
.productCount == 0 && purchaseDetails[
|
|
0].stockLogList1.length > 0) {
|
|
this.carList.get(id).stockLogList
|
|
.delete('{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
this.carList.get(id).price1 = Number(this
|
|
.carList
|
|
.get(id).productCount) * this
|
|
.carList
|
|
.get(id).purchasePrice
|
|
} else {
|
|
|
|
let isTrue = false
|
|
this.carList.forEach(function(value, key) {
|
|
if (value.productSn ==
|
|
purchaseDetails[0]
|
|
.productSn) {
|
|
isTrue = true
|
|
that.tui.toast(
|
|
'该货号被页面其他商品占用,请重新输入!'
|
|
)
|
|
that.carList.get(id)
|
|
.productSn = ''
|
|
setTimeout(res => {
|
|
that.$forceUpdate()
|
|
}, 1000)
|
|
throw Error('被占用')
|
|
}
|
|
})
|
|
|
|
this.$nextTick(() => {
|
|
if (this.carList.get(id)
|
|
.productName == '') {
|
|
this.carList.get(id)
|
|
.productName =
|
|
purchaseDetails[0]
|
|
.productName
|
|
}
|
|
this.carList.get(id)
|
|
.customerCategoryList =
|
|
purchaseDetails[0]
|
|
.customerCategoryRule != null ?
|
|
this.checkPriceRule(JSON.parse(purchaseDetails[0]
|
|
.customerCategoryRule)) : null
|
|
if (isTrue == false && this
|
|
.carList.get(id)
|
|
.productSn == '') {
|
|
this.carList.get(id)
|
|
.productSn =
|
|
purchaseDetails[0]
|
|
.productSn
|
|
}
|
|
if (isTrue == false) {
|
|
if (purchaseDetails[0]
|
|
.productId) {
|
|
this.carList.get(id)
|
|
.id =
|
|
purchaseDetails[0]
|
|
.productId
|
|
this.carList.get(id)
|
|
.productId =
|
|
purchaseDetails[0]
|
|
.productId
|
|
this.carList.get(id)
|
|
.isNew = false
|
|
id = purchaseDetails[0]
|
|
.productId
|
|
|
|
} else if (purchaseDetails[
|
|
0].productSn ==
|
|
'' || purchaseDetails[
|
|
0].productSn ==
|
|
null) {
|
|
this.carList.get(id)
|
|
.id =
|
|
purchaseDetails[0]
|
|
.productName
|
|
id = purchaseDetails[0]
|
|
.productName
|
|
} else if (purchaseDetails[
|
|
0].productSn ==
|
|
'货号') {
|
|
this.carList.get(id)
|
|
.productSn =
|
|
purchaseDetails[0]
|
|
.productName
|
|
this.carList.get(id)
|
|
.id =
|
|
purchaseDetails[0]
|
|
.productName
|
|
id = purchaseDetails[0]
|
|
.productName
|
|
} else if (purchaseDetails[
|
|
0].productSn) {
|
|
this.carList.get(id)
|
|
.id =
|
|
purchaseDetails[0]
|
|
.productSn
|
|
id = purchaseDetails[0]
|
|
.productSn
|
|
}
|
|
}
|
|
})
|
|
if (this.carList.get(id).purchasePrice ==
|
|
'' || this.carList.get(id)
|
|
.purchasePrice == null) {
|
|
if (this.carList.get(id).purchasePrice) {
|
|
this.carList.get(id)
|
|
.purchasePrice = purchaseDetails[0]
|
|
.purchasePrice
|
|
} else {
|
|
this.carList.get(id)
|
|
.purchasePrice =
|
|
purchaseDetails[0]
|
|
.purchasePrice
|
|
}
|
|
|
|
}
|
|
this.carList.get(id).customerCategoryList =
|
|
purchaseDetails[0].customerCategoryRule != null ? this.checkPriceRule(JSON.parse(
|
|
purchaseDetails[0]
|
|
.customerCategoryRule)) : this.getNewProductRule()
|
|
if (this.carList.get(id).productPicture ==
|
|
'') {
|
|
this.carList.get(id).productPicture =
|
|
purchaseDetails[0].productPicture
|
|
}
|
|
if (purchaseDetails[0].productId) {
|
|
this.carList.get(id).attrId =
|
|
purchaseDetails[0].attrId
|
|
this.carList.get(id).wholesalePrice =
|
|
purchaseDetails[0].wholesalePrice
|
|
this.carList.get(id).lsPrice =
|
|
purchaseDetails[0].lsPrice
|
|
}
|
|
|
|
let specMap =
|
|
new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList.forEach(function(
|
|
value, key) {
|
|
if (key != value
|
|
.id) {
|
|
specMap.set(
|
|
value
|
|
.id,
|
|
value)
|
|
} else {
|
|
specMap.set(
|
|
key,
|
|
value)
|
|
}
|
|
})
|
|
this.carList = specMap
|
|
})
|
|
this.$nextTick(() => {
|
|
for (let j = 0; j <
|
|
purchaseDetails.length; j++
|
|
) {
|
|
for (let i = 0; i <
|
|
purchaseDetails[j]
|
|
.stockLogList1
|
|
.length; i++) {
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.name = this
|
|
.sliceMsg(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList)
|
|
if (this.carList.get(
|
|
id)
|
|
.stockLogList
|
|
.size == 0) {
|
|
this.carList.get(
|
|
id)
|
|
.stockLogList
|
|
.set(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList,
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i])
|
|
} else {
|
|
if (this.carList
|
|
.get(id)
|
|
.stockLogList
|
|
.has(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList
|
|
) == true
|
|
) {
|
|
this.carList
|
|
.get(id)
|
|
.stockLogList
|
|
.get(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList
|
|
)
|
|
.productCount +=
|
|
Number(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.productCount
|
|
)
|
|
} else {
|
|
this.carList
|
|
.get(id)
|
|
.stockLogList
|
|
.set(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList,
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i])
|
|
}
|
|
}
|
|
this.carList.get(id)
|
|
.productCount +=
|
|
Number(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.productCount)
|
|
}
|
|
}
|
|
this.carList.get(id).price1 =
|
|
Number(this.carList.get(id)
|
|
.productCount) * this
|
|
.carList.get(id)
|
|
.purchasePrice
|
|
if (this.carList.get(id)
|
|
.stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
).productCount == 0 &&
|
|
purchaseDetails[0]
|
|
.stockLogList1.length > 0
|
|
) {
|
|
this.carList.get(id)
|
|
.stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
}
|
|
})
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
this.getAllPrice()
|
|
this.oneGoodsId = ''
|
|
})
|
|
} else {
|
|
if (purchaseDetails) {
|
|
this.carList1.push(item)
|
|
this.$nextTick(() => {
|
|
this.AiVoice()
|
|
})
|
|
|
|
} else {
|
|
this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
}
|
|
setTimeout(() => {
|
|
this.showTan = true; // 再显示下一个弹出层
|
|
this.currentPopupIndex += 1;
|
|
}, 0);
|
|
} else {
|
|
this.showTan = false; // 如果没有更多弹出层,则关闭最后一个弹出层
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
|
|
let data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
productCount: Number(item.productCount) || 1,
|
|
productNum: item.defaultStockCount
|
|
}
|
|
item.productId = item.id
|
|
item.saleDetailQueryDTO = []
|
|
item.saleDetailQueryDTO.push(data)
|
|
|
|
|
|
let purchaseDetails = []
|
|
|
|
purchaseDetails.push(item)
|
|
let id = this.oneGoodsId
|
|
if (this.oneGoodsId) {
|
|
if (this.carList.get(id).productSn != '') {
|
|
for (let j = 0; j < purchaseDetails.length; j++) {
|
|
for (let i = 0; i < purchaseDetails[j]
|
|
.stockLogList1.length; i++) {
|
|
if (this.carList.get(id)
|
|
.productName == '') {
|
|
this.carList.get(id)
|
|
.productName =
|
|
purchaseDetails[0]
|
|
.productName
|
|
}
|
|
if (this.carList.get(id).attrId ==
|
|
'') {
|
|
this.carList.get(id).attrId =
|
|
purchaseDetails[0].attrId
|
|
}
|
|
if (this.carList.get(id)
|
|
.purchasePrice == '' || this
|
|
.carList.get(id)
|
|
.purchasePrice == null) {
|
|
if (voiceData.purchasePrice) {
|
|
this.carList.get(id)
|
|
.purchasePrice =
|
|
voiceData.purchasePrice
|
|
} else {
|
|
this.carList.get(id)
|
|
.purchasePrice =
|
|
purchaseDetails[0]
|
|
.purchasePrice
|
|
}
|
|
|
|
}
|
|
if (this.carList.get(id)
|
|
.productPicture == '') {
|
|
this.carList.get(id)
|
|
.productPicture =
|
|
purchaseDetails[0]
|
|
.productPicture
|
|
}
|
|
this.carList.get(id)
|
|
.customerCategoryRule =
|
|
this.checkPriceRule(JSON.parse(purchaseDetails[0]
|
|
.customerCategoryRule))
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.name = this.sliceMsg(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList)
|
|
if (this.carList.get(id)
|
|
.stockLogList.size == 0) {
|
|
this.carList.get(id)
|
|
.stockLogList.set(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList,
|
|
purchaseDetails[j]
|
|
.stockLogList1[i])
|
|
} else {
|
|
if (this.carList.get(id)
|
|
.stockLogList.has(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList) == true
|
|
) {
|
|
this.carList.get(id)
|
|
.stockLogList.get(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList)
|
|
.productCount +=
|
|
Number(purchaseDetails[
|
|
j]
|
|
.stockLogList1[i]
|
|
.productCount)
|
|
} else {
|
|
this.carList.get(id)
|
|
.stockLogList.set(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList,
|
|
purchaseDetails[j]
|
|
.stockLogList1[i])
|
|
}
|
|
}
|
|
this.carList.get(id)
|
|
.productCount +=
|
|
Number(purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount)
|
|
}
|
|
}
|
|
this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
.productNum = purchaseDetails[0].defaultStockCount
|
|
if (this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
.productCount == 0 && purchaseDetails[
|
|
0].stockLogList1.length > 0) {
|
|
this.carList.get(id).stockLogList
|
|
.delete('{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
this.carList.get(id).price1 = Number(this
|
|
.carList
|
|
.get(id).productCount) * this
|
|
.carList
|
|
.get(id).purchasePrice
|
|
} else {
|
|
|
|
let isTrue = false
|
|
this.carList.forEach(function(value, key) {
|
|
if (value.productSn == purchaseDetails[0].productSn) {
|
|
isTrue = true
|
|
that.tui.toast(
|
|
'该货号被页面其他商品占用,请重新输入!'
|
|
)
|
|
that.carList.get(id)
|
|
.productSn = ''
|
|
setTimeout(res => {
|
|
that.$forceUpdate()
|
|
}, 1000)
|
|
throw Error('被占用')
|
|
}
|
|
})
|
|
|
|
this.$nextTick(() => {
|
|
if (this.carList.get(id)
|
|
.productName == '') {
|
|
this.carList.get(id)
|
|
.productName =
|
|
purchaseDetails[0]
|
|
.productName
|
|
}
|
|
this.carList.get(id)
|
|
.customerCategoryList =
|
|
purchaseDetails[0]
|
|
.customerCategoryRule != null ?
|
|
this.checkPriceRule(JSON.parse(purchaseDetails[0]
|
|
.customerCategoryRule)) : null
|
|
if (isTrue == false && this
|
|
.carList.get(id)
|
|
.productSn == '') {
|
|
this.carList.get(id)
|
|
.productSn =
|
|
purchaseDetails[0]
|
|
.productSn
|
|
}
|
|
if (isTrue == false) {
|
|
if (purchaseDetails[0]
|
|
.productId) {
|
|
this.carList.get(id)
|
|
.id =
|
|
purchaseDetails[0]
|
|
.productId
|
|
this.carList.get(id)
|
|
.productId =
|
|
purchaseDetails[0]
|
|
.productId
|
|
this.carList.get(id)
|
|
.isNew = false
|
|
id = purchaseDetails[0]
|
|
.productId
|
|
|
|
} else if (purchaseDetails[
|
|
0].productSn ==
|
|
'' || purchaseDetails[
|
|
0].productSn ==
|
|
null) {
|
|
this.carList.get(id)
|
|
.id =
|
|
purchaseDetails[0]
|
|
.productName
|
|
id = purchaseDetails[0]
|
|
.productName
|
|
} else if (purchaseDetails[
|
|
0].productSn ==
|
|
'货号') {
|
|
this.carList.get(id)
|
|
.productSn =
|
|
purchaseDetails[0]
|
|
.productName
|
|
this.carList.get(id)
|
|
.id =
|
|
purchaseDetails[0]
|
|
.productName
|
|
id = purchaseDetails[0]
|
|
.productName
|
|
} else if (purchaseDetails[
|
|
0].productSn) {
|
|
this.carList.get(id)
|
|
.id =
|
|
purchaseDetails[0]
|
|
.productSn
|
|
id = purchaseDetails[0]
|
|
.productSn
|
|
}
|
|
}
|
|
})
|
|
if (this.carList.get(id).purchasePrice ==
|
|
'' || this.carList.get(id)
|
|
.purchasePrice == null) {
|
|
if (purchaseDetails[0].purchasePrice) {
|
|
this.carList.get(id)
|
|
.purchasePrice = purchaseDetails[0]
|
|
.purchasePrice
|
|
} else {
|
|
this.carList.get(id)
|
|
.purchasePrice =
|
|
purchaseDetails[0]
|
|
.purchasePrice
|
|
}
|
|
|
|
}
|
|
this.carList.get(id).customerCategoryList =
|
|
purchaseDetails[0].customerCategoryRule != null ? this.checkPriceRule(JSON.parse(
|
|
purchaseDetails[0]
|
|
.customerCategoryRule)) : this.getNewProductRule()
|
|
if (this.carList.get(id).productPicture ==
|
|
'') {
|
|
this.carList.get(id).productPicture =
|
|
purchaseDetails[0].productPicture
|
|
}
|
|
if (purchaseDetails[0].productId) {
|
|
this.carList.get(id).attrId =
|
|
purchaseDetails[0].attrId
|
|
this.carList.get(id).wholesalePrice =
|
|
purchaseDetails[0].wholesalePrice
|
|
this.carList.get(id).lsPrice =
|
|
purchaseDetails[0].lsPrice
|
|
}
|
|
|
|
let specMap =
|
|
new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList.forEach(function(
|
|
value, key) {
|
|
if (key != value
|
|
.id) {
|
|
specMap.set(
|
|
value
|
|
.id,
|
|
value)
|
|
} else {
|
|
specMap.set(
|
|
key,
|
|
value)
|
|
}
|
|
})
|
|
this.carList = specMap
|
|
})
|
|
this.$nextTick(() => {
|
|
for (let j = 0; j < purchaseDetails.length; j++) {
|
|
for (let i = 0; i <
|
|
purchaseDetails[j]
|
|
.saleDetailQueryDTO.length; i++) {
|
|
purchaseDetails[j]
|
|
.saleDetailQueryDTO[i]
|
|
.name = this
|
|
.sliceMsg(
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.attributeList)
|
|
if (this.carList.get(
|
|
id)
|
|
.stockLogList
|
|
.size == 0) {
|
|
this.carList.get(
|
|
id)
|
|
.stockLogList
|
|
.set(
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.attributeList,
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i])
|
|
} else {
|
|
if (this.carList
|
|
.get(id)
|
|
.stockLogList
|
|
.has(
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.attributeList
|
|
) == true
|
|
) {
|
|
this.carList
|
|
.get(id)
|
|
.stockLogList
|
|
.get(
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.attributeList
|
|
)
|
|
.productCount +=
|
|
Number(
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.productCount
|
|
)
|
|
} else {
|
|
this.carList
|
|
.get(id)
|
|
.stockLogList
|
|
.set(
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.attributeList,
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i])
|
|
}
|
|
}
|
|
this.carList.get(id)
|
|
.productCount +=
|
|
Number(
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.productCount)
|
|
}
|
|
}
|
|
this.carList.get(id).price1 =
|
|
Number(this.carList.get(id)
|
|
.productCount) * this
|
|
.carList.get(id)
|
|
.purchasePrice
|
|
this.carList.get(id)
|
|
.stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
).productNum = purchaseDetails[0].defaultStockCount
|
|
if (this.carList.get(id)
|
|
.stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
).productCount == 0 &&
|
|
purchaseDetails[0]
|
|
.saleDetailQueryDTO.length > 0
|
|
) {
|
|
this.carList.get(id)
|
|
.stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
}
|
|
})
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
this.getAllPrice()
|
|
this.oneGoodsId = ''
|
|
this.moreData = []
|
|
})
|
|
} else {
|
|
if (purchaseDetails) {
|
|
this.moreData = []
|
|
this.carList1.push(item)
|
|
this.$nextTick(() => {
|
|
this.AiVoice()
|
|
})
|
|
|
|
} else {
|
|
this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
}
|
|
|
|
}
|
|
},
|
|
//确认语音输入的内容
|
|
async setDetail(e) {
|
|
let that = this;
|
|
if (this.voiceText == '') {
|
|
this.tui.toast('识别内容不能为空')
|
|
return
|
|
}
|
|
let convertedStr = this.trimWhitespace(this.voiceText);
|
|
convertedStr = this.convertChineseToArabic(convertedStr);
|
|
if (convertedStr.indexOf('件数') != -1) {
|
|
convertedStr = convertedStr.replace(/件数/g, '数量:')
|
|
}
|
|
if (convertedStr.indexOf('数量') == -1 && convertedStr.indexOf('名称') == -1 && convertedStr.indexOf(
|
|
'单价') == -1 && convertedStr.indexOf('批发价') == -1) {
|
|
convertedStr = convertedStr + ','
|
|
}
|
|
if (convertedStr.indexOf('点') != -1) {
|
|
convertedStr = this.replaceCharAfterNumber(convertedStr, '点', '.')
|
|
}
|
|
if (convertedStr.indexOf(',名称') != -1) {
|
|
convertedStr = convertedStr.replace(/,名称/g, '名称')
|
|
}
|
|
if (convertedStr.indexOf('名称,') != -1) {
|
|
convertedStr = convertedStr.replace(/名称,/g, '名称')
|
|
}
|
|
if (convertedStr.indexOf('名称::') != -1) {
|
|
convertedStr = convertedStr.replace(/名称::/g, '名称')
|
|
}
|
|
if (convertedStr.indexOf('名称:') != -1) {
|
|
convertedStr = convertedStr.replace(/名称:/g, '名称')
|
|
}
|
|
if (convertedStr.indexOf('名称') != -1) {
|
|
convertedStr = convertedStr.replace(/名称/g, ',名称:')
|
|
}
|
|
if (convertedStr.indexOf(',单价') != -1) {
|
|
convertedStr = convertedStr.replace(/,单价/g, '单价')
|
|
}
|
|
if (convertedStr.indexOf('单价,') != -1) {
|
|
convertedStr = convertedStr.replace(/单价,/g, '单价')
|
|
}
|
|
if (convertedStr.indexOf('单价::') != -1) {
|
|
convertedStr = convertedStr.replace(/单价::/g, '单价')
|
|
}
|
|
if (convertedStr.indexOf('单价:') != -1) {
|
|
convertedStr = convertedStr.replace(/单价:/g, '单价')
|
|
}
|
|
if (convertedStr.indexOf('单价') != -1) {
|
|
convertedStr = convertedStr.replace(/单价/g, ',单价:')
|
|
}
|
|
if (convertedStr.indexOf(',数量') != -1) {
|
|
convertedStr = convertedStr.replace(/,数量/g, '数量')
|
|
}
|
|
if (convertedStr.indexOf('数量,') != -1) {
|
|
convertedStr = convertedStr.replace(/数量,/g, '数量')
|
|
}
|
|
if (convertedStr.indexOf('数量::') != -1) {
|
|
convertedStr = convertedStr.replace(/数量::/g, '数量')
|
|
}
|
|
if (convertedStr.indexOf('数量:') != -1) {
|
|
convertedStr = convertedStr.replace(/数量:/g, '数量')
|
|
}
|
|
if (convertedStr.indexOf('数量') != -1) {
|
|
convertedStr = convertedStr.replace(/数量/g, ',数量:')
|
|
}
|
|
|
|
|
|
if (convertedStr.indexOf(',批发价') != -1) {
|
|
convertedStr = convertedStr.replace(/,批发价/g, '批发价')
|
|
}
|
|
if (convertedStr.indexOf('批发价,') != -1) {
|
|
convertedStr = convertedStr.replace(/批发价,/g, '批发价')
|
|
}
|
|
if (convertedStr.indexOf('批发价::') != -1) {
|
|
convertedStr = convertedStr.replace(/批发价::/g, '批发价')
|
|
}
|
|
if (convertedStr.indexOf('批发价:') != -1) {
|
|
convertedStr = convertedStr.replace(/批发价:/g, '批发价')
|
|
}
|
|
if (convertedStr.indexOf('批发价') != -1) {
|
|
convertedStr = convertedStr.replace(/批发价/g, ',批发价:')
|
|
}
|
|
|
|
if (convertedStr.indexOf(',零售价') != -1) {
|
|
convertedStr = convertedStr.replace(/,零售价/g, '零售价')
|
|
}
|
|
if (convertedStr.indexOf('零售价,') != -1) {
|
|
convertedStr = convertedStr.replace(/零售价,/g, '零售价')
|
|
}
|
|
if (convertedStr.indexOf('零售价::') != -1) {
|
|
convertedStr = convertedStr.replace(/零售价::/g, '零售价')
|
|
}
|
|
if (convertedStr.indexOf('零售价:') != -1) {
|
|
convertedStr = convertedStr.replace(/零售价:/g, '零售价')
|
|
}
|
|
if (convertedStr.indexOf('零售价') != -1) {
|
|
convertedStr = convertedStr.replace(/零售价/g, ',零售价:')
|
|
}
|
|
|
|
if (convertedStr.startsWith("号")) {
|
|
convertedStr = "货号" + convertedStr.substr(1);
|
|
}
|
|
if (!convertedStr.startsWith("货号")) {
|
|
convertedStr = "货号" + convertedStr;
|
|
}
|
|
if (convertedStr.indexOf('货号,') != -1) {
|
|
convertedStr = convertedStr.replace(/货号,/g, '货号')
|
|
}
|
|
if (convertedStr.indexOf('货号::') != -1) {
|
|
convertedStr = convertedStr.replace(/货号::/g, '货号')
|
|
}
|
|
if (convertedStr.indexOf('货号:') != -1) {
|
|
convertedStr = convertedStr.replace(/货号:/g, '货号')
|
|
}
|
|
convertedStr = this.convertStringCorrectly(convertedStr)
|
|
convertedStr = this.spliceMsg(convertedStr)
|
|
if (convertedStr.indexOf(',') == 0) {
|
|
convertedStr = convertedStr.substr(1)
|
|
}
|
|
this.getMsg = convertedStr
|
|
let regexCount = /-?\d+/g;
|
|
//兰姐牛仔家没有销,拿,数量,卖,件数,退,走通义千问
|
|
let isLanJie = true
|
|
let shopId = uni.getStorageSync('shopId')
|
|
if ((shopId == '1863043415453863936' || shopId == '1855423693308694528' || shopId ==
|
|
'1810179818189361152') && convertedStr.indexOf('数量') == -1) {
|
|
isLanJie = false
|
|
}
|
|
if (convertedStr.indexOf('色') == -1 && convertedStr.indexOf('码') == -1 && isLanJie) {
|
|
if (!convertedStr.startsWith("货号")) {
|
|
convertedStr = "货号" + convertedStr;
|
|
}
|
|
try {
|
|
const regex = /货号.*?(?=货号|$)/g;
|
|
convertedStr = convertedStr.match(regex);
|
|
for (let i = 0; i < convertedStr.length; i++) {
|
|
// setTimeout(res => {
|
|
if (this.voiceGetOneData == true) {
|
|
let voiceData = this.extractInfo(convertedStr[i] + '。')
|
|
if (voiceData.productSn) {
|
|
voiceData.productSn = voiceData.productSn.replace(/[沟勾钩]/g, 'J');
|
|
}
|
|
if (voiceData.productCount) {
|
|
voiceData.productCount = Number(voiceData.productCount.replace(/[^0-9]/g, ""));
|
|
}
|
|
if (voiceData.purchasePrice) {
|
|
voiceData.purchasePrice = this.replaceCharAfterNumber(voiceData
|
|
.purchasePrice, '块', '.')
|
|
if (voiceData.purchasePrice.indexOf('元') != -1) {
|
|
voiceData.purchasePrice = voiceData.purchasePrice.replace(/元/g, '')
|
|
}
|
|
voiceData.purchasePrice = voiceData.purchasePrice.replace(/[^0-9.]/g, "");
|
|
|
|
}
|
|
if (voiceData.wholesalePrice) {
|
|
voiceData.wholesalePrice = this.replaceCharAfterNumber(voiceData
|
|
.wholesalePrice, '块', '.')
|
|
if (voiceData.wholesalePrice.indexOf('元') != -1) {
|
|
voiceData.wholesalePrice = voiceData.wholesalePrice.replace(/元/g, '')
|
|
}
|
|
voiceData.wholesalePrice = voiceData.wholesalePrice.replace(/[^0-9.]/g,
|
|
'');
|
|
}
|
|
if (voiceData.lsprice) {
|
|
voiceData.lsprice = this.replaceCharAfterNumber(voiceData
|
|
.lsprice, '块', '.')
|
|
if (voiceData.lsprice.indexOf('元') != -1) {
|
|
voiceData.lsprice = voiceData.lsprice.replace(/元/g, '')
|
|
}
|
|
voiceData.lsprice = voiceData.lsprice.replace(/[^0-9.]/g,
|
|
'');
|
|
}
|
|
if (i == convertedStr.length - 1) {
|
|
setTimeout(res => {
|
|
this.getOneData(voiceData, true, 200 * (i + 1))
|
|
}, 200 * (i + 1))
|
|
} else {
|
|
setTimeout(res => {
|
|
this.getOneData(voiceData, false, 200 * (i + 1))
|
|
}, 200 * (i + 1))
|
|
|
|
}
|
|
} else {
|
|
setTimeout(res => {
|
|
if (convertedStr[i].indexOf('数量') == -1 && convertedStr[i].indexOf('名称') ==
|
|
-1 && convertedStr[i].indexOf(
|
|
'单价') == -1 && convertedStr[i].indexOf('批发价') == -1 &&
|
|
convertedStr[i].indexOf(',') == -1) {
|
|
convertedStr[i] = convertedStr[i] + ','
|
|
}
|
|
let voiceData = this.extractInfo(convertedStr[i] + '。')
|
|
if (voiceData.productSn) {
|
|
voiceData.productSn = voiceData.productSn.replace(/[沟勾钩]/g, 'J');
|
|
}
|
|
if (voiceData.productCount) {
|
|
voiceData.productCount = voiceData.productCount.match(regexCount);
|
|
}
|
|
if (voiceData.purchasePrice) {
|
|
voiceData.purchasePrice = this.replaceCharAfterNumber(voiceData
|
|
.purchasePrice, '块', '.')
|
|
if (voiceData.purchasePrice.indexOf('元') != -1) {
|
|
voiceData.purchasePrice = voiceData.purchasePrice.replace(/元/g, '')
|
|
}
|
|
voiceData.purchasePrice = voiceData.purchasePrice.replace(/[^0-9.]/g,
|
|
"");
|
|
|
|
}
|
|
if (voiceData.wholesalePrice) {
|
|
voiceData.wholesalePrice = this.replaceCharAfterNumber(voiceData
|
|
.wholesalePrice, '块', '.')
|
|
if (voiceData.wholesalePrice.indexOf('元') != -1) {
|
|
voiceData.wholesalePrice = voiceData.wholesalePrice.replace(/元/g,
|
|
'')
|
|
}
|
|
voiceData.wholesalePrice = voiceData.wholesalePrice.replace(/[^0-9.]/g,
|
|
"");
|
|
}
|
|
if (voiceData.lsprice) {
|
|
voiceData.lsprice = this.replaceCharAfterNumber(voiceData
|
|
.lsprice, '块', '.')
|
|
if (voiceData.lsprice.indexOf('元') != -1) {
|
|
voiceData.lsprice = voiceData.lsprice.replace(/元/g,
|
|
'')
|
|
}
|
|
voiceData.lsprice = voiceData.lsprice.replace(/[^0-9.]/g,
|
|
"");
|
|
}
|
|
this.tui.request('/app/product/getByProductSn', "post", {
|
|
productSn: voiceData.productSn
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.result != '') {
|
|
this.voiceText = ''
|
|
this.$refs.popup.close()
|
|
this.tui.request(
|
|
"/app/productAttribute/selectAttributeAndValueByCategoryId",
|
|
"POST", {
|
|
categoryId: res.result[0].attrId
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
let data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
productCount: Number(voiceData
|
|
.productCount) ||
|
|
1,
|
|
stockCount: null
|
|
}
|
|
if (res1.result.stock.length > 0) {
|
|
for (let i = 0; i < res1.result
|
|
.stock.length; i++) {
|
|
if (res1.result.stock[i]
|
|
.attributeList ==
|
|
'{"颜色":"均色","尺码":"均码"}') {
|
|
data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
productCount: Number(
|
|
voiceData
|
|
.productCount
|
|
) || 1,
|
|
stockCount: res1
|
|
.result.stock[
|
|
i]
|
|
.stockCount
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (voiceData.purchasePrice) {
|
|
voiceData.purchasePrice = this
|
|
.replaceCharAfterNumber(
|
|
voiceData
|
|
.purchasePrice, '块', '.')
|
|
if (voiceData.purchasePrice
|
|
.indexOf('元') != -1) {
|
|
voiceData.purchasePrice =
|
|
voiceData
|
|
.purchasePrice.replace(
|
|
/元/g, '')
|
|
}
|
|
voiceData.purchasePrice = voiceData
|
|
.purchasePrice
|
|
.replace(/[^0-9.]/g, "");
|
|
|
|
}
|
|
if (voiceData.wholesalePrice) {
|
|
voiceData.wholesalePrice = this
|
|
.replaceCharAfterNumber(
|
|
voiceData
|
|
.wholesalePrice, '块', '.')
|
|
if (voiceData.wholesalePrice
|
|
.indexOf('元') != -1) {
|
|
voiceData.wholesalePrice =
|
|
voiceData
|
|
.wholesalePrice.replace(
|
|
/元/g, '')
|
|
}
|
|
voiceData.wholesalePrice =
|
|
voiceData.wholesalePrice
|
|
.replace(
|
|
/[^0-9.]/g, "");
|
|
}
|
|
res.result[0].productId = res.result[0]
|
|
.id
|
|
res.result[0].stockLogList1 = []
|
|
res.result[0].stockLogList1.push(data)
|
|
let purchaseDetails = res.result
|
|
if (this.oneGoodsId) {
|
|
let id = this.oneGoodsId
|
|
if (purchaseDetails.length > 0) {
|
|
if (this.carList.get(id)
|
|
.productSn != '') {
|
|
for (let j = 0; j <
|
|
purchaseDetails
|
|
.length; j++) {
|
|
for (let i = 0; i <
|
|
purchaseDetails[j]
|
|
.stockLogList1
|
|
.length; i++) {
|
|
if (this.carList
|
|
.get(id)
|
|
.productName ==
|
|
'') {
|
|
this.carList
|
|
.get(id)
|
|
.productName =
|
|
purchaseDetails[
|
|
0]
|
|
.productName
|
|
}
|
|
if (this.carList
|
|
.get(id)
|
|
.attrId ==
|
|
'') {
|
|
this.carList
|
|
.get(id)
|
|
.attrId =
|
|
purchaseDetails[
|
|
0]
|
|
.attrId
|
|
}
|
|
if (this.carList
|
|
.get(id)
|
|
.purchasePrice ==
|
|
'' || this
|
|
.carList.get(
|
|
id)
|
|
.purchasePrice ==
|
|
null) {
|
|
if (voiceData
|
|
.purchasePrice
|
|
) {
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.purchasePrice =
|
|
voiceData
|
|
.purchasePrice
|
|
} else {
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.purchasePrice =
|
|
purchaseDetails[
|
|
0]
|
|
.purchasePrice
|
|
}
|
|
|
|
}
|
|
if (this.carList
|
|
.get(id)
|
|
.productPicture ==
|
|
'') {
|
|
this.carList
|
|
.get(id)
|
|
.productPicture =
|
|
purchaseDetails[
|
|
0]
|
|
.productPicture
|
|
}
|
|
this.carList.get(
|
|
id)
|
|
.customerCategoryRule =
|
|
this
|
|
.checkPriceRule(
|
|
JSON.parse(
|
|
purchaseDetails[
|
|
0]
|
|
.customerCategoryRule
|
|
))
|
|
purchaseDetails[j]
|
|
.stockLogList1[
|
|
i]
|
|
.name = this
|
|
.sliceMsg(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList
|
|
)
|
|
if (this.carList
|
|
.get(id)
|
|
.stockLogList
|
|
.size == 0) {
|
|
this.carList
|
|
.get(id)
|
|
.stockLogList
|
|
.set(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList,
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i])
|
|
} else {
|
|
if (this
|
|
.carList
|
|
.get(id)
|
|
.stockLogList
|
|
.has(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList
|
|
) ==
|
|
true
|
|
) {
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.stockLogList
|
|
.get(
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
.attributeList
|
|
)
|
|
.productNum =
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
.stockCount
|
|
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.stockLogList
|
|
.get(
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
.attributeList
|
|
)
|
|
.productCount +=
|
|
Number(
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
.productCount
|
|
)
|
|
} else {
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.stockLogList
|
|
.set(
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
.attributeList,
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
)
|
|
}
|
|
}
|
|
this.carList.get(
|
|
id)
|
|
.productCount +=
|
|
Number(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.productCount
|
|
)
|
|
}
|
|
}
|
|
if (this.carList.get(id)
|
|
.stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
.productCount == 0 &&
|
|
purchaseDetails[
|
|
0].stockLogList1
|
|
.length > 0) {
|
|
this.carList.get(id)
|
|
.stockLogList
|
|
.delete(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
}
|
|
this.carList.get(id)
|
|
.price1 = Number(this
|
|
.carList
|
|
.get(id)
|
|
.productCount) *
|
|
this
|
|
.carList
|
|
.get(id).purchasePrice
|
|
} else {
|
|
|
|
let isTrue = false
|
|
this.carList.forEach(
|
|
function(value,
|
|
key) {
|
|
if (value
|
|
.productSn ==
|
|
purchaseDetails[
|
|
0]
|
|
.productSn
|
|
) {
|
|
isTrue =
|
|
true
|
|
that.tui
|
|
.toast(
|
|
'该货号被页面其他商品占用,请重新输入!'
|
|
)
|
|
that.carList
|
|
.get(
|
|
id)
|
|
.productSn =
|
|
''
|
|
setTimeout(
|
|
res => {
|
|
that.$forceUpdate()
|
|
},
|
|
1000
|
|
)
|
|
throw Error(
|
|
'被占用'
|
|
)
|
|
}
|
|
})
|
|
|
|
this.$nextTick(() => {
|
|
if (this
|
|
.carList
|
|
.get(id)
|
|
.productName ==
|
|
'') {
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.productName =
|
|
purchaseDetails[
|
|
0]
|
|
.productName
|
|
}
|
|
this.carList
|
|
.get(id)
|
|
.customerCategoryList =
|
|
purchaseDetails[
|
|
0]
|
|
.customerCategoryRule !=
|
|
null ?
|
|
this
|
|
.checkPriceRule(
|
|
JSON
|
|
.parse(
|
|
purchaseDetails[
|
|
0
|
|
]
|
|
.customerCategoryRule
|
|
)) :
|
|
null
|
|
if (isTrue ==
|
|
false &&
|
|
this
|
|
.carList
|
|
.get(id)
|
|
.productSn ==
|
|
'') {
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.productSn =
|
|
purchaseDetails[
|
|
0]
|
|
.productSn
|
|
}
|
|
if (isTrue ==
|
|
false) {
|
|
if (purchaseDetails[
|
|
0]
|
|
.productId
|
|
) {
|
|
this.carList
|
|
.get(
|
|
id
|
|
)
|
|
.id =
|
|
purchaseDetails[
|
|
0
|
|
]
|
|
.productId
|
|
this.carList
|
|
.get(
|
|
id
|
|
)
|
|
.productId =
|
|
purchaseDetails[
|
|
0
|
|
]
|
|
.productId
|
|
this.carList
|
|
.get(
|
|
id
|
|
)
|
|
.isNew =
|
|
false
|
|
id = purchaseDetails[
|
|
0
|
|
]
|
|
.productId
|
|
|
|
} else if (
|
|
purchaseDetails[
|
|
0]
|
|
.productSn ==
|
|
'' ||
|
|
purchaseDetails[
|
|
0]
|
|
.productSn ==
|
|
null) {
|
|
this.carList
|
|
.get(
|
|
id
|
|
)
|
|
.id =
|
|
purchaseDetails[
|
|
0
|
|
]
|
|
.productName
|
|
id = purchaseDetails[
|
|
0
|
|
]
|
|
.productName
|
|
} else if (
|
|
purchaseDetails[
|
|
0]
|
|
.productSn ==
|
|
'货号') {
|
|
this.carList
|
|
.get(
|
|
id
|
|
)
|
|
.productSn =
|
|
purchaseDetails[
|
|
0
|
|
]
|
|
.productName
|
|
this.carList
|
|
.get(
|
|
id
|
|
)
|
|
.id =
|
|
purchaseDetails[
|
|
0
|
|
]
|
|
.productName
|
|
id = purchaseDetails[
|
|
0
|
|
]
|
|
.productName
|
|
} else if (
|
|
purchaseDetails[
|
|
0]
|
|
.productSn
|
|
) {
|
|
this.carList
|
|
.get(
|
|
id
|
|
)
|
|
.id =
|
|
purchaseDetails[
|
|
0
|
|
]
|
|
.productSn
|
|
id = purchaseDetails[
|
|
0
|
|
]
|
|
.productSn
|
|
}
|
|
}
|
|
})
|
|
if (this.carList.get(id)
|
|
.purchasePrice ==
|
|
'' || this.carList.get(
|
|
id)
|
|
.purchasePrice == null
|
|
) {
|
|
if (voiceData
|
|
.purchasePrice) {
|
|
this.carList.get(
|
|
id)
|
|
.purchasePrice =
|
|
voiceData
|
|
.purchasePrice
|
|
} else {
|
|
this.carList.get(
|
|
id)
|
|
.purchasePrice =
|
|
purchaseDetails[
|
|
0]
|
|
.purchasePrice
|
|
}
|
|
|
|
}
|
|
this.carList.get(id)
|
|
.customerCategoryList =
|
|
purchaseDetails[0]
|
|
.customerCategoryRule !=
|
|
null ? this
|
|
.checkPriceRule(JSON
|
|
.parse(
|
|
purchaseDetails[
|
|
0]
|
|
.customerCategoryRule
|
|
)) : this
|
|
.getNewProductRule()
|
|
if (this.carList.get(id)
|
|
.productPicture ==
|
|
'') {
|
|
this.carList.get(id)
|
|
.productPicture =
|
|
purchaseDetails[0]
|
|
.productPicture
|
|
}
|
|
if (purchaseDetails[0]
|
|
.productId) {
|
|
this.carList.get(id)
|
|
.attrId =
|
|
purchaseDetails[0]
|
|
.attrId
|
|
this.carList.get(id)
|
|
.wholesalePrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id)
|
|
.lsPrice =
|
|
purchaseDetails[0]
|
|
.lsPrice
|
|
}
|
|
|
|
let specMap =
|
|
new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList
|
|
.forEach(
|
|
function(
|
|
value,
|
|
key
|
|
) {
|
|
if (key !=
|
|
value
|
|
.id
|
|
) {
|
|
specMap
|
|
.set(
|
|
value
|
|
.id,
|
|
value
|
|
)
|
|
} else {
|
|
specMap
|
|
.set(
|
|
key,
|
|
value
|
|
)
|
|
}
|
|
})
|
|
this.carList =
|
|
specMap
|
|
})
|
|
this.$nextTick(() => {
|
|
for (let j =
|
|
0; j <
|
|
purchaseDetails
|
|
.length; j++
|
|
) {
|
|
for (let i =
|
|
0; i <
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1
|
|
.length; i++
|
|
) {
|
|
purchaseDetails
|
|
[j]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
.name =
|
|
this
|
|
.sliceMsg(
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
.attributeList
|
|
)
|
|
if (this
|
|
.carList
|
|
.get(
|
|
id
|
|
)
|
|
.stockLogList
|
|
.size ==
|
|
0
|
|
) {
|
|
this.carList
|
|
.get(
|
|
id
|
|
)
|
|
.stockLogList
|
|
.set(
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
.attributeList,
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
)
|
|
} else {
|
|
if (this
|
|
.carList
|
|
.get(
|
|
id
|
|
)
|
|
.stockLogList
|
|
.has(
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
.attributeList
|
|
) ==
|
|
true
|
|
) {
|
|
this.carList
|
|
.get(
|
|
id
|
|
)
|
|
.stockLogList
|
|
.get(
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
.attributeList
|
|
)
|
|
.productNum =
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
.stockCount
|
|
|
|
|
|
this.carList
|
|
.get(
|
|
id
|
|
)
|
|
.stockLogList
|
|
.get(
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
.attributeList
|
|
)
|
|
.productCount +=
|
|
Number(
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
.productCount
|
|
)
|
|
} else {
|
|
this.carList
|
|
.get(
|
|
id
|
|
)
|
|
.stockLogList
|
|
.set(
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
.attributeList,
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
)
|
|
}
|
|
}
|
|
this.carList
|
|
.get(
|
|
id
|
|
)
|
|
.productCount +=
|
|
Number(
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.stockLogList1[
|
|
i
|
|
]
|
|
.productCount
|
|
)
|
|
}
|
|
}
|
|
this.carList
|
|
.get(id)
|
|
.price1 =
|
|
Number(this
|
|
.carList
|
|
.get(
|
|
id)
|
|
.productCount
|
|
) *
|
|
this
|
|
.carList
|
|
.get(id)
|
|
.purchasePrice
|
|
if (this
|
|
.carList
|
|
.get(id)
|
|
.stockLogList
|
|
.get(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
.productCount ==
|
|
0 &&
|
|
purchaseDetails[
|
|
0]
|
|
.stockLogList1
|
|
.length > 0
|
|
) {
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.stockLogList
|
|
.delete(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
}
|
|
})
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
this.getAllPrice()
|
|
this.oneGoodsId =
|
|
''
|
|
})
|
|
} else {
|
|
this.tui.toast(
|
|
"抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确"
|
|
)
|
|
}
|
|
} else {
|
|
for (let i = 0; i < purchaseDetails
|
|
.length; i++) {
|
|
let data1 = {
|
|
id: "",
|
|
price: purchaseDetails[
|
|
i].price,
|
|
productCount: 0,
|
|
customerCategoryList: purchaseDetails[
|
|
i]
|
|
.customerCategoryRule !=
|
|
null ? this
|
|
.checkPriceRule(
|
|
JSON.parse(
|
|
purchaseDetails[
|
|
i]
|
|
.customerCategoryRule
|
|
)) : this
|
|
.getNewProductRule(),
|
|
attrId: purchaseDetails[
|
|
i].attrId,
|
|
categoryId: purchaseDetails[
|
|
i]
|
|
.categoryId == '' ?
|
|
this
|
|
.categoryList
|
|
.categoryId :
|
|
purchaseDetails[i]
|
|
.categoryId,
|
|
categoryName: purchaseDetails[
|
|
i]
|
|
.categoryName ==
|
|
'' ? this
|
|
.categoryList
|
|
.categoryName :
|
|
purchaseDetails[i]
|
|
.categoryName,
|
|
wholesalePrice: voiceData
|
|
.wholesalePrice ?
|
|
voiceData
|
|
.wholesalePrice :
|
|
purchaseDetails[
|
|
i]
|
|
.wholesalePrice,
|
|
purchasePrice: voiceData
|
|
.purchasePrice ?
|
|
voiceData
|
|
.purchasePrice :
|
|
purchaseDetails[i]
|
|
.purchasePrice,
|
|
isNew: purchaseDetails[
|
|
i].productId ==
|
|
null ? true :
|
|
false,
|
|
productId: purchaseDetails[
|
|
i]
|
|
.productId,
|
|
productName: purchaseDetails[
|
|
i]
|
|
.productName,
|
|
productSn: purchaseDetails[
|
|
i]
|
|
.productSn,
|
|
productPicture: purchaseDetails[
|
|
i]
|
|
.productPicture,
|
|
supplierName: purchaseDetails[
|
|
i]
|
|
.supplierName,
|
|
productPictures: [],
|
|
saleDetailQueryDTO: []
|
|
}
|
|
if (purchaseDetails[i]
|
|
.productId) {
|
|
data1.id = purchaseDetails[
|
|
i].productId
|
|
} else if (purchaseDetails[i]
|
|
.productSn ==
|
|
'' || purchaseDetails[i]
|
|
.productSn ==
|
|
null) {
|
|
data1.id = purchaseDetails[
|
|
i].productName
|
|
} else if (purchaseDetails[i]
|
|
.productSn ==
|
|
'货号') {
|
|
data1.productSn =
|
|
purchaseDetails[i]
|
|
.productName
|
|
data1.id = purchaseDetails[
|
|
i].productName
|
|
} else if (purchaseDetails[i]
|
|
.productSn) {
|
|
data1.id = purchaseDetails[
|
|
i].productSn
|
|
}
|
|
for (let m = 0; m <
|
|
purchaseDetails[i]
|
|
.stockLogList1.length; m++
|
|
) {
|
|
let list = {
|
|
attributeList: this
|
|
.getAttribute(
|
|
purchaseDetails[
|
|
i]
|
|
.stockLogList1[
|
|
m]
|
|
.attributeList
|
|
),
|
|
productCount: Number(
|
|
purchaseDetails[
|
|
i]
|
|
.stockLogList1[
|
|
m]
|
|
.productCount
|
|
) ||
|
|
Number(
|
|
purchaseDetails[
|
|
i]
|
|
.stockLogList1[
|
|
m]
|
|
.productCounts
|
|
),
|
|
productNum: purchaseDetails[
|
|
i]
|
|
.stockLogList1[
|
|
m]
|
|
.stockCount,
|
|
name: this
|
|
.sliceMsg(this
|
|
.getAttribute(
|
|
purchaseDetails[
|
|
i]
|
|
.stockLogList1[
|
|
m]
|
|
.attributeList
|
|
)),
|
|
price: purchaseDetails[
|
|
i]
|
|
.stockLogList1[
|
|
m]
|
|
.purchasePrice
|
|
}
|
|
data1.productCount +=
|
|
Number(
|
|
purchaseDetails[i]
|
|
.stockLogList1[m]
|
|
.productCount)
|
|
data1.saleDetailQueryDTO
|
|
.push(list)
|
|
}
|
|
this.carList1.push(data1)
|
|
}
|
|
if (i == convertedStr.length - 1) {
|
|
this.$nextTick(() => {
|
|
setTimeout(res => {
|
|
this.AiVoice()
|
|
}, 300)
|
|
})
|
|
}
|
|
}
|
|
} else {
|
|
this.tui.toast(res1.message)
|
|
}
|
|
}).catch((res) => {})
|
|
|
|
} else {
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.close()
|
|
if (voiceData.productCount) {
|
|
let regexZCount = /\d+/g;
|
|
voiceData.productCount = voiceData.productCount[0]
|
|
.match(regexZCount);
|
|
}
|
|
if (voiceData.purchasePrice) {
|
|
voiceData.purchasePrice = this
|
|
.replaceCharAfterNumber(voiceData
|
|
.purchasePrice, '块', '.')
|
|
if (voiceData.purchasePrice.indexOf('元') != -1) {
|
|
voiceData.purchasePrice = voiceData
|
|
.purchasePrice.replace(/元/g, '')
|
|
}
|
|
voiceData.purchasePrice = voiceData.purchasePrice
|
|
.replace(/[^0-9.]/g, "");
|
|
|
|
}
|
|
if (voiceData.wholesalePrice) {
|
|
voiceData.wholesalePrice = this
|
|
.replaceCharAfterNumber(
|
|
voiceData.wholesalePrice, '块', '.')
|
|
if (voiceData.wholesalePrice.indexOf('元') != -1) {
|
|
voiceData.wholesalePrice = voiceData
|
|
.wholesalePrice.replace(/元/g, '')
|
|
}
|
|
voiceData.wholesalePrice = voiceData.wholesalePrice
|
|
.replace(/[^0-9.]/g, "");
|
|
}
|
|
if (voiceData.lsprice) {
|
|
voiceData.lsprice = this
|
|
.replaceCharAfterNumber(
|
|
voiceData.lsprice, '块', '.')
|
|
if (voiceData.lsprice.indexOf('元') != -1) {
|
|
voiceData.lsprice = voiceData
|
|
.lsprice.replace(/元/g, '')
|
|
}
|
|
voiceData.lsprice = voiceData.lsprice
|
|
.replace(/[^0-9.]/g, "");
|
|
}
|
|
let data = {
|
|
id: voiceData.productSn ? voiceData.productSn :
|
|
generateUUID(),
|
|
productCount: Number(voiceData.productCount) ||
|
|
0,
|
|
productName: voiceData.productName,
|
|
productSn: voiceData.productSn,
|
|
categoryId: this.categoryList.categoryId,
|
|
categoryName: this.categoryList.categoryName,
|
|
purchasePrice: voiceData.purchasePrice || 0,
|
|
wholesalePrice: voiceData.wholesalePrice || 0,
|
|
lsprice: voiceData.lsprice || 0,
|
|
stockLogList1: [{
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
productCount: Number(voiceData
|
|
.productCount) || 1,
|
|
stockCount: null
|
|
}]
|
|
}
|
|
let purchaseDetails = []
|
|
purchaseDetails.push(data)
|
|
if (this.oneGoodsId) {
|
|
let id = this.oneGoodsId
|
|
if (purchaseDetails.length > 0) {
|
|
if (this.carList.get(id).productSn != '') {
|
|
for (let j = 0; j < purchaseDetails
|
|
.length; j++) {
|
|
for (let i = 0; i < purchaseDetails[j]
|
|
.stockLogList1.length; i++) {
|
|
if (this.carList.get(id)
|
|
.productName == '') {
|
|
this.carList.get(id)
|
|
.productName =
|
|
purchaseDetails[0]
|
|
.productName
|
|
}
|
|
if (this.carList.get(id)
|
|
.productSn == '') {
|
|
this.carList.get(id)
|
|
.productSn =
|
|
purchaseDetails[0]
|
|
.productSn
|
|
}
|
|
if (this.carList.get(id).attrId ==
|
|
'') {
|
|
this.carList.get(id).attrId =
|
|
purchaseDetails[0].attrId
|
|
}
|
|
if (this.carList.get(id)
|
|
.wholesalePrice == '' || this
|
|
.carList.get(id)
|
|
.wholesalePrice == null) {
|
|
this.carList.get(id)
|
|
.wholesalePrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
if (this.carList.get(id)
|
|
.purchasePrice == '' || this
|
|
.carList.get(id)
|
|
.purchasePrice == null) {
|
|
this.carList.get(id)
|
|
.purchasePrice =
|
|
purchaseDetails[0]
|
|
.purchasePrice
|
|
}
|
|
if (this.carList.get(id)
|
|
.productPicture == '') {
|
|
this.carList.get(id)
|
|
.productPicture =
|
|
purchaseDetails[0]
|
|
.productPicture
|
|
}
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.name = this.sliceMsg(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList)
|
|
if (this.carList.get(id)
|
|
.stockLogList.size == 0) {
|
|
this.carList.get(id)
|
|
.stockLogList.set(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList,
|
|
purchaseDetails[j]
|
|
.stockLogList1[i])
|
|
} else {
|
|
if (this.carList.get(id)
|
|
.stockLogList.has(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList) == true
|
|
) {
|
|
this.carList.get(id)
|
|
.stockLogList.get(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList)
|
|
.productCount +=
|
|
Number(purchaseDetails[
|
|
j]
|
|
.stockLogList1[i]
|
|
.productCount)
|
|
} else {
|
|
this.carList.get(id)
|
|
.stockLogList.set(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList,
|
|
purchaseDetails[j]
|
|
.stockLogList1[i])
|
|
}
|
|
}
|
|
this.carList.get(id)
|
|
.productCount +=
|
|
Number(purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount)
|
|
}
|
|
}
|
|
if (this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
.productCount == 0 && purchaseDetails[
|
|
0].stockLogList1.length > 0) {
|
|
this.carList.get(id).stockLogList
|
|
.delete('{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
this.carList.get(id).price1 = Number(this
|
|
.carList
|
|
.get(id).productCount) * this
|
|
.carList
|
|
.get(id).purchasePrice
|
|
} else {
|
|
|
|
let isTrue = false
|
|
this.carList.forEach(function(value, key) {
|
|
if (value.productSn ==
|
|
purchaseDetails[0]
|
|
.productSn) {
|
|
isTrue = true
|
|
that.tui.toast(
|
|
'该货号被页面其他商品占用,请重新输入!'
|
|
)
|
|
that.carList.get(id)
|
|
.productSn = ''
|
|
setTimeout(res => {
|
|
that.$forceUpdate()
|
|
}, 1000)
|
|
throw Error('被占用')
|
|
}
|
|
})
|
|
|
|
this.$nextTick(() => {
|
|
if (this.carList.get(id)
|
|
.productName == '') {
|
|
this.carList.get(id)
|
|
.productName =
|
|
purchaseDetails[0]
|
|
.productName
|
|
}
|
|
if (isTrue == false && this
|
|
.carList.get(id)
|
|
.productSn == '') {
|
|
this.carList.get(id)
|
|
.productSn =
|
|
purchaseDetails[0]
|
|
.productSn
|
|
}
|
|
if (isTrue == false) {
|
|
if (purchaseDetails[0]
|
|
.productId) {
|
|
this.carList.get(id)
|
|
.id =
|
|
purchaseDetails[0]
|
|
.productId
|
|
this.carList.get(id)
|
|
.isNew = false
|
|
id = purchaseDetails[0]
|
|
.productId
|
|
} else if (purchaseDetails[
|
|
0].productSn ==
|
|
'' || purchaseDetails[
|
|
0].productSn ==
|
|
null) {
|
|
this.carList.get(id)
|
|
.id =
|
|
purchaseDetails[0]
|
|
.productName
|
|
id = purchaseDetails[0]
|
|
.productName
|
|
} else if (purchaseDetails[
|
|
0].productSn ==
|
|
'货号') {
|
|
this.carList.get(id)
|
|
.productSn =
|
|
purchaseDetails[0]
|
|
.productName
|
|
this.carList.get(id)
|
|
.id =
|
|
purchaseDetails[0]
|
|
.productName
|
|
id = purchaseDetails[0]
|
|
.productName
|
|
} else if (purchaseDetails[
|
|
0].productSn) {
|
|
this.carList.get(id)
|
|
.id =
|
|
purchaseDetails[0]
|
|
.productSn
|
|
id = purchaseDetails[0]
|
|
.productSn
|
|
}
|
|
}
|
|
})
|
|
if (this.carList.get(id).purchasePrice ==
|
|
'' || this.carList.get(id)
|
|
.purchasePrice == null) {
|
|
this.carList.get(id).purchasePrice =
|
|
purchaseDetails[0].purchasePrice
|
|
}
|
|
if (this.carList.get(id).productPicture ==
|
|
'') {
|
|
this.carList.get(id).productPicture =
|
|
purchaseDetails[0].productPicture
|
|
}
|
|
if (purchaseDetails[0].productId) {
|
|
this.carList.get(id).attrId =
|
|
purchaseDetails[0].attrId
|
|
|
|
this.carList.get(id).lsPrice =
|
|
purchaseDetails[0].lsPrice
|
|
}
|
|
this.carList.get(id).wholesalePrice =
|
|
purchaseDetails[0].wholesalePrice
|
|
let specMap =
|
|
new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList.forEach(function(
|
|
value, key) {
|
|
if (key != value
|
|
.id) {
|
|
specMap.set(
|
|
value
|
|
.id,
|
|
value)
|
|
} else {
|
|
specMap.set(
|
|
key,
|
|
value)
|
|
}
|
|
})
|
|
this.carList = specMap
|
|
})
|
|
this.$nextTick(() => {
|
|
for (let j = 0; j <
|
|
purchaseDetails.length; j++
|
|
) {
|
|
for (let i = 0; i <
|
|
purchaseDetails[j]
|
|
.stockLogList1
|
|
.length; i++) {
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.name = this
|
|
.sliceMsg(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList)
|
|
if (this.carList.get(
|
|
id)
|
|
.stockLogList
|
|
.size == 0) {
|
|
this.carList.get(
|
|
id)
|
|
.stockLogList
|
|
.set(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList,
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i])
|
|
} else {
|
|
if (this.carList
|
|
.get(id)
|
|
.stockLogList
|
|
.has(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList
|
|
) == true
|
|
) {
|
|
this.carList
|
|
.get(id)
|
|
.stockLogList
|
|
.get(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList
|
|
)
|
|
.productCount +=
|
|
Number(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.productCount
|
|
)
|
|
} else {
|
|
this.carList
|
|
.get(id)
|
|
.stockLogList
|
|
.set(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList,
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i])
|
|
}
|
|
}
|
|
this.carList.get(id)
|
|
.productCount +=
|
|
Number(
|
|
purchaseDetails[
|
|
j]
|
|
.stockLogList1[
|
|
i]
|
|
.productCount)
|
|
}
|
|
}
|
|
this.carList.get(id).price1 =
|
|
Number(this.carList.get(id)
|
|
.productCount) * this
|
|
.carList.get(id)
|
|
.purchasePrice
|
|
if (this.carList.get(id)
|
|
.stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
).productCount == 0 &&
|
|
purchaseDetails[0]
|
|
.stockLogList1.length > 0
|
|
) {
|
|
this.carList.get(id)
|
|
.stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
}
|
|
})
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
this.getAllPrice()
|
|
this.oneGoodsId = ''
|
|
})
|
|
} else {
|
|
this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
} else {
|
|
if (voiceData.purchasePrice) {
|
|
voiceData.purchasePrice = this
|
|
.replaceCharAfterNumber(voiceData
|
|
.purchasePrice, '块', '.')
|
|
if (voiceData.purchasePrice.indexOf('元') != -
|
|
1) {
|
|
voiceData.purchasePrice = voiceData
|
|
.purchasePrice.replace(/元/g, '')
|
|
}
|
|
voiceData.purchasePrice = voiceData
|
|
.purchasePrice.replace(/[^0-9.]/g, "");
|
|
|
|
}
|
|
if (voiceData.wholesalePrice) {
|
|
voiceData.wholesalePrice = this
|
|
.replaceCharAfterNumber(
|
|
voiceData.wholesalePrice, '块', '.')
|
|
if (voiceData.wholesalePrice.indexOf('元') != -
|
|
1) {
|
|
voiceData.wholesalePrice = voiceData
|
|
.wholesalePrice.replace(/元/g, '')
|
|
}
|
|
voiceData.wholesalePrice = voiceData
|
|
.wholesalePrice.replace(
|
|
/[^0-9.]/g, "");
|
|
}
|
|
for (let i = 0; i < purchaseDetails.length; i++) {
|
|
let data = {
|
|
id: "",
|
|
productCount: 0,
|
|
attrId: purchaseDetails[i].attrId,
|
|
categoryId: purchaseDetails[i]
|
|
.categoryId == '' ? this
|
|
.categoryList.categoryId :
|
|
purchaseDetails[i].categoryId,
|
|
categoryName: purchaseDetails[i]
|
|
.categoryName == '' ? this
|
|
.categoryList.categoryName :
|
|
purchaseDetails[i].categoryName,
|
|
wholesalePrice: voiceData
|
|
.wholesalePrice ? voiceData
|
|
.wholesalePrice : purchaseDetails[
|
|
i].wholesalePrice,
|
|
price: voiceData
|
|
.lsprice ? voiceData
|
|
.lsprice : purchaseDetails[
|
|
i].lsprice,
|
|
purchasePrice: purchaseDetails[i]
|
|
.purchasePrice,
|
|
isNew: purchaseDetails[i].productId ==
|
|
null ? true : false,
|
|
productId: purchaseDetails[i]
|
|
.productId,
|
|
productName: purchaseDetails[i]
|
|
.productName,
|
|
productSn: purchaseDetails[i]
|
|
.productSn,
|
|
productPicture: purchaseDetails[i]
|
|
.productPicture,
|
|
supplierName: purchaseDetails[i]
|
|
.supplierName,
|
|
productPictures: [],
|
|
saleDetailQueryDTO: []
|
|
}
|
|
if (purchaseDetails[i].productId) {
|
|
data.id = purchaseDetails[i].productId
|
|
} else if (purchaseDetails[i].productSn ==
|
|
'' || purchaseDetails[i].productSn ==
|
|
null) {
|
|
data.id = purchaseDetails[i].productName ||
|
|
purchaseDetails[i].id
|
|
} else if (purchaseDetails[i].productSn ==
|
|
'货号') {
|
|
data.productSn = purchaseDetails[i]
|
|
.productName
|
|
data.id = purchaseDetails[i].productName ||
|
|
purchaseDetails[i].id
|
|
} else if (purchaseDetails[i].productSn) {
|
|
data.id = purchaseDetails[i].productSn ||
|
|
purchaseDetails[i].id
|
|
}
|
|
for (let m = 0; m < purchaseDetails[i]
|
|
.stockLogList1.length; m++) {
|
|
let list = {
|
|
attributeList: this.getAttribute(
|
|
purchaseDetails[i]
|
|
.stockLogList1[m]
|
|
.attributeList),
|
|
productCount: Number(
|
|
purchaseDetails[i]
|
|
.stockLogList1[m]
|
|
.productCount) ||
|
|
Number(purchaseDetails[i]
|
|
.stockLogList1[m]
|
|
.productCounts),
|
|
productNum: '',
|
|
name: this.sliceMsg(this
|
|
.getAttribute(
|
|
purchaseDetails[i]
|
|
.stockLogList1[m]
|
|
.attributeList)),
|
|
price: purchaseDetails[i]
|
|
.stockLogList1[m].purchasePrice
|
|
}
|
|
data.productCount += Number(
|
|
purchaseDetails[i]
|
|
.stockLogList1[m].productCount)
|
|
data.saleDetailQueryDTO.push(list)
|
|
}
|
|
this.carList1.push(data)
|
|
}
|
|
if (i == convertedStr.length - 1) {
|
|
this.$nextTick(() => {
|
|
setTimeout(res => {
|
|
this.AiVoice()
|
|
}, 300)
|
|
})
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
})
|
|
}, 200 * (i + 1))
|
|
}
|
|
|
|
}
|
|
this.$refs.popup.close()
|
|
this.$refs.voiceBottomPopup.close()
|
|
} catch (e) {
|
|
if (this.getMsg.indexOf('色,') != -1) {
|
|
this.getMsg = this.getMsg.replace(/色,/g, '色')
|
|
}
|
|
if (this.getMsg.indexOf('色') != -1) {
|
|
this.getMsg = this.getMsg.replace(/色/g, '色、')
|
|
}
|
|
if (this.getMsg.indexOf('件,') != -1) {
|
|
this.getMsg = this.getMsg.replace(/件,/g, '件')
|
|
}
|
|
if (this.getMsg.indexOf('件') != -1) {
|
|
this.getMsg = this.getMsg.replace(/件/g, '件,')
|
|
}
|
|
let callObj
|
|
if (this.oneGoodsId != '' && !this.carList.get(this.oneGoodsId).isNew) {
|
|
callObj = {
|
|
productId: this.carList.get(this.oneGoodsId).productId,
|
|
questionMsg: this.getMsg
|
|
}
|
|
} else {
|
|
callObj = {
|
|
questionMsg: this.getMsg
|
|
}
|
|
}
|
|
await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", callObj, false,
|
|
true).then((res) => {
|
|
if (res.code == 200) {
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.close()
|
|
this.$refs.voiceBottomPopup.close()
|
|
let purchaseDetails = res.result.data.purchaseDetails
|
|
if (this.oneGoodsId) {
|
|
let id = this.oneGoodsId
|
|
if (purchaseDetails.length > 0) {
|
|
if (this.carList.get(id).productSn != '') {
|
|
for (let j = 0; j < purchaseDetails.length; j++) {
|
|
if (purchaseDetails[j].purchasePrice == "" || purchaseDetails[
|
|
j].purchasePrice == null) {
|
|
purchaseDetails[j].purchasePrice = 0
|
|
}
|
|
if (purchaseDetails[j].wholesalePrice == "" || purchaseDetails[
|
|
j].wholesalePrice == null) {
|
|
purchaseDetails[j].wholesalePrice = 0
|
|
}
|
|
if (purchaseDetails[j].price == "" || purchaseDetails[j]
|
|
.price == null) {
|
|
purchaseDetails[j].price = 0
|
|
}
|
|
for (let i = 0; i < purchaseDetails[j].stockLogList1
|
|
.length; i++) {
|
|
if (purchaseDetails[j].stockLogList1[i].productCount ==
|
|
"" || purchaseDetails[j].stockLogList1[i]
|
|
.productCount == null) {
|
|
purchaseDetails[j].stockLogList1[i].productCount = 0
|
|
}
|
|
if (this.carList.get(id).productName == '') {
|
|
this.carList.get(id).productName = purchaseDetails[0]
|
|
.productName
|
|
}
|
|
if (this.carList.get(id).attrId == '') {
|
|
this.carList.get(id).attrId = purchaseDetails[0].attrId
|
|
}
|
|
if (this.carList.get(id).purchasePrice == '' || this
|
|
.carList.get(id).purchasePrice == null) {
|
|
this.carList.get(id).purchasePrice = purchaseDetails[0]
|
|
.purchasePrice
|
|
}
|
|
if (this.carList.get(id).wholesalePrice == '' || this
|
|
.carList.get(id).wholesalePrice == null) {
|
|
this.carList.get(id).wholesalePrice = purchaseDetails[
|
|
0]
|
|
.wholesalePrice
|
|
}
|
|
if (this.carList.get(id).productPicture == '') {
|
|
this.carList.get(id).productPicture = purchaseDetails[
|
|
0].productPicture
|
|
}
|
|
purchaseDetails[j].stockLogList1[i].name = this.sliceMsg(
|
|
purchaseDetails[j].stockLogList1[i].attributeList)
|
|
this.carList.get(id).stockLogList.get(
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.attributeList).productNum =
|
|
purchaseDetails[j].stockLogList1[i].stockCount
|
|
if (this.carList.get(id).stockLogList.size == 0) {
|
|
this.carList.get(id).stockLogList.set(purchaseDetails[
|
|
j].stockLogList1[i].attributeList,
|
|
purchaseDetails[j].stockLogList1[i])
|
|
} else {
|
|
if (this.carList.get(id).stockLogList.has(
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.attributeList) == true) {
|
|
this.carList.get(id).stockLogList.get(
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.attributeList).productCount +=
|
|
Number(purchaseDetails[j].stockLogList1[i]
|
|
.productCount)
|
|
} else {
|
|
this.carList.get(id).stockLogList.set(
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.attributeList, purchaseDetails[j]
|
|
.stockLogList1[i])
|
|
}
|
|
}
|
|
this.carList.get(id).productCount += Number(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i].productCount)
|
|
}
|
|
}
|
|
if (this.carList.get(id).stockLogList.get('{"颜色":"均色","尺码":"均码"}')
|
|
.productCount == 0 && purchaseDetails[0].stockLogList1.length >
|
|
0) {
|
|
this.carList.get(id).stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
this.carList.get(id).price1 = Number(this.carList.get(id)
|
|
.productCount) *
|
|
this.carList.get(id).purchasePrice
|
|
} else {
|
|
|
|
let isTrue = false
|
|
this.carList.forEach(function(value, key) {
|
|
if (value.productSn == purchaseDetails[0].productSn) {
|
|
isTrue = true
|
|
that.tui.toast('该货号被页面其他商品占用,请重新输入!')
|
|
that.carList.get(id).productSn = ''
|
|
setTimeout(res => {
|
|
that.$forceUpdate()
|
|
}, 2000)
|
|
throw Error('被占用')
|
|
}
|
|
})
|
|
|
|
this.$nextTick(() => {
|
|
if (this.carList.get(id).productName == '') {
|
|
this.carList.get(id).productName = purchaseDetails[
|
|
0].productName
|
|
}
|
|
this.carList.get(id).customerCategoryList = this
|
|
.checkPriceRule(JSON.parse(
|
|
purchaseDetails[0].customerCategoryRule))
|
|
if (isTrue == false && this.carList.get(id)
|
|
.productSn == '') {
|
|
this.carList.get(id).productSn = purchaseDetails[0]
|
|
.productSn
|
|
}
|
|
if (isTrue == false) {
|
|
if (purchaseDetails[0].productId) {
|
|
this.carList.get(id).id = purchaseDetails[0]
|
|
.productId
|
|
this.carList.get(id).isNew = false
|
|
id = purchaseDetails[0].productId
|
|
} else if (purchaseDetails[0].productSn == '' ||
|
|
purchaseDetails[0].productSn ==
|
|
null) {
|
|
this.carList.get(id).id = purchaseDetails[0]
|
|
.productName
|
|
id = purchaseDetails[0].productName
|
|
} else if (purchaseDetails[0].productSn == '货号') {
|
|
this.carList.get(id).productSn =
|
|
purchaseDetails[0].productName
|
|
this.carList.get(id).id = purchaseDetails[0]
|
|
.productName
|
|
id = purchaseDetails[0].productName
|
|
} else if (purchaseDetails[0].productSn) {
|
|
this.carList.get(id).id = purchaseDetails[0]
|
|
.productSn
|
|
id = purchaseDetails[0].productSn
|
|
}
|
|
}
|
|
this.$forceUpdate()
|
|
})
|
|
if (this.carList.get(id).purchasePrice == '' || this.carList.get(
|
|
id).purchasePrice == null) {
|
|
this.carList.get(id).purchasePrice = purchaseDetails[0]
|
|
.purchasePrice
|
|
}
|
|
if (this.carList.get(id).productPicture == '') {
|
|
this.carList.get(id).productPicture = purchaseDetails[0]
|
|
.productPicture
|
|
}
|
|
if (purchaseDetails[0].productId) {
|
|
this.carList.get(id).attrId = purchaseDetails[0].attrId
|
|
this.carList.get(id).wholesalePrice = purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id).lsPrice = purchaseDetails[0].lsPrice
|
|
}
|
|
|
|
let specMap = new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList.forEach(function(value, key) {
|
|
if (key != value.id) {
|
|
specMap.set(value.id, value)
|
|
} else {
|
|
specMap.set(key, value)
|
|
}
|
|
})
|
|
this.carList = specMap
|
|
})
|
|
this.$nextTick(() => {
|
|
for (let j = 0; j < purchaseDetails.length; j++) {
|
|
for (let i = 0; i < purchaseDetails[j]
|
|
.stockLogList1.length; i++) {
|
|
purchaseDetails[j].stockLogList1[i].name = this
|
|
.sliceMsg(purchaseDetails[j].stockLogList1[
|
|
i].attributeList)
|
|
if (this.carList.get(id).stockLogList.size ==
|
|
0) {
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.productNum = purchaseDetails[j]
|
|
.stockLogList1[i].stockCount
|
|
this.carList.get(id).stockLogList.set(
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.attributeList, purchaseDetails[j]
|
|
.stockLogList1[i])
|
|
} else {
|
|
|
|
if (this.carList.get(id).stockLogList.has(
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.attributeList) == true) {
|
|
this.carList.get(id).stockLogList.get(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i].attributeList
|
|
).productCount +=
|
|
Number(purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount)
|
|
this.carList.get(id).stockLogList.get(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList).productNum =
|
|
purchaseDetails[j]
|
|
.stockLogList1[i].stockCount
|
|
} else {
|
|
this.carList.get(id).stockLogList.set(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList,
|
|
purchaseDetails[j]
|
|
.stockLogList1[i])
|
|
this.carList.get(id).stockLogList.get(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList).productNum =
|
|
this.carList.get(id).stockLogList
|
|
.get(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.attributeList).stockCount
|
|
}
|
|
}
|
|
this.carList.get(id).productCount +=
|
|
Number(purchaseDetails[j].stockLogList1[i]
|
|
.productCount)
|
|
}
|
|
}
|
|
this.carList.get(id).price1 = Number(this.carList.get(
|
|
id)
|
|
.productCount) * this.carList.get(id)
|
|
.purchasePrice
|
|
if (this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}').productCount == 0 &&
|
|
purchaseDetails[0].stockLogList1.length > 0) {
|
|
this.carList.get(id).stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
})
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
this.getAllPrice()
|
|
this.oneGoodsId = ''
|
|
})
|
|
} else {
|
|
this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
} else {
|
|
for (let i = 0; i < purchaseDetails.length; i++) {
|
|
let data = {
|
|
id: "",
|
|
price: purchaseDetails[i].price,
|
|
productCount: 0,
|
|
attrId: purchaseDetails[i].attrId,
|
|
customerCategoryList: purchaseDetails[i]
|
|
.customerCategoryRule == null ? this.getNewProductRule() :
|
|
this.checkPriceRule(JSON.parse(purchaseDetails[i]
|
|
.customerCategoryRule)),
|
|
categoryId: purchaseDetails[i].categoryId == '' ? this
|
|
.categoryList.categoryId : purchaseDetails[i].categoryId,
|
|
categoryName: purchaseDetails[i].categoryName == '' ? this
|
|
.categoryList.categoryName : purchaseDetails[i]
|
|
.categoryName,
|
|
wholesalePrice: purchaseDetails[i].wholesalePrice,
|
|
purchasePrice: purchaseDetails[i].purchasePrice,
|
|
isNew: purchaseDetails[i].productId == null ? true : false,
|
|
productId: purchaseDetails[i].productId,
|
|
productName: purchaseDetails[i].productName,
|
|
productSn: purchaseDetails[i].productSn,
|
|
productPicture: purchaseDetails[i].productPicture,
|
|
supplierName: purchaseDetails[i].supplierName,
|
|
productPictures: [],
|
|
saleDetailQueryDTO: []
|
|
}
|
|
if (purchaseDetails[i].productId) {
|
|
data.id = purchaseDetails[i].productId
|
|
} else if (purchaseDetails[i].productSn == '' || purchaseDetails[i]
|
|
.productSn ==
|
|
null) {
|
|
data.id = purchaseDetails[i].productName
|
|
} else if (purchaseDetails[i].productSn == '货号') {
|
|
data.productSn = purchaseDetails[i].productName
|
|
data.id = purchaseDetails[i].productName
|
|
} else if (purchaseDetails[i].productSn) {
|
|
data.id = purchaseDetails[i].productSn
|
|
}
|
|
for (let m = 0; m < purchaseDetails[i].stockLogList1.length; m++) {
|
|
let list = {
|
|
attributeList: this.getAttribute(purchaseDetails[i]
|
|
.stockLogList1[m]
|
|
.attributeList),
|
|
productCount: Number(purchaseDetails[i].stockLogList1[m]
|
|
.productCount) ||
|
|
Number(purchaseDetails[i].stockLogList1[m]
|
|
.productCounts),
|
|
productNum: '',
|
|
name: this.sliceMsg(this.getAttribute(purchaseDetails[i]
|
|
.stockLogList1[m]
|
|
.attributeList)),
|
|
price: purchaseDetails[i].stockLogList1[m].purchasePrice
|
|
}
|
|
data.productCount += Number(purchaseDetails[i].stockLogList1[m]
|
|
.productCount)
|
|
data.saleDetailQueryDTO.push(list)
|
|
}
|
|
this.carList1.push(data)
|
|
}
|
|
this.$nextTick(() => {
|
|
setTimeout(res => {
|
|
this.AiVoice()
|
|
}, 300)
|
|
})
|
|
}
|
|
|
|
} else {
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "抱歉:小助手对" + this.getMsg + "的部分商品未识别,请检查识别信息是否正确",
|
|
success: function(res) {}
|
|
})
|
|
}
|
|
}).catch((res) => {
|
|
this.tui.toast(res)
|
|
})
|
|
}
|
|
} else {
|
|
if (this.getMsg.indexOf('色,') != -1) {
|
|
this.getMsg = this.getMsg.replace(/色,/g, '色')
|
|
}
|
|
if (this.getMsg.indexOf('色') != -1) {
|
|
this.getMsg = this.getMsg.replace(/色/g, '色、')
|
|
}
|
|
if (this.getMsg.indexOf('件,') != -1) {
|
|
this.getMsg = this.getMsg.replace(/件,/g, '件')
|
|
}
|
|
if (this.getMsg.indexOf('件') != -1) {
|
|
this.getMsg = this.getMsg.replace(/件/g, '件,')
|
|
}
|
|
let callObj
|
|
if (this.oneGoodsId != '' && !this.carList.get(this.oneGoodsId).isNew) {
|
|
callObj = {
|
|
productId: this.carList.get(this.oneGoodsId).productId,
|
|
questionMsg: this.getMsg
|
|
}
|
|
} else {
|
|
callObj = {
|
|
questionMsg: this.getMsg
|
|
}
|
|
}
|
|
await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", callObj, false,
|
|
true).then((res) => {
|
|
if (res.code == 200) {
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.close()
|
|
this.$refs.voiceBottomPopup.close()
|
|
let purchaseDetails = res.result.data.purchaseDetails
|
|
//千问的单商品语音录入
|
|
if (this.oneGoodsId) {
|
|
let id = this.oneGoodsId
|
|
if (purchaseDetails.length > 0) {
|
|
if (this.carList.get(id).productSn != '') {
|
|
for (let j = 0; j < purchaseDetails.length; j++) {
|
|
if (purchaseDetails[j].purchasePrice == "" || purchaseDetails[j]
|
|
.purchasePrice == null) {
|
|
purchaseDetails[j].purchasePrice = 0
|
|
}
|
|
if (purchaseDetails[j].wholesalePrice == "" || purchaseDetails[j]
|
|
.wholesalePrice == null) {
|
|
purchaseDetails[j].wholesalePrice = 0
|
|
}
|
|
if (purchaseDetails[j].price == "" || purchaseDetails[j].price ==
|
|
null) {
|
|
purchaseDetails[j].price = 0
|
|
}
|
|
for (let i = 0; i < purchaseDetails[j].stockLogList1.length; i++) {
|
|
if (purchaseDetails[j].stockLogList1[i].productCount == "" ||
|
|
purchaseDetails[j].stockLogList1[i].productCount == null) {
|
|
purchaseDetails[j].stockLogList1[i].productCount = 0
|
|
}
|
|
if (this.carList.get(id).productName == '') {
|
|
this.carList.get(id).productName = purchaseDetails[0]
|
|
.productName
|
|
}
|
|
if (this.carList.get(id).attrId == '') {
|
|
this.carList.get(id).attrId = purchaseDetails[0].attrId
|
|
}
|
|
if (this.carList.get(id).purchasePrice == '' || this.carList
|
|
.get(id).purchasePrice == null) {
|
|
this.carList.get(id).purchasePrice = purchaseDetails[0]
|
|
.purchasePrice
|
|
}
|
|
if (this.carList.get(id).wholesalePrice == '' || this.carList
|
|
.get(id).wholesalePrice == null) {
|
|
this.carList.get(id).wholesalePrice = purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
if (this.carList.get(id).productPicture == '') {
|
|
this.carList.get(id).productPicture = purchaseDetails[0]
|
|
.productPicture
|
|
}
|
|
purchaseDetails[j].stockLogList1[i].name = this.sliceMsg(
|
|
purchaseDetails[j].stockLogList1[i].attributeList)
|
|
purchaseDetails[j].stockLogList1[i].productNum =
|
|
purchaseDetails[j].stockLogList1[i].stockCount
|
|
if (this.carList.get(id).stockLogList.size == 0) {
|
|
this.carList.get(id).stockLogList.set(purchaseDetails[j]
|
|
.stockLogList1[i].attributeList, purchaseDetails[j]
|
|
.stockLogList1[i])
|
|
} else {
|
|
if (this.carList.get(id).stockLogList.has(purchaseDetails[
|
|
j].stockLogList1[i].attributeList) == true) {
|
|
this.carList.get(id).stockLogList.get(purchaseDetails[
|
|
j].stockLogList1[i].attributeList)
|
|
.productCount +=
|
|
Number(purchaseDetails[j].stockLogList1[i]
|
|
.productCount)
|
|
} else {
|
|
this.carList.get(id).stockLogList.set(purchaseDetails[
|
|
j].stockLogList1[i].attributeList,
|
|
purchaseDetails[j].stockLogList1[i])
|
|
}
|
|
}
|
|
this.carList.get(id).productCount += Number(purchaseDetails[j]
|
|
.stockLogList1[i].productCount)
|
|
}
|
|
}
|
|
this.$nextTick(() => {
|
|
this.carList.get(id).price1 = Number(this.carList.get(id)
|
|
.productCount) * this
|
|
.carList.get(id).purchasePrice
|
|
this.getAllPrice()
|
|
this.oneGoodsId = ''
|
|
})
|
|
if (this.carList.get(id).stockLogList.get('{"颜色":"均色","尺码":"均码"}')
|
|
.productCount == 0 && purchaseDetails[0].stockLogList1.length > 0
|
|
) {
|
|
this.carList.get(id).stockLogList.delete('{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
|
|
} else {
|
|
|
|
let isTrue = false
|
|
this.carList.forEach(function(value, key) {
|
|
if (value.productSn == purchaseDetails[0].productSn) {
|
|
isTrue = true
|
|
that.tui.toast('该货号被页面其他商品占用,请重新输入!')
|
|
that.carList.get(id).productSn = ''
|
|
setTimeout(res => {
|
|
that.$forceUpdate()
|
|
}, 2000)
|
|
throw Error('被占用')
|
|
}
|
|
})
|
|
|
|
this.$nextTick(() => {
|
|
if (this.carList.get(id).productName == '') {
|
|
this.carList.get(id).productName = purchaseDetails[0]
|
|
.productName
|
|
}
|
|
if (isTrue == false && this.carList.get(id).productSn ==
|
|
'') {
|
|
this.carList.get(id).productSn = purchaseDetails[0]
|
|
.productSn
|
|
}
|
|
if (isTrue == false) {
|
|
if (purchaseDetails[0].productId) {
|
|
this.carList.get(id).id = purchaseDetails[0]
|
|
.productId
|
|
this.carList.get(id).isNew = false
|
|
id = purchaseDetails[0].productId
|
|
} else if (purchaseDetails[0].productSn == '' ||
|
|
purchaseDetails[0].productSn ==
|
|
null) {
|
|
this.carList.get(id).id = purchaseDetails[0]
|
|
.productName
|
|
id = purchaseDetails[0].productName
|
|
} else if (purchaseDetails[0].productSn == '货号') {
|
|
this.carList.get(id).productSn = purchaseDetails[0]
|
|
.productName
|
|
this.carList.get(id).id = purchaseDetails[0]
|
|
.productName
|
|
id = purchaseDetails[0].productName
|
|
} else if (purchaseDetails[0].productSn) {
|
|
this.carList.get(id).id = purchaseDetails[0]
|
|
.productSn
|
|
id = purchaseDetails[0].productSn
|
|
}
|
|
}
|
|
this.$forceUpdate()
|
|
})
|
|
if (this.carList.get(id).purchasePrice == '' || this.carList.get(id)
|
|
.purchasePrice == null) {
|
|
this.carList.get(id).purchasePrice = purchaseDetails[0]
|
|
.purchasePrice
|
|
}
|
|
this.carList.get(id).customerCategoryList = this.checkPriceRule(JSON
|
|
.parse(purchaseDetails[
|
|
0].customerCategoryRule))
|
|
if (this.carList.get(id).wholesalePrice == '' || this.carList.get(id)
|
|
.wholesalePrice == null) {
|
|
this.carList.get(id).wholesalePrice = purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
if (this.carList.get(id).lsprice == '' || this.carList.get(id)
|
|
.lsprice == null) {
|
|
this.carList.get(id).lsprice = purchaseDetails[0]
|
|
.price
|
|
}
|
|
if (this.carList.get(id).productPicture == '') {
|
|
this.carList.get(id).productPicture = purchaseDetails[0]
|
|
.productPicture
|
|
}
|
|
if (purchaseDetails[0].productId) {
|
|
this.carList.get(id).productId = purchaseDetails[0].productId
|
|
this.carList.get(id).attrId = purchaseDetails[0].attrId
|
|
this.carList.get(id).wholesalePrice = purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id).lsPrice = purchaseDetails[0].lsPrice
|
|
}
|
|
|
|
let specMap = new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList.forEach(function(value, key) {
|
|
if (key != value.id) {
|
|
specMap.set(value.id, value)
|
|
} else {
|
|
specMap.set(key, value)
|
|
}
|
|
})
|
|
this.carList = specMap
|
|
})
|
|
this.$nextTick(() => {
|
|
for (let j = 0; j < purchaseDetails.length; j++) {
|
|
for (let i = 0; i < purchaseDetails[j].stockLogList1
|
|
.length; i++) {
|
|
purchaseDetails[j].stockLogList1[i].name = this
|
|
.sliceMsg(purchaseDetails[j].stockLogList1[i]
|
|
.attributeList)
|
|
if (this.carList.get(id).stockLogList.size == 0) {
|
|
this.carList.get(id).stockLogList.set(
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.attributeList, purchaseDetails[j]
|
|
.stockLogList1[i])
|
|
} else {
|
|
|
|
if (this.carList.get(id).stockLogList.has(
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.attributeList) == true) {
|
|
this.carList.get(id).stockLogList.get(
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.attributeList).productCount +=
|
|
Number(purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount)
|
|
this.carList.get(id).stockLogList.get(
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.attributeList).productNum =
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.stockCount
|
|
} else {
|
|
this.carList.get(id).stockLogList.set(
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.attributeList, purchaseDetails[j]
|
|
.stockLogList1[i])
|
|
this.carList.get(id).stockLogList.get(
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.attributeList).productNum = this
|
|
.carList.get(id).stockLogList.get(
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.attributeList).stockCount
|
|
}
|
|
}
|
|
this.carList.get(id).productCount +=
|
|
Number(purchaseDetails[j].stockLogList1[i]
|
|
.productCount)
|
|
}
|
|
}
|
|
this.carList.get(id).price1 = Number(this.carList.get(id)
|
|
.productCount) * this.carList.get(id).purchasePrice
|
|
if (this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}').productCount == 0 &&
|
|
purchaseDetails[0].stockLogList1.length > 0) {
|
|
this.carList.get(id).stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
})
|
|
this.$nextTick(() => {
|
|
this.getAllPrice()
|
|
this.oneGoodsId = ''
|
|
})
|
|
}
|
|
} else {
|
|
this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
} else {
|
|
for (let i = 0; i < purchaseDetails.length; i++) {
|
|
let data = {
|
|
id: "",
|
|
price: purchaseDetails[i].price,
|
|
productCount: 0,
|
|
attrId: purchaseDetails[i].attrId,
|
|
customerCategoryList: purchaseDetails[i].customerCategoryRule ==
|
|
null ? this.getNewProductRule() : this.checkPriceRule(JSON
|
|
.parse(purchaseDetails[
|
|
i].customerCategoryRule)),
|
|
categoryId: purchaseDetails[i].categoryId == '' ? this.categoryList
|
|
.categoryId : purchaseDetails[i].categoryId,
|
|
categoryName: purchaseDetails[i].categoryName == '' ? this
|
|
.categoryList.categoryName : purchaseDetails[i].categoryName,
|
|
wholesalePrice: purchaseDetails[i].wholesalePrice,
|
|
purchasePrice: purchaseDetails[i].purchasePrice,
|
|
isNew: purchaseDetails[i].productId == null ? true : false,
|
|
productId: purchaseDetails[i].productId,
|
|
productName: purchaseDetails[i].productName,
|
|
productSn: purchaseDetails[i].productSn,
|
|
productPicture: purchaseDetails[i].productPicture,
|
|
supplierName: purchaseDetails[i].supplierName,
|
|
productPictures: [],
|
|
saleDetailQueryDTO: []
|
|
}
|
|
|
|
if (purchaseDetails[i].productId) {
|
|
data.id = purchaseDetails[i].productId
|
|
} else if (purchaseDetails[i].productSn == '' || purchaseDetails[i]
|
|
.productSn ==
|
|
null) {
|
|
data.id = purchaseDetails[i].productName
|
|
} else if (purchaseDetails[i].productSn == '货号') {
|
|
data.productSn = purchaseDetails[i].productName
|
|
data.id = purchaseDetails[i].productName
|
|
} else if (purchaseDetails[i].productSn) {
|
|
data.id = purchaseDetails[i].productSn
|
|
}
|
|
for (let m = 0; m < purchaseDetails[i].stockLogList1.length; m++) {
|
|
let list = {
|
|
attributeList: this.getAttribute(purchaseDetails[i]
|
|
.stockLogList1[m]
|
|
.attributeList),
|
|
productCount: Number(purchaseDetails[i].stockLogList1[m]
|
|
.productCount) ||
|
|
Number(purchaseDetails[i].stockLogList1[m].productCounts),
|
|
productNum: purchaseDetails[i].stockLogList1[m].stockCount,
|
|
name: this.sliceMsg(this.getAttribute(purchaseDetails[i]
|
|
.stockLogList1[m]
|
|
.attributeList)),
|
|
price: purchaseDetails[i].stockLogList1[m].purchasePrice
|
|
}
|
|
data.productCount += Number(purchaseDetails[i].stockLogList1[m]
|
|
.productCount)
|
|
data.saleDetailQueryDTO.push(list)
|
|
}
|
|
this.carList1.push(data)
|
|
}
|
|
this.$nextTick(() => {
|
|
setTimeout(res => {
|
|
this.AiVoice()
|
|
}, 300)
|
|
})
|
|
}
|
|
|
|
} else {
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "抱歉:小助手对" + this.getMsg + "的部分商品未识别,请检查识别信息是否正确",
|
|
success: function(res) {}
|
|
})
|
|
}
|
|
}).catch((res) => {
|
|
this.tui.toast(res)
|
|
})
|
|
}
|
|
|
|
},
|
|
checkPriceRule(ruleArr) {
|
|
|
|
if (this.customerCategoryList1 != '' && this.customerCategoryList1 != null) {
|
|
if (ruleArr == null) {
|
|
ruleArr = []
|
|
}
|
|
for (let i = 0; i < this.customerCategoryList1.length; i++) {
|
|
let isHae = false
|
|
if (ruleArr != null) {
|
|
for (let j = 0; j < ruleArr.length; j++) {
|
|
if (this.customerCategoryList1[i].categoryId == ruleArr[j].categoryId) {
|
|
isHae = true
|
|
}
|
|
}
|
|
}
|
|
if (isHae == false) {
|
|
|
|
ruleArr.push(this.customerCategoryList1[i])
|
|
}
|
|
}
|
|
}
|
|
return ruleArr
|
|
},
|
|
async getOneData(oneData, type, num) {
|
|
await setTimeout(resAAS => {
|
|
this.tui.request('/app/product/getShareList', "post", {
|
|
categoryId: "",
|
|
pageNum: 1,
|
|
pageSize: '1000',
|
|
searchStr: oneData.productSn
|
|
}, false, false).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.result.records != '') {
|
|
if (res.result.records.length > 1) {
|
|
for (let i = 0; i < res.result.records.length; i++) {
|
|
if (oneData.wholesalePrice) {
|
|
res.result.records[i].wholesalePrice = oneData
|
|
.wholesalePrice
|
|
res.result.records[i].unitPrice = oneData.wholesalePrice
|
|
res.result.records[i].discountAmount = oneData
|
|
.wholesalePrice
|
|
}
|
|
res.result.records[i].productCount = Number(oneData
|
|
.productCount)
|
|
if (oneData.purchasePrice) {
|
|
res.result.records[i].purchasePrice = oneData.purchasePrice
|
|
}
|
|
}
|
|
this.$nextTick(() => {
|
|
this.moreData.push(res.result.records)
|
|
this.oneData = oneData
|
|
})
|
|
|
|
} else {
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.close()
|
|
this.$refs.voiceBottomPopup.close()
|
|
|
|
let data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
productCount: Number(oneData.productCount) || 1,
|
|
stockCount: res.result.records[0].defaultStockCount
|
|
}
|
|
res.result.records[0].productId = res.result.records[0].id
|
|
res.result.records[0].saleDetailQueryDTO = []
|
|
res.result.records[0].saleDetailQueryDTO.push(data)
|
|
let purchaseDetails = res.result.records
|
|
if (this.oneGoodsId) {
|
|
let id = this.oneGoodsId
|
|
if (purchaseDetails.length > 0) {
|
|
if (this.carList.get(id).productSn != '') {
|
|
for (let j = 0; j < purchaseDetails.length; j++) {
|
|
for (let i = 0; i < purchaseDetails[j]
|
|
.saleDetailQueryDTO
|
|
.length; i++) {
|
|
if (this.carList.get(id).productName == '') {
|
|
this.carList.get(id).productName =
|
|
purchaseDetails[0]
|
|
.productName
|
|
}
|
|
|
|
this.carList.get(id).customerCategoryList =
|
|
purchaseDetails[0]
|
|
.customerCategoryRule != null ? this
|
|
.checkPriceRule(JSON.parse(
|
|
purchaseDetails[0]
|
|
.customerCategoryRule)) : this
|
|
.getNewProductRule()
|
|
|
|
if (this.carList.get(id).attrId == '') {
|
|
this.carList.get(id).attrId =
|
|
purchaseDetails[0].attrId
|
|
}
|
|
if (this.carList.get(id).purchasePrice == '' ||
|
|
this
|
|
.carList
|
|
.get(id).purchasePrice == null) {
|
|
if (oneData.purchasePrice) {
|
|
this.carList.get(id).purchasePrice =
|
|
oneData
|
|
.purchasePrice
|
|
} else {
|
|
this.carList.get(id).purchasePrice =
|
|
purchaseDetails[0]
|
|
.purchasePrice
|
|
}
|
|
|
|
}
|
|
if (this.carList.get(id).productPicture ==
|
|
'') {
|
|
this.carList.get(id).productPicture =
|
|
purchaseDetails[
|
|
0]
|
|
.productPicture
|
|
}
|
|
purchaseDetails[j].saleDetailQueryDTO[i].name =
|
|
this
|
|
.sliceMsg(
|
|
purchaseDetails[j].saleDetailQueryDTO[
|
|
i]
|
|
.attributeList)
|
|
if (this.carList.get(id).stockLogList.size ==
|
|
0) {
|
|
this.carList.get(id).stockLogList.set(
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[i]
|
|
.attributeList,
|
|
purchaseDetails[j]
|
|
.saleDetailQueryDTO[i])
|
|
} else {
|
|
if (this.carList.get(id).stockLogList.has(
|
|
purchaseDetails[
|
|
j].saleDetailQueryDTO[i]
|
|
.attributeList) ==
|
|
true) {
|
|
this.carList.get(id).stockLogList.get(
|
|
purchaseDetails[
|
|
j].saleDetailQueryDTO[i]
|
|
.attributeList)
|
|
.productCount +=
|
|
Number(purchaseDetails[j]
|
|
.saleDetailQueryDTO[i]
|
|
.productCount)
|
|
} else {
|
|
this.carList.get(id).stockLogList.set(
|
|
purchaseDetails[
|
|
j].saleDetailQueryDTO[i]
|
|
.attributeList,
|
|
purchaseDetails[j]
|
|
.saleDetailQueryDTO[i])
|
|
}
|
|
}
|
|
this.carList.get(id).productCount +=
|
|
Number(purchaseDetails[j]
|
|
.saleDetailQueryDTO[i].productCount)
|
|
}
|
|
}
|
|
if (this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
.productCount == 0 && purchaseDetails[0]
|
|
.saleDetailQueryDTO
|
|
.length > 0
|
|
) {
|
|
this.carList.get(id).stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
this.carList.get(id).price1 = Number(this.carList.get(
|
|
id)
|
|
.productCount) *
|
|
this.carList.get(id).purchasePrice
|
|
} else {
|
|
|
|
let isTrue = false
|
|
this.carList.forEach(function(value, key) {
|
|
if (value.productSn == purchaseDetails[0]
|
|
.productSn) {
|
|
isTrue = true
|
|
that.tui.toast('该货号被页面其他商品占用,请重新输入!')
|
|
that.carList.get(id).productSn = ''
|
|
setTimeout(resNM => {
|
|
that.$forceUpdate()
|
|
}, 2000)
|
|
throw Error('被占用')
|
|
}
|
|
})
|
|
|
|
this.$nextTick(() => {
|
|
if (this.carList.get(id).productName ==
|
|
'') {
|
|
this.carList.get(id).productName =
|
|
purchaseDetails[
|
|
0]
|
|
.productName
|
|
}
|
|
if (isTrue == false && this.carList.get(id)
|
|
.productSn ==
|
|
'') {
|
|
this.carList.get(id).productSn =
|
|
purchaseDetails[0]
|
|
.productSn
|
|
}
|
|
if (isTrue == false) {
|
|
if (purchaseDetails[0].productId) {
|
|
this.carList.get(id).id =
|
|
purchaseDetails[0]
|
|
.productId
|
|
this.carList.get(id).productId =
|
|
purchaseDetails[0].productId
|
|
this.carList.get(id).isNew = false
|
|
id = purchaseDetails[0].productId
|
|
} else if (purchaseDetails[0]
|
|
.productSn == '' ||
|
|
purchaseDetails[0].productSn ==
|
|
null) {
|
|
this.carList.get(id).id =
|
|
purchaseDetails[0]
|
|
.productName
|
|
id = purchaseDetails[0].productName
|
|
} else if (purchaseDetails[0]
|
|
.productSn == '货号') {
|
|
this.carList.get(id).productSn =
|
|
purchaseDetails[0]
|
|
.productName
|
|
this.carList.get(id).id =
|
|
purchaseDetails[0]
|
|
.productName
|
|
id = purchaseDetails[0].productName
|
|
} else if (purchaseDetails[0]
|
|
.productSn) {
|
|
this.carList.get(id).id =
|
|
purchaseDetails[0]
|
|
.productSn
|
|
id = purchaseDetails[0].productSn
|
|
}
|
|
}
|
|
this.$forceUpdate()
|
|
})
|
|
if (this.carList.get(id).purchasePrice == '' || this
|
|
.carList.get(
|
|
id)
|
|
.purchasePrice == null) {
|
|
if (oneData.purchasePrice) {
|
|
this.carList.get(id).purchasePrice = oneData
|
|
.purchasePrice
|
|
} else {
|
|
this.carList.get(id).purchasePrice =
|
|
purchaseDetails[0]
|
|
.purchasePrice
|
|
}
|
|
|
|
}
|
|
if (this.carList.get(id).productPicture == '') {
|
|
this.carList.get(id).productPicture =
|
|
purchaseDetails[0]
|
|
.productPicture
|
|
}
|
|
if (purchaseDetails[0].productId) {
|
|
this.carList.get(id).attrId = purchaseDetails[0]
|
|
.attrId
|
|
this.carList.get(id).wholesalePrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id).lsPrice = purchaseDetails[0]
|
|
.lsPrice
|
|
}
|
|
|
|
let specMap = new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList.forEach(function(value, key) {
|
|
if (key != value.id) {
|
|
specMap.set(value.id,
|
|
value)
|
|
} else {
|
|
specMap.set(key, value)
|
|
}
|
|
})
|
|
this.carList = specMap
|
|
})
|
|
this.$nextTick(() => {
|
|
for (let j = 0; j < purchaseDetails
|
|
.length; j++) {
|
|
for (let i = 0; i < purchaseDetails[j]
|
|
.saleDetailQueryDTO
|
|
.length; i++) {
|
|
purchaseDetails[j]
|
|
.saleDetailQueryDTO[i].name =
|
|
this
|
|
.sliceMsg(purchaseDetails[j]
|
|
.saleDetailQueryDTO[i]
|
|
.attributeList)
|
|
if (this.carList.get(id)
|
|
.stockLogList.size ==
|
|
0) {
|
|
this.carList.get(id)
|
|
.stockLogList.set(
|
|
purchaseDetails[j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.attributeList,
|
|
purchaseDetails[j]
|
|
.saleDetailQueryDTO[i])
|
|
} else {
|
|
if (this.carList.get(id)
|
|
.stockLogList.has(
|
|
purchaseDetails[j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.attributeList) == true
|
|
) {
|
|
this.carList.get(id)
|
|
.stockLogList.get(
|
|
purchaseDetails[j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.attributeList)
|
|
.productCount +=
|
|
Number(purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.productCount)
|
|
} else {
|
|
this.carList.get(id)
|
|
.stockLogList.set(
|
|
purchaseDetails[j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.attributeList,
|
|
purchaseDetails[j]
|
|
.saleDetailQueryDTO[
|
|
i])
|
|
}
|
|
}
|
|
this.carList.get(id)
|
|
.productCount +=
|
|
Number(purchaseDetails[j]
|
|
.saleDetailQueryDTO[i]
|
|
.productCount)
|
|
}
|
|
}
|
|
this.carList.get(id).price1 = Number(this
|
|
.carList
|
|
.get(id).productCount) * this
|
|
.carList.get(id)
|
|
.purchasePrice
|
|
this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
.productNum = purchaseDetails[0]
|
|
.defaultStockCount
|
|
if (this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
.productCount == 0 &&
|
|
purchaseDetails[0].saleDetailQueryDTO
|
|
.length > 0) {
|
|
this.carList.get(id).stockLogList
|
|
.delete(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
})
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
this.getAllPrice()
|
|
this.oneGoodsId = ''
|
|
})
|
|
} else {
|
|
this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
} else {
|
|
// for (let i = 0; i < purchaseDetails.length; i++) {
|
|
let data = {
|
|
id: "",
|
|
price: purchaseDetails[0].price,
|
|
productCount: 0,
|
|
attrId: purchaseDetails[0].attrId,
|
|
customerCategoryList: purchaseDetails[0]
|
|
.customerCategoryRule != null ? this
|
|
.checkPriceRule(JSON.parse(
|
|
purchaseDetails[0].customerCategoryRule)) :
|
|
this.getNewProductRule(),
|
|
categoryId: purchaseDetails[0].categoryId == '' ?
|
|
this
|
|
.categoryList
|
|
.categoryId : purchaseDetails[0].categoryId,
|
|
categoryName: purchaseDetails[0].categoryName ==
|
|
'' ? this
|
|
.categoryList.categoryName : purchaseDetails[0]
|
|
.categoryName,
|
|
wholesalePrice: purchaseDetails[0].wholesalePrice,
|
|
purchasePrice: oneData.purchasePrice ? oneData
|
|
.purchasePrice : purchaseDetails[0]
|
|
.purchasePrice,
|
|
isNew: purchaseDetails[0].productId == null ?
|
|
true : false,
|
|
productId: purchaseDetails[0].productId,
|
|
productName: purchaseDetails[0].productName,
|
|
productSn: purchaseDetails[0].productSn,
|
|
productPicture: purchaseDetails[0].productPicture,
|
|
supplierName: purchaseDetails[0].supplierName,
|
|
productPictures: [],
|
|
saleDetailQueryDTO: []
|
|
}
|
|
if (purchaseDetails[0].productId) {
|
|
data.id = purchaseDetails[0].productId
|
|
} else if (purchaseDetails[0].productSn == '' ||
|
|
purchaseDetails[0]
|
|
.productSn == null) {
|
|
data.id = purchaseDetails[0].productName
|
|
} else if (purchaseDetails[0].productSn == '货号') {
|
|
data.productSn = purchaseDetails[0].productName
|
|
data.id = purchaseDetails[0].productName
|
|
} else if (purchaseDetails[0].productSn) {
|
|
data.id = purchaseDetails[0].productSn
|
|
}
|
|
// for (let m = 0; m < purchaseDetails[0].saleDetailQueryDTO.length; m++) {
|
|
let list = {
|
|
attributeList: this.getAttribute(
|
|
purchaseDetails[0]
|
|
.saleDetailQueryDTO[0]
|
|
.attributeList),
|
|
productCount: Number(purchaseDetails[0]
|
|
.saleDetailQueryDTO[0]
|
|
.productCount) ||
|
|
Number(purchaseDetails[0].saleDetailQueryDTO[0]
|
|
.productCounts),
|
|
productNum: purchaseDetails[0].saleDetailQueryDTO[0]
|
|
.stockCount,
|
|
name: this.sliceMsg(this.getAttribute(
|
|
purchaseDetails[0]
|
|
.saleDetailQueryDTO[0]
|
|
.attributeList)),
|
|
price: purchaseDetails[0].saleDetailQueryDTO[0]
|
|
.purchasePrice
|
|
}
|
|
data.productCount += Number(purchaseDetails[0]
|
|
.saleDetailQueryDTO[0]
|
|
.productCount)
|
|
data.saleDetailQueryDTO.push(list)
|
|
// }
|
|
this.carList1.push(data)
|
|
// }
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
if (type == true) {
|
|
this.$nextTick(() => {
|
|
setTimeout(resLK => {
|
|
this.AiVoice()
|
|
uni.hideLoading();
|
|
}, 300)
|
|
})
|
|
}
|
|
|
|
}
|
|
}
|
|
} else {
|
|
// this.$nextTick(() => {
|
|
// setTimeout(ressD => {
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.close()
|
|
|
|
this.$refs.voiceBottomPopup.close()
|
|
if (oneData.productCount) {
|
|
oneData.productCount = Number(oneData.productCount);
|
|
}
|
|
let data = {
|
|
id: oneData.productSn,
|
|
productCount: Number(oneData.productCount) ||
|
|
0,
|
|
productName: oneData.productName,
|
|
productSn: oneData.productSn,
|
|
customerCategoryList: this.getNewProductRule(),
|
|
categoryId: this.categoryList
|
|
.categoryId,
|
|
categoryName: this.categoryList
|
|
.categoryName,
|
|
purchasePrice: oneData.purchasePrice ||
|
|
0,
|
|
wholesalePrice: oneData
|
|
.wholesalePrice || 0,
|
|
saleDetailQueryDTO: [{
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
productCount: Number(
|
|
oneData
|
|
.productCount) || 1,
|
|
stockCount: null
|
|
}]
|
|
}
|
|
let purchaseDetails = []
|
|
purchaseDetails.push(data)
|
|
if (this.oneGoodsId) {
|
|
let id = this.oneGoodsId
|
|
if (purchaseDetails.length > 0) {
|
|
if (this.carList.get(id).productSn !=
|
|
'') {
|
|
for (let j = 0; j < purchaseDetails
|
|
.length; j++) {
|
|
for (let i = 0; i <
|
|
purchaseDetails[j]
|
|
.saleDetailQueryDTO
|
|
.length; i++) {
|
|
if (this.carList.get(id)
|
|
.productName == '') {
|
|
this.carList.get(id)
|
|
.productName =
|
|
purchaseDetails[0]
|
|
.productName
|
|
}
|
|
if (this.carList.get(id)
|
|
.attrId == '') {
|
|
this.carList.get(id)
|
|
.attrId =
|
|
purchaseDetails[
|
|
0].attrId
|
|
}
|
|
|
|
this.carList.get(id)
|
|
.customerCategoryList =
|
|
purchaseDetails[
|
|
0].customerCategoryList
|
|
|
|
if (this.carList.get(id)
|
|
.purchasePrice == '' ||
|
|
this.carList.get(
|
|
id)
|
|
.purchasePrice == null
|
|
) {
|
|
this.carList.get(id)
|
|
.purchasePrice =
|
|
purchaseDetails[0]
|
|
.purchasePrice
|
|
}
|
|
if (this.carList.get(id)
|
|
.productPicture == ''
|
|
) {
|
|
this.carList.get(id)
|
|
.productPicture =
|
|
purchaseDetails[0]
|
|
.productPicture
|
|
}
|
|
purchaseDetails[j]
|
|
.saleDetailQueryDTO[i]
|
|
.name =
|
|
this.sliceMsg(
|
|
purchaseDetails[j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.attributeList)
|
|
if (this.carList.get(id)
|
|
.stockLogList.size == 0
|
|
) {
|
|
this.carList.get(id)
|
|
.stockLogList.set(
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.attributeList,
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i])
|
|
} else {
|
|
if (this.carList.get(
|
|
id)
|
|
.stockLogList.has(
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.attributeList
|
|
) == true) {
|
|
this.carList.get(
|
|
id)
|
|
.stockLogList
|
|
.get(
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.attributeList
|
|
)
|
|
.productCount +=
|
|
Number(purchaseDetails[j]
|
|
.saleDetailQueryDTO[i]
|
|
.productCount)
|
|
} else {
|
|
this.carList.get(
|
|
id)
|
|
.stockLogList
|
|
.set(
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.attributeList,
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i])
|
|
}
|
|
}
|
|
this.carList.get(id)
|
|
.productCount +=
|
|
Number(purchaseDetails[j]
|
|
.saleDetailQueryDTO[i]
|
|
.productCount)
|
|
}
|
|
}
|
|
if (this.carList.get(id)
|
|
.stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
.productCount == 0 &&
|
|
purchaseDetails[0]
|
|
.saleDetailQueryDTO.length > 0
|
|
) {
|
|
this.carList.get(id)
|
|
.stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
}
|
|
this.carList.get(id).price1 = Number(this
|
|
.carList.get(id).productCount) * this
|
|
.carList.get(id).purchasePrice
|
|
} else {
|
|
|
|
let isTrue = false
|
|
this.carList.forEach(function(
|
|
value, key) {
|
|
if (value.productSn ==
|
|
purchaseDetails[0]
|
|
.productSn) {
|
|
isTrue = true
|
|
that.tui.toast(
|
|
'该货号被页面其他商品占用,请重新输入!'
|
|
)
|
|
that.carList.get(
|
|
id)
|
|
.productSn = ''
|
|
setTimeout(
|
|
resSLD => {
|
|
that.$forceUpdate()
|
|
}, 2000)
|
|
throw Error('被占用')
|
|
}
|
|
})
|
|
|
|
this.$nextTick(() => {
|
|
if (this.carList.get(
|
|
id)
|
|
.productName == ''
|
|
) {
|
|
this.carList.get(
|
|
id)
|
|
.productName =
|
|
purchaseDetails[
|
|
0]
|
|
.productName
|
|
}
|
|
|
|
this.carList.get(id)
|
|
.customerCategoryList =
|
|
purchaseDetails[0]
|
|
.customerCategoryList
|
|
|
|
if (isTrue == false &&
|
|
this.carList.get(
|
|
id)
|
|
.productSn == '') {
|
|
this.carList.get(
|
|
id)
|
|
.productSn =
|
|
purchaseDetails[
|
|
0]
|
|
.productSn
|
|
}
|
|
if (isTrue == false) {
|
|
if (purchaseDetails[
|
|
0]
|
|
.productId) {
|
|
this.carList
|
|
.get(id)
|
|
.id =
|
|
purchaseDetails[
|
|
0]
|
|
.productId
|
|
this.carList
|
|
.get(id)
|
|
.isNew =
|
|
false
|
|
id = purchaseDetails[
|
|
0]
|
|
.productId
|
|
} else if (
|
|
purchaseDetails[
|
|
0]
|
|
.productSn ==
|
|
'' ||
|
|
purchaseDetails[
|
|
0]
|
|
.productSn ==
|
|
null) {
|
|
this.carList
|
|
.get(id)
|
|
.id =
|
|
purchaseDetails[
|
|
0]
|
|
.productName
|
|
id = purchaseDetails[
|
|
0]
|
|
.productName
|
|
} else if (
|
|
purchaseDetails[
|
|
0]
|
|
.productSn ==
|
|
'货号') {
|
|
this.carList
|
|
.get(id)
|
|
.productSn =
|
|
purchaseDetails[
|
|
0]
|
|
.productName
|
|
this.carList
|
|
.get(id)
|
|
.id =
|
|
purchaseDetails[
|
|
0]
|
|
.productName
|
|
id = purchaseDetails[
|
|
0]
|
|
.productName
|
|
} else if (
|
|
purchaseDetails[
|
|
0]
|
|
.productSn) {
|
|
this.carList
|
|
.get(id)
|
|
.id =
|
|
purchaseDetails[
|
|
0]
|
|
.productSn
|
|
id = purchaseDetails[
|
|
0]
|
|
.productSn
|
|
}
|
|
}
|
|
this.$forceUpdate()
|
|
})
|
|
if (this.carList.get(id)
|
|
.purchasePrice == '' || this
|
|
.carList.get(id)
|
|
.purchasePrice == null) {
|
|
this.carList.get(id)
|
|
.purchasePrice =
|
|
purchaseDetails[0]
|
|
.purchasePrice
|
|
}
|
|
if (this.carList.get(id)
|
|
.productPicture == '') {
|
|
this.carList.get(id)
|
|
.productPicture =
|
|
purchaseDetails[
|
|
0].productPicture
|
|
}
|
|
if (purchaseDetails[0].productId) {
|
|
this.carList.get(id).attrId =
|
|
purchaseDetails[0].attrId
|
|
|
|
this.carList.get(id).lsPrice =
|
|
purchaseDetails[0]
|
|
.lsPrice
|
|
}
|
|
this.carList.get(id)
|
|
.wholesalePrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
let specMap =
|
|
new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList.forEach(
|
|
function(value,
|
|
key) {
|
|
if (key !=
|
|
value
|
|
.id) {
|
|
specMap
|
|
.set(
|
|
value
|
|
.id,
|
|
value
|
|
)
|
|
} else {
|
|
specMap
|
|
.set(
|
|
key,
|
|
value
|
|
)
|
|
}
|
|
})
|
|
this.carList = specMap
|
|
})
|
|
this.$nextTick(() => {
|
|
for (let j = 0; j <
|
|
purchaseDetails
|
|
.length; j++) {
|
|
for (let i = 0; i <
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO
|
|
.length; i++) {
|
|
purchaseDetails
|
|
[j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.name =
|
|
this
|
|
.sliceMsg(
|
|
purchaseDetails[
|
|
j]
|
|
.saleDetailQueryDTO[
|
|
i]
|
|
.attributeList
|
|
)
|
|
if (this
|
|
.carList
|
|
.get(id)
|
|
.stockLogList
|
|
.size == 0
|
|
) {
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.stockLogList
|
|
.set(
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.saleDetailQueryDTO[
|
|
i
|
|
]
|
|
.attributeList,
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.saleDetailQueryDTO[
|
|
i
|
|
]
|
|
)
|
|
} else {
|
|
if (this
|
|
.carList
|
|
.get(
|
|
id)
|
|
.stockLogList
|
|
.has(
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.saleDetailQueryDTO[
|
|
i
|
|
]
|
|
.attributeList
|
|
) ==
|
|
true) {
|
|
this.carList
|
|
.get(
|
|
id
|
|
)
|
|
.stockLogList
|
|
.get(
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.saleDetailQueryDTO[
|
|
i
|
|
]
|
|
.attributeList
|
|
)
|
|
.productCount +=
|
|
Number(purchaseDetails[j]
|
|
.saleDetailQueryDTO[i]
|
|
.productCount)
|
|
} else {
|
|
this.carList
|
|
.get(
|
|
id
|
|
)
|
|
.stockLogList
|
|
.set(
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.saleDetailQueryDTO[
|
|
i
|
|
]
|
|
.attributeList,
|
|
purchaseDetails[
|
|
j
|
|
]
|
|
.saleDetailQueryDTO[
|
|
i
|
|
]
|
|
)
|
|
}
|
|
}
|
|
this.carList
|
|
.get(id)
|
|
.productCount +=
|
|
Number(purchaseDetails[j]
|
|
.saleDetailQueryDTO[i]
|
|
.productCount)
|
|
}
|
|
}
|
|
this.carList.get(id)
|
|
.price1 = Number(this
|
|
.carList.get(id)
|
|
.productCount) *
|
|
this.carList.get(id)
|
|
.purchasePrice
|
|
if (this.carList.get(
|
|
id)
|
|
.stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
.productCount ==
|
|
0 &&
|
|
purchaseDetails[0]
|
|
.saleDetailQueryDTO
|
|
.length > 0) {
|
|
this.carList.get(
|
|
id)
|
|
.stockLogList
|
|
.delete(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
}
|
|
})
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
this.getAllPrice()
|
|
this.oneGoodsId = ''
|
|
})
|
|
} else {
|
|
this.tui.toast(
|
|
"抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
} else {
|
|
for (let i = 0; i < purchaseDetails
|
|
.length; i++) {
|
|
let data = {
|
|
id: "",
|
|
price: purchaseDetails[i]
|
|
.price,
|
|
productCount: 0,
|
|
attrId: purchaseDetails[i]
|
|
.attrId,
|
|
customerCategoryList: purchaseDetails[i]
|
|
.customerCategoryList,
|
|
categoryId: purchaseDetails[i]
|
|
.categoryId == '' ? this
|
|
.categoryList
|
|
.categoryId : purchaseDetails[i]
|
|
.categoryId,
|
|
categoryName: purchaseDetails[
|
|
i].categoryName == '' ?
|
|
this.categoryList
|
|
.categoryName : purchaseDetails[i]
|
|
.categoryName,
|
|
wholesalePrice: purchaseDetails[
|
|
i].wholesalePrice,
|
|
purchasePrice: purchaseDetails[
|
|
i].purchasePrice,
|
|
isNew: purchaseDetails[i]
|
|
.productId == null ? true : false,
|
|
productId: purchaseDetails[i]
|
|
.productId,
|
|
productName: purchaseDetails[i]
|
|
.productName,
|
|
productSn: purchaseDetails[i]
|
|
.productSn,
|
|
productPicture: purchaseDetails[
|
|
i].productPicture,
|
|
supplierName: purchaseDetails[
|
|
i].supplierName,
|
|
productPictures: [],
|
|
saleDetailQueryDTO: []
|
|
}
|
|
if (purchaseDetails[i].productId) {
|
|
data.id = purchaseDetails[i]
|
|
.productId
|
|
} else if (purchaseDetails[i]
|
|
.productSn == '' ||
|
|
purchaseDetails[i]
|
|
.productSn ==
|
|
null) {
|
|
data.id = purchaseDetails[i]
|
|
.productName
|
|
} else if (purchaseDetails[i]
|
|
.productSn == '货号') {
|
|
data.productSn = purchaseDetails[i]
|
|
.productName
|
|
data.id = purchaseDetails[i]
|
|
.productName
|
|
} else if (purchaseDetails[i]
|
|
.productSn) {
|
|
data.id = purchaseDetails[i]
|
|
.productSn
|
|
}
|
|
for (let m = 0; m < purchaseDetails[i]
|
|
.saleDetailQueryDTO
|
|
.length; m++) {
|
|
let list = {
|
|
attributeList: this
|
|
.getAttribute(
|
|
purchaseDetails[i]
|
|
.saleDetailQueryDTO[
|
|
m]
|
|
.attributeList),
|
|
productCount: Number(purchaseDetails[i]
|
|
.saleDetailQueryDTO[m]
|
|
.productCount) ||
|
|
Number(purchaseDetails[i]
|
|
.saleDetailQueryDTO[m]
|
|
.productCounts),
|
|
productNum: '',
|
|
name: this.sliceMsg(this
|
|
.getAttribute(
|
|
purchaseDetails[
|
|
i]
|
|
.saleDetailQueryDTO[
|
|
m]
|
|
.attributeList)
|
|
),
|
|
price: purchaseDetails[i]
|
|
.saleDetailQueryDTO[m]
|
|
.purchasePrice
|
|
}
|
|
data.productCount +=
|
|
Number(purchaseDetails[i]
|
|
.saleDetailQueryDTO[m].productCount)
|
|
data.saleDetailQueryDTO.push(list)
|
|
}
|
|
this.carList1.push(data)
|
|
}
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
if (type == true) {
|
|
this.$nextTick(() => {
|
|
setTimeout(resDAAS => {
|
|
this.AiVoice()
|
|
uni.hideLoading();
|
|
}, 500)
|
|
})
|
|
}
|
|
|
|
}
|
|
// }, 200 * (num +1))
|
|
|
|
// })
|
|
|
|
|
|
}
|
|
setTimeout(res => {
|
|
if (type == true && this.moreData.length > 0) {
|
|
this.$refs.popup.close()
|
|
this.$refs.voiceBottomPopup.close()
|
|
this.$refs.oneDataPopup.open()
|
|
this.showPopup(0)
|
|
}
|
|
}, 300)
|
|
|
|
}
|
|
})
|
|
}, 100)
|
|
|
|
},
|
|
delItemSn(val) {
|
|
var that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定删除此条货号规则吗?",
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
that.tui.request("/app/productSn/checkProductSn", "post", {
|
|
snPre: val.value
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
that.tui.request("/app/productSn/deleteProductSn", "post", {
|
|
id: res1.result.id
|
|
}, false, true).then((res2) => {
|
|
if (res2.code == 200) {
|
|
that.tui.toast('删除成功')
|
|
setTimeout(res => {
|
|
that.getSnList()
|
|
}, 1000)
|
|
} else {
|
|
uni.showToast({
|
|
title: res2.message,
|
|
icon: 'none'
|
|
})
|
|
}
|
|
}).catch((res) => {})
|
|
} else {
|
|
uni.showToast({
|
|
title: res1.message,
|
|
icon: 'none'
|
|
})
|
|
}
|
|
}).catch((res) => {})
|
|
}
|
|
}
|
|
})
|
|
|
|
},
|
|
dialogInputConfirm(e) {
|
|
if (this.categoryText == '') {
|
|
this.tui.toast("请输入规格值后提交")
|
|
return
|
|
}
|
|
//this.goodsDetail[0] 颜色
|
|
//this.goodsDetail[1] 尺码
|
|
this.$refs.inputDialog.close()
|
|
let data = {
|
|
isChecked: false,
|
|
value: this.categoryText
|
|
}
|
|
if (this.isOpenId == '0') {
|
|
this.goodsDetail.attributeList[0].value.push(data)
|
|
this.dataObj.set(data.value, '颜色')
|
|
} else if (this.isOpenId == '1') {
|
|
this.goodsDetail.attributeList[1].value.push(data)
|
|
this.dataObj.set(data.value, '尺码')
|
|
}
|
|
this.$refs.clearInput.onClear()
|
|
this.categoryText = ''
|
|
this.$forceUpdate()
|
|
},
|
|
dialogClose() {
|
|
this.inputVal = '';
|
|
this.$refs.inputDialog.close()
|
|
this.$refs.clearInput.onClear()
|
|
this.categoryText = ''
|
|
},
|
|
//去掉空格和换行
|
|
trimWhitespace(str) {
|
|
return str.replace(/\s+/g, '');
|
|
},
|
|
combination(arr) {
|
|
let result = [
|
|
[]
|
|
]
|
|
|
|
arr.map(x => {
|
|
var res = []
|
|
result.map(y => {
|
|
x.specs.map(z => {
|
|
res.push([...y, z])
|
|
})
|
|
})
|
|
result = res
|
|
})
|
|
return result;
|
|
},
|
|
//获取分类列表
|
|
getGategoryList() {
|
|
this.tui.request("/app/productCategory/list", "get", {
|
|
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
this.indexList = res.result;
|
|
this.$refs.clearInput.onClear()
|
|
this.categoryText = ""
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
//扫一扫功能
|
|
scanCodeAdd() {
|
|
let that = this;
|
|
uni.scanCode({
|
|
success: (res) => {
|
|
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++) {
|
|
// this.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++) {
|
|
// this.carList.push(item.saleDetailDTOList[i])
|
|
// }
|
|
// }
|
|
}
|
|
|
|
} else {
|
|
that.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {
|
|
that.tui.toast(res)
|
|
})
|
|
}
|
|
|
|
},
|
|
fail: (res) => {
|
|
uni.showToast({
|
|
title: '扫描失败',
|
|
icon: 'none'
|
|
})
|
|
}
|
|
})
|
|
},
|
|
getZhuBigImage(path) {
|
|
let paths = []
|
|
paths.push(path)
|
|
uni.previewImage({
|
|
urls: paths
|
|
});
|
|
},
|
|
uploadFilePromise(value) {
|
|
let that = this;
|
|
uni.chooseMedia({
|
|
count: 1,
|
|
mediaType: ['image'],
|
|
sourceType: ['album', 'camera'],
|
|
camera: 'back',
|
|
success(res) {
|
|
uni.compressImage({
|
|
src: res.tempFiles[0].tempFilePath,
|
|
quality: 50,
|
|
success: res1 => {
|
|
|
|
uni.uploadFile({
|
|
url: that.tui.interfaceUrl() + '/upload/file',
|
|
filePath: res1.tempFilePath,
|
|
name: 'file',
|
|
header: {
|
|
"content-type": "multipart/form-data",
|
|
'accessToken': that.tui.getToken()
|
|
},
|
|
formData: {},
|
|
success: (uploadFileRes) => {
|
|
that.carList.get(value[0]).productPicture = ''
|
|
let path = JSON.parse(uploadFileRes.data)
|
|
//后端返回的地址,存入图片地址
|
|
that.carList.get(value[0]).productPicture = path
|
|
.result
|
|
that.$forceUpdate()
|
|
}
|
|
});
|
|
}
|
|
})
|
|
|
|
}
|
|
})
|
|
},
|
|
goodsAdd() {
|
|
uni.navigateTo({
|
|
url: "/package1/inventory/changeGoods1"
|
|
})
|
|
},
|
|
mergeGoods() {
|
|
|
|
},
|
|
//上传子图
|
|
uploadZi(id) {
|
|
|
|
},
|
|
addGategory(e) {
|
|
let multipleList = [{
|
|
attributeName: '颜色',
|
|
productAttributeValueVoList: [{
|
|
isChecked: true,
|
|
value: "均色"
|
|
}]
|
|
}, {
|
|
attributeName: '尺码',
|
|
productAttributeValueVoList: [{
|
|
isChecked: true,
|
|
value: "均码"
|
|
}]
|
|
}]
|
|
this.tui.request("/app/productCategory/batchSaveCategoryAndAttribute", "post", {
|
|
categoryName: this.categoryText,
|
|
productAttributeOfAddVos: multipleList
|
|
}, false, false).then((res) => {
|
|
if (res.code == 200) {
|
|
this.getGategoryList()
|
|
uni.showToast({
|
|
title: "添加成功",
|
|
icon: 'none'
|
|
})
|
|
} else {
|
|
uni.showToast({
|
|
title: "添加失败",
|
|
icon: 'none'
|
|
})
|
|
}
|
|
this.$refs.addGateDialog.close()
|
|
}).catch((res) => {})
|
|
},
|
|
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)
|
|
}
|
|
}
|
|
}
|
|
|
|
for (var m = 0; m < this.pageOldTemList.length; m++) {
|
|
if (this.temporaryList[i].attributeList == this.pageOldTemList[m].attributeList) {
|
|
this.pageOldTemList[m].productCount = Number(this.temporaryList[i].productCount)
|
|
}
|
|
}
|
|
for (var j = 0; j < this.oldTemList.length; j++) {
|
|
if (this.temporaryList[i].attributeList == this.oldTemList[j].attributeList) {
|
|
this.oldTemList[j].productCount = Number(this.temporaryList[i].productCount)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.isPlusAndMinus == false
|
|
this.temporaryChange()
|
|
},
|
|
maskClick() {
|
|
|
|
},
|
|
async mapMinusNum(index) {
|
|
this.temporaryList[index].productCount--
|
|
this.temporaryChange()
|
|
},
|
|
mapPlusNum(index) {
|
|
this.temporaryList[index].productCount++
|
|
this.temporaryChange()
|
|
},
|
|
async oneMinusNum(index, index1) {
|
|
let that = this;
|
|
this.carList.get(index).productCount = 0
|
|
this.carList.get(index).returnCount = 0
|
|
if (this.carList.get(index).stockLogList.get(index1).productCount <= 0) {
|
|
this.carList.get(index).stockLogList.get(index1).productCount = 0
|
|
} else {
|
|
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 = Number(that.carList.get(index).returnCount) +
|
|
Math.abs(
|
|
value.productCount)
|
|
} else {
|
|
that.carList.get(index).productCount = Number(that.carList.get(index).productCount) +
|
|
Number(value
|
|
.productCount)
|
|
}
|
|
})
|
|
await this.$nextTick(() => {
|
|
// if (that.discountType != 0) { //单品折扣
|
|
that.carList.get(index).price1 = Number(that.carList.get(index).productCount) * that
|
|
.carList.get(index).purchasePrice
|
|
// }
|
|
})
|
|
this.$forceUpdate()
|
|
this.getAllPrice()
|
|
},
|
|
onePlusNum(index, index1) {
|
|
let that = this;
|
|
if (this.carList.get(index).stockLogList.get(index1).productCount < 0) {
|
|
this.carList.get(index).stockLogList.get(index1).productCount = 0
|
|
} else {
|
|
this.carList.get(index).stockLogList.get(index1).productCount++
|
|
}
|
|
that.carList.get(index).productCount++
|
|
that.carList.get(index).price1 = Number(that.carList.get(index).productCount) * that.carList
|
|
.get(index).purchasePrice
|
|
this.getAllPrice()
|
|
},
|
|
yuyinChange() {
|
|
this.isVoice = false
|
|
},
|
|
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()
|
|
},
|
|
mapnumChange(e, id, id1) {
|
|
let that = this;
|
|
this.carList.get(id).productCount = 0
|
|
this.carList.get(id).returnCount = 0
|
|
if (this.linshiPrice == e.target.value) {
|
|
this.carList.get(id).stockLogList.get(id1).productCount = Number(e.target.value)
|
|
} else {
|
|
if (e.detail.value == '') {
|
|
this.carList.get(id).stockLogList.get(id1).productCount = Number(this.linshiPrice)
|
|
} else {
|
|
this.carList.get(id).stockLogList.get(id1).productCount = Number(e.detail.value)
|
|
}
|
|
}
|
|
|
|
this.carList.get(id).stockLogList.forEach(function(value, key) {
|
|
if (value.productCount < 0) {
|
|
that.carList.get(id).returnCount = Number(that.carList.get(id).returnCount) + Math.abs(
|
|
value
|
|
.productCount)
|
|
} else {
|
|
that.carList.get(id).productCount = Number(that.carList.get(id).productCount) + Number(
|
|
value.productCount)
|
|
}
|
|
})
|
|
this.$nextTick(() => {
|
|
// if (that.discountType != 0) { //单品折扣
|
|
that.carList.get(id).price1 = Number(that.carList.get(id).productCount) * that.carList
|
|
.get(id).purchasePrice
|
|
// }
|
|
})
|
|
this.$nextTick(() => {
|
|
this.getAllPrice()
|
|
})
|
|
},
|
|
voiceGetOne() {
|
|
this.voiceGetOneData = !this.voiceGetOneData
|
|
},
|
|
obtainPrice(e, type, num, num1) {
|
|
this.linshiPrice = e.target.value
|
|
if (type == 'danjia') {
|
|
this.carList.get(num).purchasePrice = ''
|
|
} else if (type == 'pifa') {
|
|
this.carList.get(num).wholesalePrice = ''
|
|
} else if (type == 'lingshou') {
|
|
this.carList.get(num).lsprice = ''
|
|
this.$forceUpdate()
|
|
} else if (type == 'danjishu') {
|
|
this.temporaryList[num].productCount = ''
|
|
this.$forceUpdate()
|
|
} else if (type == 'zongjishu') {
|
|
this.allChangeNum = ''
|
|
} else if (type == 'shouldPay') {
|
|
this.shouldPay = ''
|
|
} else if (type == 'mapdanjishu') {
|
|
this.carList.get(num).stockLogList.get(num1).productCount = ''
|
|
this.$forceUpdate()
|
|
} else if (type == 'alreadyPay') {
|
|
this.alreadyPay = ''
|
|
}
|
|
this.$forceUpdate()
|
|
},
|
|
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++
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
for (var m = 0; m < this.pageOldTemList.length; m++) {
|
|
if (this.temporaryList[i].attributeList == this.pageOldTemList[m].attributeList) {
|
|
this.pageOldTemList[m].productCount = Number(this.temporaryList[i].productCount)
|
|
}
|
|
}
|
|
for (var j = 0; j < this.oldTemList.length; j++) {
|
|
if (this.temporaryList[i].attributeList == this.oldTemList[j].attributeList) {
|
|
this.oldTemList[j].productCount = Number(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--
|
|
}
|
|
}
|
|
}
|
|
|
|
for (var m = 0; m < this.pageOldTemList.length; m++) {
|
|
if (this.temporaryList[i].attributeList == this.pageOldTemList[m].attributeList) {
|
|
this.pageOldTemList[m].productCount = Number(this.temporaryList[i].productCount)
|
|
}
|
|
}
|
|
for (var j = 0; j < this.oldTemList.length; j++) {
|
|
if (this.temporaryList[i].attributeList == this.oldTemList[j].attributeList) {
|
|
this.oldTemList[j].productCount = Number(this.temporaryList[i].productCount)
|
|
}
|
|
}
|
|
}
|
|
this.temporaryChange()
|
|
},
|
|
goChooseGoods() {
|
|
uni.navigateTo({
|
|
url: '/package1/AI/AiChangeGoods'
|
|
})
|
|
},
|
|
longPrec(index, value, index1) {
|
|
var that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定删除此默认规格吗?",
|
|
success: function(res) {
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
if (res.confirm) {
|
|
that.delDefaultCate(index, value, index1)
|
|
}
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 500)
|
|
}
|
|
})
|
|
},
|
|
attrNameChange(index, data1, index1) {
|
|
let that = this;
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
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 == 0) {
|
|
this.oldTemList = []
|
|
this.temporaryList = this.pageOldTemList
|
|
}
|
|
if (this.temporaryList.length == 0) {
|
|
if (jishuqi == this.goodsList.length) {
|
|
for (var i = 0; i < value.length; i++) {
|
|
this.attributeList = {
|
|
attributeList: value[i],
|
|
productCount: Number(this.temporaryNum),
|
|
productNum: this.productNum,
|
|
name: this.evalue[i],
|
|
price: this.purchasePrice
|
|
}
|
|
this.temporaryList.push(this.attributeList);
|
|
}
|
|
}
|
|
} 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 = Number(this.temporaryList[m].productCount)
|
|
}
|
|
}
|
|
this.attributeList = {
|
|
attributeList: value[i],
|
|
productCount: newProductCount || 0,
|
|
productNum: this.productNum,
|
|
name: this.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 = Number(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 = Number(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 < that.temporaryList.length; i++) {
|
|
for (var m = 0; m < that.pecsList.length; m++) {
|
|
if (that.temporaryList[i].attributeList == that.pecsList[m].attributeList) {
|
|
that.temporaryList[i].productNum = that.pecsList[m].stockCount
|
|
}
|
|
that.$forceUpdate()
|
|
}
|
|
}
|
|
})
|
|
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 = []
|
|
}
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 200)
|
|
},
|
|
clickGategroy(item) {
|
|
this.carList.get(this.productId).categoryName = item.categoryName
|
|
this.carList.get(this.productId).categoryId = item.id
|
|
this.$forceUpdate()
|
|
this.$refs.typePopup.close()
|
|
},
|
|
changeMore(e) {
|
|
|
|
if (e.show == false) {
|
|
this.moreData = []
|
|
}
|
|
},
|
|
change() {
|
|
this.allChangeNum = 0
|
|
this.oldTemList = []
|
|
},
|
|
lunbochange(e) {
|
|
this.current = e.detail.current
|
|
},
|
|
//弹出商品规格选择
|
|
toggle(type, id) {
|
|
if (type == 'bottom') {
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
this.allChangeNum = 0
|
|
this.getById(id);
|
|
} else if (type == 'typePopup') {
|
|
this.productId = id
|
|
this.getGategoryList()
|
|
this.$refs.typePopup.open()
|
|
} else if (type == 'addGateDialog') {
|
|
this.$refs.addGateDialog.open("bottom")
|
|
} else if (type == "mergePopup") {
|
|
this.mergeId = id
|
|
this.$refs.mergePopup.open()
|
|
} else if (type == 'center') {
|
|
this.initRecord();
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.open(type)
|
|
} else if (type == 'voiceBottom') {
|
|
this.initRecord();
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.voiceBottomPopup.open('bottom')
|
|
} else if (type == 'oneGoods') {
|
|
this.oneGoodsId = id
|
|
this.initRecord();
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.open('center')
|
|
}
|
|
},
|
|
//按住语音识别,开始
|
|
kaishi() {
|
|
if (this.isVoice == false) {
|
|
this.recordState = true
|
|
uni.vibrateShort();
|
|
manager.start({
|
|
duration: 60000,
|
|
lang: "zh_CN"
|
|
});
|
|
}
|
|
},
|
|
//松开语音识别,结束
|
|
jieshu() {
|
|
this.recordState = false
|
|
manager.stop()
|
|
},
|
|
isCharPrecededByNumber(str, char) {
|
|
const regex = new RegExp(`\\d${char}`, 'g');
|
|
return regex.test(str);
|
|
},
|
|
|
|
replaceCharAfterNumber(str, charToFind, charToReplace) {
|
|
// 正则表达式匹配字符前是否有数字,并且该字符与charToFind相同
|
|
const regex = new RegExp(`\\d${charToFind}`, 'g');
|
|
// 使用replace方法进行替换
|
|
return str.replace(regex, (match) => {
|
|
// 将匹配到的字符中的指定字符替换为charToReplace
|
|
return match.replace(charToFind, charToReplace);
|
|
});
|
|
},
|
|
//查询货号的后面第一个中文字符是不是“数量”,是返回true
|
|
isQuantityFollowsProductCode(str) {
|
|
const afterProductCode = str.split('货号')[1];
|
|
if (!afterProductCode || afterProductCode.indexOf('数量') === -1) {
|
|
return false;
|
|
}
|
|
const beforeQuantity = afterProductCode.split('数量')[0];
|
|
const containsChineseCharacter = /[^\u4e00-\u9fa5]/.test(beforeQuantity);
|
|
return !containsChineseCharacter;
|
|
},
|
|
extractInfo(str) {
|
|
const info = {};
|
|
const regexes = [{
|
|
name: 'productSn',
|
|
regex: /货号(.*?),/
|
|
},
|
|
{
|
|
name: 'productCount',
|
|
regex: /,数量:(.*?),/
|
|
},
|
|
{
|
|
name: 'productCount',
|
|
regex: /,数量:(.*?)。/
|
|
},
|
|
{
|
|
name: 'purchasePrice',
|
|
regex: /,单价:(.*?),/
|
|
},
|
|
{
|
|
name: 'purchasePrice',
|
|
regex: /,单价:(.*?)。/
|
|
},
|
|
{
|
|
name: 'productName',
|
|
regex: /,名称:(.*?),/
|
|
},
|
|
{
|
|
name: 'productName',
|
|
regex: /,名称:(.*?)。/
|
|
},
|
|
{
|
|
name: 'wholesalePrice',
|
|
regex: /,批发价:(.*?),/
|
|
},
|
|
{
|
|
name: 'wholesalePrice',
|
|
regex: /,批发价:(.*?)。/
|
|
},
|
|
{
|
|
name: 'lsprice',
|
|
regex: /,零售价:(.*?),/
|
|
},
|
|
{
|
|
name: 'lsprice',
|
|
regex: /,零售价:(.*?)。/
|
|
}
|
|
];
|
|
|
|
regexes.forEach(({
|
|
name,
|
|
regex
|
|
}) => {
|
|
const match = str.match(regex);
|
|
if (match && match[1]) {
|
|
// 去除可能的前后空格
|
|
info[name] = match[1].trim();
|
|
}
|
|
});
|
|
if (info.productCount && info.productCount.indexOf(',') != -1) {
|
|
info.productCount = info.productCount.split(',')[0]
|
|
}
|
|
if (info.purchasePrice && info.purchasePrice.indexOf(',') != -1) {
|
|
info.purchasePrice = info.purchasePrice.split(',')[0]
|
|
}
|
|
if (info.productName && info.productName.indexOf(',') != -1) {
|
|
info.productName = info.productName.split(',')[0]
|
|
}
|
|
if (info.wholesalePrice && info.wholesalePrice.indexOf(',') != -1) {
|
|
info.wholesalePrice = info.wholesalePrice.split(',')[0]
|
|
}
|
|
if (info.lsprice && info.lsprice.indexOf(',') != -1) {
|
|
info.lsprice = info.lsprice.split(',')[0]
|
|
}
|
|
return info;
|
|
},
|
|
//语音识别功能初始化
|
|
initRecord() {
|
|
let that = this;
|
|
manager.stop()
|
|
// 识别结束事件
|
|
manager.onStop = (res) => {
|
|
let convertedStr = this.spliceMsg(this.convertChineseToArabic(res.result));
|
|
convertedStr = this.removeSpacesAndCommas(convertedStr)
|
|
convertedStr = this.removePunctuationAndSpaces(convertedStr)
|
|
if (convertedStr.indexOf('点') != -1) {
|
|
convertedStr = that.replaceCharAfterNumber(convertedStr, '点', '.')
|
|
}
|
|
if (convertedStr.indexOf(',名称') != -1) {
|
|
convertedStr = convertedStr.replace(/,名称/g, '名称')
|
|
}
|
|
if (convertedStr.indexOf('名称,') != -1) {
|
|
convertedStr = convertedStr.replace(/名称,/g, '名称')
|
|
}
|
|
if (convertedStr.indexOf('名称') != -1) {
|
|
convertedStr = convertedStr.replace(/名称/g, ',名称:')
|
|
}
|
|
if (convertedStr.indexOf(',单价') != -1) {
|
|
convertedStr = convertedStr.replace(/,单价/g, '单价')
|
|
}
|
|
if (convertedStr.indexOf('单价,') != -1) {
|
|
convertedStr = convertedStr.replace(/单价,/g, '单价')
|
|
}
|
|
if (convertedStr.indexOf('单价') != -1) {
|
|
convertedStr = convertedStr.replace(/单价/g, ',单价:')
|
|
}
|
|
if (convertedStr.indexOf(',数量') != -1) {
|
|
convertedStr = convertedStr.replace(/,数量/g, '数量')
|
|
}
|
|
if (convertedStr.indexOf('数量,') != -1) {
|
|
convertedStr = convertedStr.replace(/数量,/g, '数量')
|
|
}
|
|
if (convertedStr.indexOf('数量') != -1) {
|
|
convertedStr = convertedStr.replace(/数量/g, ',数量:')
|
|
}
|
|
if (convertedStr.indexOf(',批发价') != -1) {
|
|
convertedStr = convertedStr.replace(/,批发价/g, '批发价')
|
|
}
|
|
if (convertedStr.indexOf('批发价,') != -1) {
|
|
convertedStr = convertedStr.replace(/批发价,/g, '批发价')
|
|
}
|
|
if (convertedStr.indexOf('批发价::') != -1) {
|
|
convertedStr = convertedStr.replace(/批发价::/g, '批发价')
|
|
}
|
|
if (convertedStr.indexOf('批发价:') != -1) {
|
|
convertedStr = convertedStr.replace(/批发价:/g, '批发价')
|
|
}
|
|
if (convertedStr.indexOf('批发价') != -1) {
|
|
convertedStr = convertedStr.replace(/批发价/g, ',批发价:')
|
|
}
|
|
if (convertedStr.startsWith("号")) {
|
|
convertedStr = "货号" + convertedStr.substr(1);
|
|
}
|
|
if (!convertedStr.startsWith("货号")) {
|
|
convertedStr = "货号" + convertedStr;
|
|
}
|
|
if (convertedStr.indexOf('货号,') != -1) {
|
|
convertedStr = convertedStr.replace(/货号,/g, '货号')
|
|
}
|
|
if (convertedStr.indexOf('货号::') != -1) {
|
|
convertedStr = convertedStr.replace(/货号::/g, '货号')
|
|
}
|
|
if (convertedStr.indexOf('货号:') != -1) {
|
|
convertedStr = convertedStr.replace(/货号:/g, '货号')
|
|
}
|
|
if (convertedStr.indexOf('货号') != -1) {
|
|
convertedStr = convertedStr.replace(/货号/g, '货号:')
|
|
}
|
|
convertedStr = convertedStr.replace(/[沟勾钩]/g, 'J');
|
|
convertedStr = this.convertStringCorrectly(convertedStr)
|
|
|
|
if (convertedStr.indexOf(',') == 0) {
|
|
convertedStr = convertedStr.substr(1)
|
|
}
|
|
|
|
if (that.voiceText == '' || that.voiceText == null) {
|
|
that.voiceText = convertedStr
|
|
that.voiceText1 = convertedStr
|
|
} else {
|
|
that.voiceText += '\n' + convertedStr
|
|
that.voiceText1 = convertedStr + '\n' + that.voiceText1
|
|
}
|
|
}
|
|
|
|
// 识别错误事件
|
|
manager.onError = (res) => {
|
|
if (res.retcode == '-30011') {
|
|
that.isVoice = true
|
|
}
|
|
if (res.retcode == '-30004') {
|
|
// uni.hideLoading()
|
|
that.isVoice = false
|
|
uni.hideToast()
|
|
uni.showToast({
|
|
title: "未识别到声音信息,请重新录入",
|
|
icon: 'none'
|
|
})
|
|
}
|
|
if (res.retcode == '-40001') {
|
|
uni.showToast({
|
|
title: '使用次数超限制,请联系管理员!',
|
|
icon: 'none'
|
|
})
|
|
}
|
|
}
|
|
},
|
|
getAttribute(str) {
|
|
str = str.replace(/"色"(?![^{]*": *"色")/g, '"均色"');
|
|
str = str.replace(/"码"(?![^{]*": *"码")/g, '"均码"');
|
|
return str
|
|
},
|
|
//清空语音输入的文字
|
|
clearText() {
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
},
|
|
getText(e) {
|
|
this.voiceText = e.detail.value
|
|
},
|
|
//正则匹配处理“2十9”等情况
|
|
convertStringCorrectly(str) {
|
|
var regexForSingleTen = /(\d+)十(?!\d)/g;
|
|
var regexForFollowedByDigit = /(\d+)十(?=\d)/g;
|
|
var step1Result = str.replace(regexForSingleTen, '$10');
|
|
var finalResult = step1Result.replace(regexForFollowedByDigit, '$1');
|
|
|
|
return finalResult;
|
|
},
|
|
spliceMsg(res) {
|
|
let regex = /嗯|啊|儿|阿|恩/g;
|
|
return res.replace(regex, '')
|
|
},
|
|
convertChineseToArabic(str) {
|
|
const chineseNumToArabic = {
|
|
// '零': 0,
|
|
'幺': 1,
|
|
'一': 1,
|
|
'二': 2,
|
|
'两': 2,
|
|
'三': 3,
|
|
'四': 4,
|
|
'五': 5,
|
|
'六': 6,
|
|
'七': 7,
|
|
'八': 8,
|
|
'九': 9,
|
|
'杠': '-',
|
|
'刚': '-',
|
|
'军色': '均色',
|
|
'叉': 'X',
|
|
'井': '#',
|
|
'时间': '10件',
|
|
'事件': '10件',
|
|
'世间': '10件',
|
|
'实践': '10件',
|
|
'实件': '10件',
|
|
'实价': '10件',
|
|
'议价': '1件',
|
|
'衣架': '1件',
|
|
'景': '#',
|
|
'警': '#',
|
|
'颈': '#',
|
|
'括号': '货号',
|
|
'名城': '名称',
|
|
'明城': '名称',
|
|
'名成': '名称',
|
|
'名程': '名称',
|
|
'上移': '上衣',
|
|
'时1': '11',
|
|
'时2': '12',
|
|
'时3': '13',
|
|
'时4': '14',
|
|
'时5': '15',
|
|
'时6': '16',
|
|
'时7': '17',
|
|
'时8': '18',
|
|
'时9': '19',
|
|
|
|
};
|
|
const regex =
|
|
/(幺|一|二|两|三|四|五|六|七|八|九|杠|刚|军色|叉|井|时间|衣架|议价|实价|事件|世间|实践|实件|景|警|颈|括号|名城|名程|名成|明城|上移|时1|时2|时3|时4|时5|时6|时7|时8|时9)/g;
|
|
return str.replace(regex, match => chineseNumToArabic[match]);
|
|
},
|
|
//合并已有
|
|
clickMerge(value, key) {
|
|
let that = this;
|
|
this.carList.get(this.mergeId).stockLogList.forEach(function(values, keys) {
|
|
if (that.carList.get(value).stockLogList.has(keys)) {
|
|
that.carList.get(value).stockLogList.get(keys).productCount += Number(that.carList.get(that
|
|
.mergeId).stockLogList.get(keys).productCount)
|
|
} else {
|
|
that.carList.get(value).stockLogList.set(keys, that.carList.get(that.mergeId).stockLogList
|
|
.get(keys))
|
|
}
|
|
that.carList.get(value).productCount += Number(that.carList.get(that.mergeId).stockLogList.get(
|
|
keys)
|
|
.productCount)
|
|
that.carList.get(value).price1 = Number(that.carList.get(value).productCount) * that.carList
|
|
.get(value)
|
|
.purchasePrice
|
|
})
|
|
this.carList.delete(this.mergeId)
|
|
this.$forceUpdate()
|
|
this.getAllPrice()
|
|
this.$refs.mergePopup.close()
|
|
},
|
|
AiAddSpec(value) {
|
|
this.getById(value, 1);
|
|
},
|
|
pictureAdd(id, huan) {
|
|
let that = this
|
|
uni.showLoading({
|
|
title: '加载中...',
|
|
mask: true
|
|
})
|
|
if (id != '') { //上传多图
|
|
this.childrenId = id
|
|
if (this.carList.get(id).productPictures.length > 0 && huan != 'huan') {
|
|
this.productPictures = this.carList.get(id).productPictures
|
|
this.$refs.showImgDiaLog.open()
|
|
uni.hideLoading();
|
|
return;
|
|
} else if (huan == 'huan') {
|
|
this.$refs.showImgDiaLog.close()
|
|
}
|
|
} else {
|
|
this.childrenId = ''
|
|
}
|
|
uni.chooseMedia({
|
|
count: 9,
|
|
mediaType: ['image'],
|
|
sourceType: ['album'],
|
|
success(res) {
|
|
if (that.childrenId != '') {
|
|
that.carList.get(that.childrenId).productPictures = []
|
|
}
|
|
for (let i = 0; i < res.tempFiles.length; i++) {
|
|
that.upLoadFile(res.tempFiles[i].tempFilePath, i + 1)
|
|
that.zhuImgList.push(res.tempFiles[i].tempFilePath)
|
|
}
|
|
},
|
|
fail(err) {
|
|
uni.hideLoading();
|
|
}
|
|
})
|
|
uni.hideLoading();
|
|
},
|
|
async upLoadFile(path, time) {
|
|
let that = this;
|
|
let hiver_token = uni.getStorageSync("hiver_token")
|
|
await uni.compressImage({
|
|
src: path,
|
|
quality: 50,
|
|
success: res1 => {
|
|
|
|
uni.uploadFile({
|
|
url: that.tui.interfaceUrl() + '/upload/file',
|
|
filePath: res1.tempFilePath,
|
|
name: 'file',
|
|
header: {
|
|
"content-type": "multipart/form-data",
|
|
'accessToken': hiver_token
|
|
},
|
|
formData: {},
|
|
success: (uploadFileRes) => {
|
|
let pathData = JSON.parse(uploadFileRes.data)
|
|
if (that.childrenId != '') {
|
|
let data = {
|
|
productPicture: pathData.result
|
|
}
|
|
that.carList.get(that.childrenId).productPictures.push(
|
|
data)
|
|
that.$forceUpdate()
|
|
} else {
|
|
setTimeout(function() {
|
|
that.isSnList(pathData.result)
|
|
}, 100 * time);
|
|
|
|
// that.addPageGoods(pathData.result)
|
|
}
|
|
},
|
|
fail: (err) => {
|
|
uni.hideLoading();
|
|
uni.showToast({
|
|
title: JSON.stringify(err),
|
|
icon: 'none'
|
|
})
|
|
}
|
|
});
|
|
}
|
|
})
|
|
|
|
await setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 1000)
|
|
},
|
|
removeSpacesAndCommas(str) {
|
|
// 正则表达式匹配所有空格和逗号
|
|
const regex = /[ ,,]/g; // 注意这里的空格和全角空格(全角逗号也包括在内)
|
|
|
|
// 使用replace()方法替换匹配到的空格和逗号为空字符串
|
|
return str.replace(regex, '');
|
|
},
|
|
//通过商品id查询商品详细信息
|
|
getById(id, current) {
|
|
let that = this;
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
this.isBottom = false
|
|
//判断isNew,新商品直接调店铺颜色库
|
|
if (current == 1) {
|
|
that.goodsDetail = id;
|
|
that.goodsDetail.attributeList = []
|
|
if (this.goodsDetail.isNew) {
|
|
this.goodsList = []
|
|
that.goodsDetail.attributeList = this.defaultList
|
|
for (var i = 0; i < that.goodsDetail.attributeList.length; i++) {
|
|
for (var m = 0; m < that.goodsDetail.attributeList[i].value.length; m++) {
|
|
that.dataObj.set(that.goodsDetail.attributeList[i].value[m].value, that.goodsDetail
|
|
.attributeList[i].name)
|
|
}
|
|
let specs1 = {
|
|
specs: []
|
|
}
|
|
that.goodsList.push(specs1)
|
|
}
|
|
this.$refs.shopPopup.open('bottom')
|
|
} else {
|
|
that.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId",
|
|
"POST", {
|
|
categoryId: that.goodsDetail.attrId
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
that.goodsList = []
|
|
if (typeof(res1.result.attributeAndValue) == 'string') {
|
|
let newObj = JSON.parse(res1.result.attributeAndValue)
|
|
let newArr = []
|
|
let dataArr = []
|
|
for (let val in newObj) {
|
|
let valueObj = [];
|
|
for (var i = 0; i < newObj[val].length; i++) {
|
|
valueObj.push({
|
|
value: newObj[val][i],
|
|
isChecked: false
|
|
})
|
|
that.dataObj.set(newObj[val][i], val)
|
|
}
|
|
newArr.push({
|
|
name: val,
|
|
value: valueObj
|
|
})
|
|
}
|
|
that.goodsDetail.attributeList = newArr;
|
|
for (var i = 0; i < that.goodsDetail.attributeList.length; i++) {
|
|
let specs1 = {
|
|
specs: []
|
|
}
|
|
that.goodsList.push(specs1)
|
|
}
|
|
} else {
|
|
that.tui.toast('失败了')
|
|
}
|
|
that.getKCList(res1.result.stock);
|
|
} else {
|
|
that.tui.toast(res1.message)
|
|
}
|
|
}).catch((res) => {})
|
|
}
|
|
this.pageOldTemList = []
|
|
that.temporaryList = []
|
|
if (that.carList.size > 0) {
|
|
let isArgin = false
|
|
let idOrProductId = ''
|
|
if (id.isNew) {
|
|
idOrProductId = id.id
|
|
} else {
|
|
idOrProductId = id.productId
|
|
}
|
|
if (that.carList.get(idOrProductId).stockLogList.size == 1) {
|
|
if (that.carList.get(idOrProductId).stockLogList.get('{"颜色":"均色","尺码":"均码"}') != null && that
|
|
.carList.get(idOrProductId).stockLogList.get('{"颜色":"均色","尺码":"均码"}') != undefined) {
|
|
that.carList.get(idOrProductId).stockLogList.get('{"颜色":"均色","尺码":"均码"}').productCount = 0
|
|
}
|
|
}
|
|
that.carList.forEach(function(value, key) {
|
|
value.stockLogList1 = []
|
|
if (isArgin == false) {
|
|
value.stockLogList.forEach(function(values, keys) {
|
|
if (value.stockLogList1.length == 0) {
|
|
let obj = {
|
|
productCount: Number(values.productCount),
|
|
name: values.name,
|
|
attributeList: keys,
|
|
productNum: values.productNum
|
|
}
|
|
value.stockLogList1.push(obj)
|
|
} else {
|
|
for (var i = 0; i < value.stockLogList1.length; i++) {
|
|
if (value.stockLogList1[i].attributeList != keys) {
|
|
if (value.stockLogList1.length == (i + 1)) {
|
|
let obj = {
|
|
productCount: Number(values.productCount),
|
|
name: values.name,
|
|
attributeList: keys,
|
|
productNum: values.productNum
|
|
}
|
|
value.stockLogList1.push(obj)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
})
|
|
|
|
if (value.productId == id) {
|
|
that.zNum = Number(value.productCount)
|
|
that.temporaryList = value.stockLogList1
|
|
that.pageOldTemList = value.stockLogList1
|
|
that.oldTemList = value.stockLogList1
|
|
isArgin = true
|
|
} else {
|
|
if (value.isNew) {
|
|
if (value.id == id.id) {
|
|
that.zNum = Number(value.productCount)
|
|
that.temporaryList = value.stockLogList1
|
|
that.pageOldTemList = value.stockLogList1
|
|
that.oldTemList = value.stockLogList1
|
|
isArgin = true
|
|
}
|
|
} else {
|
|
if (value.productId == id.productId) {
|
|
that.zNum = Number(value.productCount)
|
|
that.temporaryList = value.stockLogList1
|
|
that.pageOldTemList = value.stockLogList1
|
|
that.oldTemList = value.stockLogList1
|
|
isArgin = true
|
|
}
|
|
}
|
|
|
|
}
|
|
value.stockLogList1 = []
|
|
|
|
}
|
|
|
|
})
|
|
|
|
that.zNum = 0
|
|
// that.$nextTick(() => {
|
|
// that.carList.forEach(function(value, key) {
|
|
|
|
// })
|
|
// })
|
|
}
|
|
} else {
|
|
this.tui.request("/app/product/getById/" + id, "POST", {}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.result.delFlag == 0) {
|
|
that.tui.toast("请将商品上架后再操作!")
|
|
return
|
|
}
|
|
if (res.result.inStorageStatus == 0) {
|
|
that.tui.toast("请将商品入库后再操作!")
|
|
return
|
|
}
|
|
|
|
that.goodsDetail = res.result;
|
|
that.goodsDetail.attributeList = this.defaultList
|
|
that.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId",
|
|
"POST", {
|
|
categoryId: that.goodsDetail.attrId || that.categoryList.attrId
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
that.goodsList = []
|
|
if (typeof(res1.result.attributeAndValue) == 'string') {
|
|
let newObj = JSON.parse(res1.result.attributeAndValue)
|
|
let newArr = []
|
|
let dataArr = []
|
|
for (let val in newObj) {
|
|
let valueObj = [];
|
|
for (var i = 0; i < newObj[val].length; i++) {
|
|
valueObj.push({
|
|
value: newObj[val][i],
|
|
isChecked: false
|
|
})
|
|
that.dataObj.set(newObj[val][i], val)
|
|
}
|
|
newArr.push({
|
|
name: val,
|
|
value: valueObj
|
|
})
|
|
}
|
|
that.goodsDetail.attributeList = newArr;
|
|
for (var i = 0; i < that.goodsDetail.attributeList.length; i++) {
|
|
// let oldCheck = false
|
|
// let oldValue = []
|
|
// for (var m = 0; m < that.goodsDetail.attributeList[i].value
|
|
// .length; m++) {
|
|
// if (that.goodsDetail.attributeList[i].value[m]
|
|
// .isChecked == true) {
|
|
// oldCheck = true
|
|
// oldValue.push(that.goodsDetail.attributeList[i]
|
|
// .value[m].value)
|
|
// }
|
|
// }
|
|
let specs1 = {
|
|
specs: []
|
|
}
|
|
that.goodsList.push(specs1)
|
|
// oldCheck = false
|
|
// oldValue = []
|
|
}
|
|
} else {
|
|
that.tui.toast('失败了')
|
|
}
|
|
|
|
this.pageOldTemList = []
|
|
that.temporaryList = []
|
|
if (that.carList.size > 0) {
|
|
let isArgin = false
|
|
that.carList.forEach(function(value, key) {
|
|
value.stockLogList1 = []
|
|
if (isArgin == false) {
|
|
value.stockLogList.forEach(function(values, keys) {
|
|
if (value.stockLogList1.length == 0) {
|
|
let obj = {
|
|
productCount: Number(values
|
|
.productCount),
|
|
name: values.name,
|
|
attributeList: keys,
|
|
productNum: values
|
|
.productNum
|
|
}
|
|
value.stockLogList1.push(obj)
|
|
} else {
|
|
for (var i = 0; i < value
|
|
.stockLogList1.length; i++) {
|
|
if (value.stockLogList1[i]
|
|
.attributeList != keys) {
|
|
if (value.stockLogList1
|
|
.length == (i + 1)) {
|
|
let obj = {
|
|
productCount: Number(
|
|
values
|
|
.productCount
|
|
),
|
|
name: values
|
|
.name,
|
|
attributeList: keys,
|
|
productNum: values
|
|
.productNum
|
|
}
|
|
value.stockLogList1
|
|
.push(obj)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
})
|
|
|
|
if (value.productId == id) {
|
|
that.zNum = Number(value.productCount)
|
|
that.temporaryList = value.stockLogList1
|
|
that.pageOldTemList = value.stockLogList1
|
|
that.oldTemList = value.stockLogList1
|
|
isArgin = true
|
|
} else {
|
|
if (value.isNew) {
|
|
if (value.id == id.id) {
|
|
that.zNum = Number(value.productCount)
|
|
that.temporaryList = value
|
|
.stockLogList1
|
|
that.pageOldTemList = value
|
|
.stockLogList1
|
|
that.oldTemList = value.stockLogList1
|
|
isArgin = true
|
|
}
|
|
} else {
|
|
if (value.productId == id.productId) {
|
|
that.zNum = Number(value.productCount)
|
|
that.temporaryList = value
|
|
.stockLogList1
|
|
that.pageOldTemList = value
|
|
.stockLogList1
|
|
that.oldTemList = value.stockLogList1
|
|
isArgin = true
|
|
}
|
|
}
|
|
|
|
}
|
|
value.stockLogList1 = []
|
|
|
|
}
|
|
|
|
})
|
|
that.zNum = 0
|
|
if (that.carList.get(id)) {
|
|
if (that.carList.get(id).stockLogList1.length == 1) {
|
|
if (that.carList.get(id).stockLogList1[0].attributeList ==
|
|
'{"颜色":"均色","尺码":"均码"}') {
|
|
that.carList.get(id).stockLogList1[0].productCount = 0
|
|
}
|
|
}
|
|
}
|
|
|
|
// that.$nextTick(() => {
|
|
// that.carList.forEach(function(value, key) {
|
|
|
|
// })
|
|
// })
|
|
}
|
|
this.getKCList(res1.result.stock)
|
|
} else {
|
|
that.tui.toast(res1.message)
|
|
}
|
|
}).catch((res) => {})
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
}
|
|
uni.hideLoading()
|
|
},
|
|
changeSn() {
|
|
|
|
},
|
|
//新增商品的时候,判断有没有货号生成规则,没有则弹出货号新增弹出层
|
|
async isSnList(img) {
|
|
if (this.isGenerateSnRadio == 1) { //不自动生成货号
|
|
await this.addPageGoods(img, '')
|
|
} else {
|
|
if (this.snList.length > 0) {
|
|
await this.getNewSn(img)
|
|
} else {
|
|
this.zhuImg = img
|
|
this.$refs.SNDialog.open('center')
|
|
uni.hideLoading()
|
|
}
|
|
}
|
|
},
|
|
//获取新货号
|
|
getNewSn(img) {
|
|
this.tui.request("/app/productSn/getNewProductSn", "POST", {
|
|
snPre: this.snName
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
this.tui.request('/app/product/getByProductSn', "post", {
|
|
productSn: res1.result
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.result != '') {
|
|
this.generateSn(value)
|
|
} else {
|
|
this.addPageGoods(img, res1.result)
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
uni.hideLoading()
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {
|
|
uni.hideLoading()
|
|
})
|
|
},
|
|
//getNewProductSnMore count/snPre
|
|
addPageGoods(path, sn) {
|
|
let obj = {
|
|
id: sn ? sn : generateUUID(),
|
|
purchasePrice: 0, //进货价
|
|
price: 0,
|
|
price1: 0,
|
|
categoryName: this.categoryList.categoryName,
|
|
categoryId: this.categoryList.categoryId,
|
|
productCount: 0,
|
|
productId: "",
|
|
productName: "",
|
|
wholesalePrice: 0,
|
|
customerCategoryList: this.getNewProductRule(),
|
|
lsprice: 0,
|
|
isNew: true,
|
|
productPictures: [],
|
|
productPicture: path ? path : '',
|
|
productSn: sn ? sn : "",
|
|
stockLogList: new Map(),
|
|
stockLogList1: []
|
|
}
|
|
let key = '{"颜色":"均色","尺码":"均码"}'
|
|
let value = {
|
|
name: '均色/均码',
|
|
productCount: 0
|
|
}
|
|
obj.stockLogList.set(key, value)
|
|
this.carList.set(obj.id, obj)
|
|
this.$forceUpdate()
|
|
uni.hideLoading()
|
|
},
|
|
getNewProductRule() {
|
|
let arr = []
|
|
if (this.customerCategoryList1 != null && this.customerCategoryList1 != '') {
|
|
for (let i = 0; i < this.customerCategoryList1.length; i++) {
|
|
let data = {
|
|
categoryId: this.customerCategoryList1[i].categoryId,
|
|
categoryName: this.customerCategoryList1[i].categoryName,
|
|
categoryPrice: this.customerCategoryList1[i].categoryPrice
|
|
}
|
|
arr.push(data)
|
|
}
|
|
} else {
|
|
arr = null
|
|
}
|
|
|
|
return arr
|
|
},
|
|
//库存商品详情
|
|
getKCList(list) {
|
|
let that = this
|
|
this.pecsList = list
|
|
this.$refs.shopPopup.open('bottom')
|
|
},
|
|
temporaryChange(val, item) {
|
|
if (item != '' && item != undefined) {
|
|
for (var m = 0; m < this.pageOldTemList.length; m++) {
|
|
if (item.attributeList == this.pageOldTemList[m].attributeList) {
|
|
this.pageOldTemList[m].productCount = Number(item.productCount)
|
|
break;
|
|
}
|
|
}
|
|
for (var j = 0; j < this.oldTemList.length; j++) {
|
|
if (item.attributeList == this.oldTemList[j].attributeList) {
|
|
this.oldTemList[j].productCount = Number(item.productCount)
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
this.zNum = 0
|
|
for (var i = 0; i < this.temporaryList.length; i++) {
|
|
this.zNum += Number(this.temporaryList[i].productCount) || 0
|
|
}
|
|
},
|
|
clickClose(e) {
|
|
this.evalue = []
|
|
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.allChangeNum = 0
|
|
},
|
|
//弹窗选择规格后,点击弹窗中选好了按钮
|
|
temporaryCheck() {
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
this.evalue = []
|
|
let that = this,
|
|
carList1 = []
|
|
let data = {
|
|
id: this.goodsDetail.productId ? this.goodsDetail.productId : this.goodsDetail.id,
|
|
price: 0,
|
|
num: this.zNum,
|
|
customerCategoryRule: this.goodsDetail.customerCategoryRule != null ? this.checkPriceRule(JSON
|
|
.parse(this.goodsDetail
|
|
.customerCategoryRule)) : null,
|
|
productId: this.goodsDetail.productId,
|
|
productName: this.goodsDetail.productName,
|
|
wholesalePrice: this.goodsDetail.wholesalePrice,
|
|
purchasePrice: this.goodsDetail.purchasePrice,
|
|
categoryName: this.goodsDetail.categoryName,
|
|
categoryId: this.goodsDetail.categoryId,
|
|
attrId: this.goodsDetail.attrId,
|
|
lsprice: this.goodsDetail.price,
|
|
productSn: this.goodsDetail.productSn,
|
|
productPicture: this.goodsDetail.productPicture,
|
|
supplierName: this.goodsDetail.supplierName,
|
|
productPictures: [],
|
|
saleDetailQueryDTO: this.temporaryList
|
|
}
|
|
carList1.push(data)
|
|
this.temporaryList = []
|
|
this.oldTemList = []
|
|
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
|
|
}
|
|
}
|
|
if (this.carList.size == 0) { //当前页没有数据
|
|
for (let i = 0; i < carList1.length; i++) {
|
|
let obj = {
|
|
purchasePrice: this.userType == 0 ? this.goodsDetail.purchasePrice : '', //进货价
|
|
price: this.goodsDetail.price,
|
|
price1: 0,
|
|
productCount: 0,
|
|
id: carList1[i].id,
|
|
productId: carList1[i].id,
|
|
customerCategoryList: carList1[i].customerCategoryRule != null ? this.checkPriceRule(
|
|
carList1[i]
|
|
.customerCategoryRule) : this.getNewProductRule(),
|
|
wholesalePrice: this.goodsDetail.wholesalePrice,
|
|
categoryName: this.goodsDetail.categoryName,
|
|
categoryId: carList1[i].categoryId,
|
|
attrId: carList1[i].attrId,
|
|
lsprice: this.goodsDetail.price,
|
|
productName: carList1[i].productName,
|
|
productPicture: carList1[i].productPicture,
|
|
productSn: carList1[i].productSn,
|
|
stockLogList: new Map(),
|
|
productPictures: [],
|
|
stockLogList1: []
|
|
}
|
|
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
|
|
|
|
var data1 = {
|
|
productCount: Number(carList1[i].saleDetailQueryDTO[m].productCount),
|
|
name: carList1[i].saleDetailQueryDTO[m].name,
|
|
productNum: carList1[i].saleDetailQueryDTO[m].productNum
|
|
}
|
|
if (carList1[i].saleDetailQueryDTO.length > 1) {
|
|
if (data1.productCount > 0) {
|
|
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
|
|
}
|
|
} else {
|
|
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
|
|
}
|
|
|
|
obj.productCount += Number(carList1[i].saleDetailQueryDTO[m].productCount)
|
|
obj.price1 = Number(obj.productCount) * this.goodsDetail.purchasePrice
|
|
}
|
|
this.carList.set(carList1[i].id, obj)
|
|
}
|
|
carList1 = []
|
|
|
|
} else { //当前页有数据
|
|
|
|
for (let i = 0; i < carList1.length; i++) {
|
|
if (this.carList.has(carList1[i].id) == true) {
|
|
this.carList.get(carList1[i].id).stockLogList = new Map()
|
|
}
|
|
|
|
if (this.carList.has(carList1[i].id) == true) { //商品相同
|
|
if (this.carList.get(carList1[i].id)) {
|
|
this.carList.get(carList1[i].id).productCount = 0
|
|
}
|
|
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
|
|
if (this.carList.get(carList1[i].id).stockLogList.has(carList1[i]
|
|
.saleDetailQueryDTO[
|
|
m].attributeList) == true) { //规格相同
|
|
|
|
var data1 = {
|
|
productCount: Number(carList1[i].saleDetailQueryDTO[m].productCount),
|
|
name: carList1[i].saleDetailQueryDTO[m].name,
|
|
productNum: carList1[i].saleDetailQueryDTO[m].productNum
|
|
}
|
|
if (carList1[i].saleDetailQueryDTO.length > 1) {
|
|
if (data1.productCount > 0) {
|
|
this.carList.get(carList1[i].id).stockLogList.set(carList1[i]
|
|
.saleDetailQueryDTO[m]
|
|
.attributeList, data1)
|
|
}
|
|
} else {
|
|
this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[m]
|
|
.attributeList, data1)
|
|
}
|
|
} else { //规格不同
|
|
var data1 = {
|
|
productCount: Number(carList1[i].saleDetailQueryDTO[m].productCount),
|
|
name: carList1[i].saleDetailQueryDTO[m].name,
|
|
productNum: carList1[i].saleDetailQueryDTO[m].productNum
|
|
}
|
|
if (carList1[i].saleDetailQueryDTO.length > 1) {
|
|
if (data1.productCount > 0) {
|
|
this.carList.get(carList1[i].id).stockLogList.set(carList1[i]
|
|
.saleDetailQueryDTO[m]
|
|
.attributeList, data1)
|
|
}
|
|
} else {
|
|
this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[m]
|
|
.attributeList, data1)
|
|
}
|
|
}
|
|
this.carList.get(carList1[i].id).productCount += Number(carList1[i].saleDetailQueryDTO[
|
|
m].productCount)
|
|
that.carList.get(carList1[i].id).price1 = Number(that.carList.get(carList1[i].id)
|
|
.productCount) *
|
|
that.carList.get(carList1[i].id).purchasePrice
|
|
}
|
|
} else { //商品不同
|
|
let obj = {
|
|
purchasePrice: this.userType == 0 ? this.goodsDetail.purchasePrice : '', //进货价
|
|
price: this.goodsDetail.price,
|
|
price1: 0,
|
|
productCount: 0,
|
|
productId: carList1[i].id,
|
|
categoryId: carList1[i].categoryId,
|
|
attrId: carList1[i].attrId,
|
|
customerCategoryList: carList1[i].customerCategoryRule != null ? this.checkPriceRule(
|
|
carList1[i]
|
|
.customerCategoryRule) : this.getNewProductRule(),
|
|
productName: carList1[i].productName,
|
|
wholesalePrice: this.goodsDetail.wholesalePrice,
|
|
lsprice: this.goodsDetail.price,
|
|
productPicture: carList1[i].productPicture,
|
|
stockLogList: new Map(),
|
|
productSn: carList1[i].productSn,
|
|
stockLogList1: [],
|
|
productPictures: [],
|
|
name: ''
|
|
}
|
|
|
|
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
|
|
var data1 = {
|
|
productCount: Number(carList1[i].saleDetailQueryDTO[m].productCount),
|
|
name: carList1[i].saleDetailQueryDTO[m].name,
|
|
productNum: carList1[i].saleDetailQueryDTO[m].productNum
|
|
}
|
|
if (carList1[i].saleDetailQueryDTO.length > 1) {
|
|
if (data1.productCount > 0) {
|
|
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
|
|
}
|
|
} else {
|
|
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
|
|
}
|
|
obj.productCount += Number(carList1[i].saleDetailQueryDTO[m].productCount)
|
|
obj.price1 = obj.productCount * this.goodsDetail.purchasePrice
|
|
}
|
|
this.carList.set(carList1[i].id, obj)
|
|
}
|
|
}
|
|
carList1 = []
|
|
}
|
|
this.getAllPrice()
|
|
this.$refs.shopPopup.close()
|
|
this.allChangeNum = 0
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 500)
|
|
},
|
|
changessPrice(e) {
|
|
if (this.linshiPrice == e.target.value) {
|
|
this.shouldPay = e.target.value
|
|
} else {
|
|
if (e.target.value == '') {
|
|
this.shouldPay = this.linshiPrice
|
|
} else {
|
|
this.shouldPay = e.target.value
|
|
}
|
|
|
|
}
|
|
this.alreadyPay = this.shouldPay
|
|
this.noPay = this.shouldPay - this.alreadyPay;
|
|
},
|
|
//滨海商贸要求已收金额不计算
|
|
checkRealPay(realPay) {
|
|
let shopId = uni.getStorageSync('shopId')
|
|
if (shopId == '1838094297858183168' || shopId == '1818888277105709056' || shopId ==
|
|
'1810179818189361152') {
|
|
if (this.isChangePriceOk == false) {
|
|
return 0
|
|
} else {
|
|
return this.alreadyPay
|
|
}
|
|
} else {
|
|
if (this.isChangePriceOk == false) {
|
|
return realPay
|
|
} else {
|
|
return this.alreadyPay
|
|
}
|
|
}
|
|
},
|
|
sninput(e, id) {
|
|
this.carList.get(id).productSn = e.detail.value
|
|
this.$forceUpdate()
|
|
},
|
|
removePunctuationAndSpaces(str) {
|
|
const regex = /[\u3002\uff0c\uff1a\uFF0E\u3001\s,:;]/g;
|
|
return str.replace(regex, '');
|
|
},
|
|
//货号是否重复
|
|
getSnIsRepeat(e, id) {
|
|
let that = this;
|
|
let isTrue = false
|
|
if (e.detail.value != '') {
|
|
this.tui.request('/app/product/getByProductSn', "post", {
|
|
productSn: e.detail.value
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
if (res1.result != '') {
|
|
isTrue = true
|
|
that.tui.toast('当前货号已被商品:“' + res1.result[0].productName + '”占用,请重新输入')
|
|
that.carList.get(id).productSn = ''
|
|
that.carList.get(id).id = ''
|
|
setTimeout(res => {
|
|
that.$forceUpdate()
|
|
}, 2000)
|
|
throw Error('11')
|
|
} else {
|
|
this.carList.forEach(function(value, key) {
|
|
if (value.id != id) {
|
|
if (value.productSn == e.detail.value) {
|
|
isTrue = true
|
|
uni.showToast({
|
|
title: "该货号被页面其他商品占用,请重新输入!",
|
|
icon: 'none'
|
|
})
|
|
that.carList.get(id).productSn = ''
|
|
that.carList.get(id).id = ''
|
|
that.$forceUpdate()
|
|
throw Error('11')
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
}
|
|
})
|
|
|
|
this.$nextTick(() => {
|
|
if (isTrue == false) {
|
|
if (that.carList.get(id).productId) {
|
|
this.carList.get(id).id = that.carList.get(id).productId
|
|
this.carList.get(id).isNew = false
|
|
id = that.carList.get(id).productId
|
|
} else if (that.carList.get(id).productSn == '' || that.carList.get(id).productSn ==
|
|
null) {
|
|
|
|
this.carList.get(id).id = that.carList.get(id).productName
|
|
id = that.carList.get(id).productName
|
|
} else if (that.carList.get(id).productSn == '货号') {
|
|
this.carList.get(id).productSn = that.carList.get(id).productName
|
|
this.carList.get(id).id = that.carList.get(id).productName
|
|
id = that.carList.get(id).productName
|
|
} else if (that.carList.get(id).productSn) {
|
|
|
|
this.carList.get(id).id = that.carList.get(id).productSn
|
|
id = that.carList.get(id).productSn
|
|
}
|
|
this.$forceUpdate()
|
|
}
|
|
})
|
|
let specMap = new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
// if(isTrue == false){
|
|
this.carList.forEach(function(value, key) {
|
|
if (key != value.id) {
|
|
if (value.id == '') {
|
|
specMap.set(generateUUID(), value)
|
|
} else {
|
|
specMap.set(value.id, value)
|
|
}
|
|
|
|
} else {
|
|
specMap.set(key, value)
|
|
}
|
|
})
|
|
this.carList = specMap
|
|
// }
|
|
})
|
|
}
|
|
},
|
|
getName(e, id) {
|
|
this.carList.get(id).productName = e.detail.value
|
|
},
|
|
noReturn() {
|
|
this.yuedikou = 0
|
|
this.alreadyPay = this.shouldPay
|
|
this.noPay = this.shouldPay - (this.alreadyPay == '' ? 0 : this.alreadyPay)
|
|
this.noPay = this.noPay.toFixed(2)
|
|
this.leijiqiankuan = (Number(this.zhiqianqiankuan) + Number(this.yuedikou) + Number(this.noPay)).toFixed(2)
|
|
},
|
|
//计算欠款
|
|
changePay(e) {
|
|
this.isChangePriceOk = true
|
|
if (this.linshiPrice == e.target.value) {
|
|
this.alreadyPay = e.target.value
|
|
} else if (Number(e.detail.value) > Number(this.shouldPay)) {
|
|
this.alreadyPay = this.shouldPay
|
|
setTimeout(res => {
|
|
this.tui.toast("已付金额不能大于应付金额")
|
|
}, 100)
|
|
} else {
|
|
if (e.target.value == '') {
|
|
this.alreadyPay = this.linshiPrice
|
|
} else {
|
|
this.alreadyPay = e.target.value
|
|
if ((this.shouldPay - this.alreadyPay) <= Math.abs(this.zhiqianqiankuan) && this.zhiqianqiankuan <
|
|
0) {
|
|
this.yuedikou = this.shouldPay - this.alreadyPay
|
|
} else if ((this.shouldPay - this.alreadyPay) > Math.abs(this.zhiqianqiankuan) && this
|
|
.zhiqianqiankuan < 0) {
|
|
this.yuedikou = Math.abs(this.zhiqianqiankuan)
|
|
}
|
|
|
|
}
|
|
}
|
|
this.noPay = this.shouldPay - this.alreadyPay - this.yuedikou
|
|
this.noPay = this.noPay.toFixed(2)
|
|
this.leijiqiankuan = (Number(this.zhiqianqiankuan) + Number(this.yuedikou) + Number(this.noPay)).toFixed(2)
|
|
},
|
|
//跳转选择供应商
|
|
goPopleList(popleType) {
|
|
uni.setStorageSync('kaidanBack', true)
|
|
uni.navigateTo({
|
|
url: '/package1/index/peopleList?popleType=' + popleType
|
|
})
|
|
},
|
|
//删除整条商品
|
|
delShop(id) {
|
|
var that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定删除此条商品吗?",
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
if (that.carList.has(id) == true) {
|
|
that.carList.delete(id)
|
|
}
|
|
that.getAllPrice()
|
|
that.$forceUpdate()
|
|
}
|
|
}
|
|
})
|
|
|
|
},
|
|
//选商品的时候能删除规格
|
|
delCarData(index) {
|
|
this.temporaryList.splice(index, 1);
|
|
this.temporaryChange()
|
|
},
|
|
//删除商品下的某一个规格
|
|
delShopSpec(id, name) {
|
|
var that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定删除此条规格吗?",
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
if (that.carList.get(id).stockLogList.size == 1) {
|
|
that.carList.get(id).productCount = Number(that.carList.get(id).stockLogList
|
|
.get(name)
|
|
.productCount);
|
|
} else {
|
|
that.carList.get(id).productCount -= Number(that.carList.get(id).stockLogList
|
|
.get(
|
|
name).productCount);
|
|
}
|
|
|
|
let count = Number(that.carList.get(id).stockLogList.get(name).productCount)
|
|
that.carList.get(id).stockLogList.delete(name)
|
|
|
|
that.carList.get(id).price1 = Number(that.carList.get(id).productCount) * that
|
|
.carList.get(
|
|
id).purchasePrice
|
|
if (that.carList.get(id).stockLogList.size == 0) {
|
|
let key = '{"颜色":"均色","尺码":"均码"}'
|
|
let value = {
|
|
name: '均色/均码/',
|
|
productCount: count
|
|
}
|
|
that.carList.get(id).stockLogList.set(key, value)
|
|
}
|
|
|
|
that.getAllPrice()
|
|
}
|
|
that.$forceUpdate()
|
|
}
|
|
})
|
|
|
|
},
|
|
gysList() {
|
|
let that = this;
|
|
this.tui.request("/app/supplier/getByCondition", "post", {
|
|
searchStr: '默认供应商',
|
|
pageNumber: 1,
|
|
pageSize: 10
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.result.content.length == 0) {
|
|
that.tui.request("/app/supplier/save", "post", {
|
|
consigneeMobile: '',
|
|
consigneeName: '默认供应商',
|
|
address1: '',
|
|
address: '',
|
|
province: '',
|
|
city: '',
|
|
area: ''
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
that.gysList()
|
|
}
|
|
})
|
|
} else {
|
|
that.khName = res.result.content[0]
|
|
that.goRuku()
|
|
}
|
|
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
})
|
|
},
|
|
filterEmojis(text) {
|
|
// 匹配表情符号的正则表达式(包括Unicode范围内的表情)
|
|
const emojiRegex =
|
|
/[\uD800-\uDBFF][\uDC00-\uDFFF]|[\u2600-\u27FF]|[\uD83C][\uDF00-\uDFFF]|[\uD83D][\uDC00-\uDE4F]/g;
|
|
|
|
// 检查是否包含表情符号
|
|
var hasEmoji = emojiRegex.test(text);
|
|
return hasEmoji;
|
|
},
|
|
async goRuku() {
|
|
let that = this;
|
|
let purchase = {
|
|
id: uni.getStorageSync('AiInventoryId') ? uni.getStorageSync('AiInventoryId') : "",
|
|
alreadyPay: this.alreadyPay == '' ? 0 : this.alreadyPay, //已付金额
|
|
noPay: this.noPay == '' ? 0 : this.noPay, //欠款
|
|
shouldPay: this.shouldPay, //应付金额
|
|
totalAmount: this.totalAmount, //总数量
|
|
remark: this.remark,
|
|
purchaseTime: this.single,
|
|
otherPay: this.otherPay == '' ? 0 : this.otherPay,
|
|
supplierId: this.khName.id, //供应商id和姓名
|
|
supplierName: this.khName.consigneeName
|
|
}
|
|
let purchaseDetails = [];
|
|
let arr = []
|
|
await this.carList.forEach(function(value, key) {
|
|
arr += 1
|
|
value.customerCategoryRule = JSON.stringify(value.customerCategoryList)
|
|
let shopId = uni.getStorageSync('shopId')
|
|
// 提钱和沐港,员工入库采购价为零
|
|
if (that.userType == 1 && (shopId == '1853332569559535619' || shopId ==
|
|
'1810179818189361152')) {
|
|
value.purchasePrice = 0
|
|
} else if (that.userType == 1) {
|
|
value.purchasePrice = ''
|
|
}
|
|
if (that.filterEmojis(value.productName)) {
|
|
uni.showToast({
|
|
title: "第" + arr.length + "款商品品名中的有非法符号,请删除",
|
|
icon: 'none'
|
|
})
|
|
throw Error("11")
|
|
}
|
|
if (value.productSn == '') {
|
|
uni.showToast({
|
|
title: "第" + arr.length + "款商品货号必须维护",
|
|
icon: 'none'
|
|
})
|
|
throw Error("11")
|
|
} else {
|
|
value.price = value.lsprice
|
|
value.stockLogList1 = []
|
|
if (value.stockLogList.size == 0) {
|
|
let obj = {
|
|
productCount: 1,
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}'
|
|
}
|
|
value.productCount = 1
|
|
value.price1 = Number(value.productCount) * value.purchasePrice
|
|
value.stockLogList1.push(obj)
|
|
} else {
|
|
value.stockLogList.forEach(function(values, keys) {
|
|
if (values.productCount <= 0) {
|
|
that.tui.toast(value.productSn + "的入库数量不能为零~")
|
|
throw Error('error')
|
|
}
|
|
let obj = {
|
|
productCount: Number(values.productCount),
|
|
attributeList: keys
|
|
}
|
|
value.stockLogList1.push(obj)
|
|
})
|
|
}
|
|
purchaseDetails.push(value)
|
|
}
|
|
|
|
})
|
|
await this.goInventory(purchase, purchaseDetails)
|
|
},
|
|
inventorySubmit() {
|
|
let that = this
|
|
if (this.carList.size == 0) {
|
|
uni.showToast({
|
|
title: "请选择商品后再入库",
|
|
icon: 'none'
|
|
})
|
|
} else if (this.khName == '') {
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "您没有选择供应商,要使用“默认供应商”入库吗?",
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
that.gysList()
|
|
}
|
|
}
|
|
})
|
|
|
|
} else {
|
|
this.goRuku()
|
|
}
|
|
|
|
},
|
|
goInventory(purchase, purchaseDetails) {
|
|
uni.navigateTo({
|
|
url: '/package1/inventory/inventoryConfirm?aiinventory=1&purchase=' + JSON.stringify(
|
|
purchase) + '&purchaseDetails=' + JSON.stringify(purchaseDetails) +
|
|
'&zhiqianqiankuan=' + this.zhiqianqiankuan + '&yuedikou=' + this.yuedikou +
|
|
'&leijiqiankuan=' + this.leijiqiankuan
|
|
})
|
|
},
|
|
//编辑每一个的单价
|
|
clickCollapse(e, id) {
|
|
if (this.linshiPrice == e.target.value) {
|
|
this.carList.get(id).purchasePrice = e.target.value
|
|
} else {
|
|
if (e.detail.value == '') {
|
|
this.carList.get(id).purchasePrice = this.linshiPrice
|
|
} else {
|
|
this.carList.get(id).purchasePrice = Number(e.detail.value)
|
|
}
|
|
}
|
|
this.carList.get(id).price1 = Number(this.carList.get(id).productCount) * this.carList.get(id)
|
|
.purchasePrice
|
|
this.getAllPrice()
|
|
},
|
|
//编辑每一个的批和零售
|
|
PriceAndWho(e, id, type) {
|
|
if (type == 'pi') {
|
|
if (this.linshiPrice == e.target.value) {
|
|
this.carList.get(id).wholesalePrice = e.target.value
|
|
} else {
|
|
if (e.detail.value == '') {
|
|
this.carList.get(id).wholesalePrice = this.linshiPrice
|
|
} else {
|
|
this.carList.get(id).wholesalePrice = Number(e.detail.value)
|
|
}
|
|
}
|
|
} else {
|
|
if (this.linshiPrice == e.target.value) {
|
|
this.carList.get(id).price = e.target.value
|
|
this.carList.get(id).lsprice = e.target.value
|
|
} else {
|
|
if (e.detail.value == '') {
|
|
this.carList.get(id).price = this.linshiPrice
|
|
this.carList.get(id).lsprice = this.linshiPrice
|
|
} else {
|
|
this.carList.get(id).price = Number(e.detail.value)
|
|
this.carList.get(id).lsprice = Number(e.detail.value)
|
|
}
|
|
}
|
|
}
|
|
this.$forceUpdate()
|
|
},
|
|
//计算总金额和总数量
|
|
getAllPrice() {
|
|
let that = this;
|
|
this.shouldPay = 0
|
|
this.totalAmount = 0
|
|
that.leijiqiankuan = 0
|
|
that.yuedikou = 0
|
|
this.carList.forEach(function(value, key) {
|
|
that.shouldPay = that.shouldPay + value.price1
|
|
that.totalAmount = that.totalAmount + Number(value.productCount)
|
|
})
|
|
this.$nextTick(() => {
|
|
if (parseFloat(that.zhiqianqiankuan) < 0) {
|
|
if (that.shouldPay > Math.abs(that.zhiqianqiankuan)) {
|
|
that.yuedikou = Math.abs(that.zhiqianqiankuan)
|
|
this.alreadyPay = this.checkRealPay(this.shouldPay - Math.abs(that.zhiqianqiankuan))
|
|
} else if (that.shouldPay <= Math.abs(that.zhiqianqiankuan)) {
|
|
that.yuedikou = that.shouldPay
|
|
that.alreadyPay = 0
|
|
}
|
|
} else {
|
|
this.alreadyPay = this.checkRealPay(this.shouldPay)
|
|
}
|
|
that.shouldPay = that.shouldPay.toFixed(2)
|
|
|
|
that.noPay = this.shouldPay - (this.alreadyPay == '' ? 0 : this.alreadyPay) - that.yuedikou
|
|
that.noPay = that.noPay.toFixed(2)
|
|
this.leijiqiankuan = (Number(this.zhiqianqiankuan) + Number(this.yuedikou) + Number(this
|
|
.noPay)).toFixed(2)
|
|
this.$forceUpdate()
|
|
})
|
|
|
|
},
|
|
//选择是否需要自动生成货号
|
|
isChange(index) {
|
|
this.isGenerateSnRadio = index
|
|
},
|
|
//修改已选规格的数量
|
|
GoodsNumChange(e, index, index1) {
|
|
let that = this;
|
|
this.carList.get(index[0]).stockLogList.get(index1).productCount = Number(e)
|
|
this.carList.get(index[0]).productCount = 0
|
|
this.carList.get(index[0]).stockLogList.forEach(function(value, key) {
|
|
that.carList.get(index[0]).productCount = Number(that.carList.get(index[0]).productCount) +
|
|
Number(value
|
|
.productCount)
|
|
that.carList.get(index[0]).price1 = Number(that.carList.get(index[0]).productCount) * that
|
|
.carList.get(
|
|
index[0]).purchasePrice
|
|
})
|
|
that.getAllPrice()
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page,
|
|
.page1 {
|
|
min-height: 100vh;
|
|
font-size: 28rpx;
|
|
}
|
|
|
|
.u-upload {
|
|
position: absolute;
|
|
top: 30rpx;
|
|
left: 30rpx;
|
|
opacity: 0;
|
|
width: 140rpx;
|
|
height: 140rpx;
|
|
}
|
|
|
|
.content {
|
|
border-top: 1px solid #eee;
|
|
overflow-y: scroll;
|
|
max-height: 100vh;
|
|
margin-bottom: 100rpx;
|
|
}
|
|
|
|
.content-box {
|
|
width: 100%;
|
|
height: auto;
|
|
background: #fff;
|
|
margin-bottom: 20rpx;
|
|
|
|
}
|
|
|
|
.content-list {
|
|
width: 95%;
|
|
margin: 0 auto;
|
|
display: flex;
|
|
height: 80rpx;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
.content-list:last-child {
|
|
border-bottom: none;
|
|
height: auto;
|
|
}
|
|
|
|
.list-name {
|
|
width: 200rpx;
|
|
text-align: left;
|
|
line-height: 80rpx;
|
|
height: 80rpx;
|
|
padding-left: 20rpx;
|
|
}
|
|
|
|
.list-val {
|
|
width: 560rpx;
|
|
height: 80rpx;
|
|
line-height: 80rpx;
|
|
}
|
|
|
|
.list-val input {
|
|
width: 400rpx;
|
|
height: 60rpx;
|
|
display: inline-block;
|
|
line-height: 60rpx;
|
|
float: left;
|
|
margin-top: 10rpx;
|
|
padding-left: 20rpx;
|
|
border-bottom: 1px solid #088FEB;
|
|
}
|
|
|
|
.uni-data-select {
|
|
width: 80%;
|
|
text-align: center;
|
|
}
|
|
|
|
.uni-select {
|
|
border: none !important;
|
|
border-radius: 0 !important;
|
|
}
|
|
|
|
.uni-select__input-placeholder {
|
|
color: #6a6a6a;
|
|
font-size: 28rpx !important;
|
|
width: 400rpx;
|
|
}
|
|
|
|
.uni-select__input-box {
|
|
.uni-icons {
|
|
margin-left: 100rpx;
|
|
}
|
|
}
|
|
|
|
.shop-box {
|
|
width: 95%;
|
|
margin: 0 auto;
|
|
position: relative;
|
|
}
|
|
|
|
.shop-name {
|
|
width: 100%;
|
|
height: 277rpx;
|
|
line-height: 80rpx;
|
|
border-top: 1px solid #eee;
|
|
font-size: 28rpx;
|
|
font-weight: bold;
|
|
display: flex;
|
|
}
|
|
|
|
.shop-productName {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding-left: 20rpx;
|
|
height: 280rpx;
|
|
margin-top: 20rpx;
|
|
}
|
|
|
|
.shop-productName view {
|
|
height: 55rpx;
|
|
}
|
|
|
|
.shop-collapse {
|
|
display: flex;
|
|
height: 80rpx;
|
|
font-size: 26rpx;
|
|
line-height: 80rpx;
|
|
border-top: 1px solid #eee;
|
|
}
|
|
|
|
.shop-collapse text {
|
|
width: 50%;
|
|
text-align: center;
|
|
// padding-right: 40rpx;
|
|
border-right: 1px solid #eee;
|
|
}
|
|
|
|
.price-box-title {
|
|
width: 95%;
|
|
height: 80rpx;
|
|
line-height: 80rpx;
|
|
margin: 0 auto;
|
|
display: flex;
|
|
text-align: center;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
.price-box-title text {
|
|
flex: 1;
|
|
}
|
|
|
|
.price-box {
|
|
width: 95%;
|
|
margin: 20rpx auto;
|
|
background: #eee;
|
|
height: 80rpx;
|
|
display: flex;
|
|
line-height: 80rpx;
|
|
text-align: center;
|
|
overflow: hidden;
|
|
border-radius: 10px;
|
|
background: #FDF5E6;
|
|
color: #EEB422;
|
|
background: linear-gradient(180deg, #fff, #FDF5E6);
|
|
border: 1px solid #FAEBD7;
|
|
}
|
|
|
|
.uni-list-cell {
|
|
display: flex;
|
|
margin-right: 20rpx;
|
|
}
|
|
|
|
.bottom-box {
|
|
width: 100%;
|
|
display: flex;
|
|
background: #fff;
|
|
border-top: 1px solid #eee;
|
|
// height: 10%;
|
|
position: fixed;
|
|
bottom: 0;
|
|
z-index: 99;
|
|
}
|
|
|
|
.bottom-left {
|
|
flex: 1;
|
|
height: 110rpx;
|
|
line-height: 110rpx;
|
|
}
|
|
|
|
.bottom-right {
|
|
flex: 1;
|
|
height: 110rpx;
|
|
}
|
|
|
|
.bottom-left text {
|
|
line-height: 84rpx;
|
|
display: inline-block;
|
|
padding-left: 20rpx;
|
|
}
|
|
|
|
.bottom-btn {
|
|
width: 320rpx;
|
|
background: linear-gradient(90deg, #60F3FF, #088FEB);
|
|
color: #fff;
|
|
border-radius: 50rpx;
|
|
height: 85rpx;
|
|
margin-top: 15rpx;
|
|
text-align: center;
|
|
line-height: 85rpx;
|
|
}
|
|
|
|
textarea {
|
|
margin: 20rpx;
|
|
border: 1px solid #eee;
|
|
height: 150rpx;
|
|
width: 500rpx;
|
|
}
|
|
|
|
.shop-popup-content {
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 30rpx;
|
|
height: 1200rpx;
|
|
background-color: #fff;
|
|
margin-bottom: 30rpx;
|
|
overflow: scroll;
|
|
}
|
|
|
|
.popup-content {
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 30rpx;
|
|
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-left img {
|
|
width: 150rpx;
|
|
height: 150rpx;
|
|
|
|
}
|
|
|
|
.shop-popup-title-right {
|
|
width: 400rpx;
|
|
margin-left: 30rpx;
|
|
}
|
|
|
|
.shop-popup-title-right-box {
|
|
height: 50rpx;
|
|
line-height: 50rpx;
|
|
}
|
|
|
|
.shop-popup-container {
|
|
width: 100%;
|
|
background: #fff;
|
|
height: 50rpx;
|
|
}
|
|
|
|
.shop-title-fur {
|
|
width: 95%;
|
|
height: 50rpx;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.shop-title-name {
|
|
font-size: 30rpx;
|
|
width: 50%;
|
|
float: left;
|
|
height: 50rpx;
|
|
line-height: 70rpx;
|
|
}
|
|
|
|
.shop-attrs {
|
|
text {
|
|
display: inline-block;
|
|
border: 1px solid #5fd9ee;
|
|
margin: 20rpx;
|
|
margin-bottom: 0;
|
|
margin-left: 0;
|
|
background-color: #fff;
|
|
color: #5fd9ee;
|
|
padding: 0 20rpx;
|
|
min-width: 100rpx;
|
|
line-height: 70rpx;
|
|
height: 70rpx;
|
|
text-align: center;
|
|
border-radius: 20rpx;
|
|
}
|
|
|
|
.checkedText {
|
|
background-color: #5fd9ee;
|
|
color: #fff;
|
|
border-radius: 20rpx;
|
|
}
|
|
}
|
|
|
|
.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: 70rpx;
|
|
height: 70rpx;
|
|
text-align: center;
|
|
color: #fff;
|
|
font-size: 28rpx;
|
|
margin: 0 auto;
|
|
background: linear-gradient(90deg, #60F3FF, #088FEB);
|
|
border-radius: 70rpx;
|
|
}
|
|
}
|
|
|
|
.noPic {
|
|
border-radius: 10px;
|
|
width: 150rpx;
|
|
height: 150rpx;
|
|
// margin: 30rpx 0 0 30rpx;
|
|
text-align: center;
|
|
line-height: 140rpx;
|
|
color: #777;
|
|
background: #eee;
|
|
}
|
|
|
|
.new-logo {
|
|
position: absolute;
|
|
top: 35rpx;
|
|
left: 131rpx;
|
|
background: red;
|
|
color: #fff;
|
|
width: 40rpx;
|
|
height: 40rpx;
|
|
line-height: 40rpx;
|
|
text-align: center;
|
|
border-top-right-radius: 10px;
|
|
}
|
|
|
|
.goods-btn {
|
|
color: #fff;
|
|
border-radius: 5px;
|
|
background: linear-gradient(90deg, #60F3FF, #088FEB);
|
|
height: 60rpx;
|
|
width: 150rpx;
|
|
padding: 10rpx;
|
|
margin: 0 auto;
|
|
text-align: center;
|
|
}
|
|
|
|
.shop-btn {
|
|
display: flex;
|
|
}
|
|
|
|
.shop-title {
|
|
display: flex;
|
|
height: 80rpx;
|
|
line-height: 80rpx;
|
|
padding-left: 70rpx;
|
|
text-align: center;
|
|
}
|
|
|
|
.shop-type {
|
|
margin-top: 40rpx;
|
|
border-top: 1px solid #eee;
|
|
}
|
|
|
|
.left-btn {
|
|
font-weight: 800;
|
|
font-size: 22rpx;
|
|
color: #fff;
|
|
background: #088FEB;
|
|
border-radius: 5px;
|
|
width: 60rpx;
|
|
height: 40rpx;
|
|
line-height: 40rpx;
|
|
text-align: center;
|
|
}
|
|
|
|
.type-popup {
|
|
width: 500rpx;
|
|
height: auto;
|
|
background: #fff;
|
|
border-radius: 10px;
|
|
position: relative;
|
|
margin-bottom: 40rpx;
|
|
}
|
|
|
|
.card-list {
|
|
width: 95%;
|
|
border-radius: 10rpx;
|
|
background: #fff;
|
|
height: auto;
|
|
margin: 40rpx auto 0;
|
|
|
|
}
|
|
|
|
.title-fur {
|
|
width: 95%;
|
|
height: 50rpx;
|
|
margin: 0 auto;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
.name {
|
|
font-size: 30rpx;
|
|
width: 50%;
|
|
float: left;
|
|
height: 50rpx;
|
|
line-height: 70rpx;
|
|
}
|
|
|
|
.rightBox {
|
|
display: flex;
|
|
float: right;
|
|
}
|
|
|
|
.content-fur {
|
|
padding-bottom: 25rpx;
|
|
}
|
|
|
|
.uni-calendar__content {
|
|
z-index: 103 !important;
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
.scroll-content {
|
|
height: 60%;
|
|
}
|
|
|
|
.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 16rpx;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.zuni-numbox__value {
|
|
margin: 0 4rpx;
|
|
width: 80rpx;
|
|
text-align: center;
|
|
font-size: 40rpx;
|
|
line-height: 60rpx;
|
|
height: 60rpx;
|
|
border-left-width: 0;
|
|
border-right-width: 0;
|
|
}
|
|
|
|
|
|
.zuni-numbox--text {
|
|
line-height: 40rpx;
|
|
|
|
font-size: 64rpx;
|
|
font-weight: 300;
|
|
}
|
|
|
|
.zuni-numbox .zuni-numbox--disabled {
|
|
color: #c0c0c0 !important;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.voice-popup-content {
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 30rpx;
|
|
width: 500rpx;
|
|
border-radius: 10px;
|
|
height: 600rpx;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.voice-popup-content1 {
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 30rpx;
|
|
width: 100%;
|
|
border-radius: 10px;
|
|
height: 1200rpx;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.voice-popup-title {
|
|
font-size: 36rpx;
|
|
font-weight: bold;
|
|
text-align: center;
|
|
position: relative;
|
|
}
|
|
|
|
.voice-popup-container {
|
|
margin-top: 20rpx;
|
|
}
|
|
|
|
.voice-popup-bottom {
|
|
display: flex;
|
|
height: 80rpx;
|
|
color: #fff;
|
|
line-height: 80rpx;
|
|
margin-top: 50rpx;
|
|
}
|
|
|
|
.voice-popup-btn {
|
|
flex: 1;
|
|
text-align: center;
|
|
background: linear-gradient(90deg, #FF9797, #FFC1E0);
|
|
}
|
|
|
|
.voice-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;
|
|
top: 50%;
|
|
left: 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: -250rpx;
|
|
left: 30%;
|
|
width: 180rpx;
|
|
height: 180rpx;
|
|
background: #eee;
|
|
border-radius: 50%;
|
|
}
|
|
|
|
.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: 10rpx;
|
|
border-radius: 5px;
|
|
z-index: 99;
|
|
}
|
|
|
|
.one-goods {
|
|
margin-top: 20rpx;
|
|
width: 100%;
|
|
height: 50rpx;
|
|
background: #088FEB;
|
|
font-size: 28rpx;
|
|
text-align: center;
|
|
line-height: 50rpx;
|
|
color: #fff;
|
|
border-radius: 5px;
|
|
position: relative;
|
|
}
|
|
|
|
.jiaobiao {
|
|
width: 40rpx;
|
|
height: 40rpx;
|
|
border-radius: 10px;
|
|
color: #fff;
|
|
background: red;
|
|
position: absolute;
|
|
top: -10rpx;
|
|
right: -10rpx;
|
|
text-align: center;
|
|
line-height: 40rpx;
|
|
font-size: 28rpx;
|
|
}
|
|
|
|
.showImg-box {
|
|
width: 700rpx;
|
|
height: 1100rpx;
|
|
}
|
|
|
|
@media screen and (min-width: 500px) {
|
|
.uni-swiper-dot-box {
|
|
width: 800rpx;
|
|
margin: 0 auto;
|
|
margin-top: 16rpx;
|
|
}
|
|
|
|
.image {
|
|
width: 100%;
|
|
}
|
|
}
|
|
|
|
.swiper-box {
|
|
height: 1000rpx;
|
|
}
|
|
|
|
.swiper-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 1000rpx;
|
|
color: #fff;
|
|
background-color: #cee1fd;
|
|
}
|
|
|
|
.lb-btn {
|
|
width: 100%;
|
|
height: 100rpx;
|
|
text-align: center;
|
|
line-height: 100rpx;
|
|
background: #088FEB;
|
|
color: #fff;
|
|
border-bottom-left-radius: 10px;
|
|
border-bottom-right-radius: 10px;
|
|
}
|
|
|
|
.uni-calendar__mask {
|
|
z-index: 103 !important;
|
|
}
|
|
|
|
@media screen and (min-width: 470px) {
|
|
|
|
/* 适配宽度为375px及以上的屏幕 */
|
|
.shop-popup-content {
|
|
height: 900rpx;
|
|
}
|
|
|
|
.voice-popup-content {
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 30rpx;
|
|
width: 400rpx;
|
|
border-radius: 10px;
|
|
height: 500rpx;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.voice-popup-container textarea {
|
|
height: 200rpx !important;
|
|
}
|
|
|
|
.voice-btn {
|
|
position: absolute;
|
|
bottom: -190rpx;
|
|
left: 30%;
|
|
width: 130rpx;
|
|
height: 130rpx;
|
|
background: #eee;
|
|
border-radius: 50%;
|
|
}
|
|
}
|
|
|
|
@media screen and (min-width: 760px) {
|
|
.shop-popup-content {
|
|
height: 750rpx !important;
|
|
}
|
|
|
|
.vue-ref {
|
|
padding-bottom: 0 !important;
|
|
}
|
|
|
|
.voice-popup-content1 {
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 30rpx;
|
|
width: 100%;
|
|
border-radius: 10px;
|
|
height: 750rpx;
|
|
background-color: #fff;
|
|
overflow: scroll;
|
|
}
|
|
|
|
.uni-date-single--x {
|
|
top: -600px !important;
|
|
left: -100px !important;
|
|
}
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
.voice-price-box {
|
|
display: flex;
|
|
flex-direction: column;
|
|
margin-right: 20rpx;
|
|
}
|
|
|
|
.voice-price-box text:first-child {
|
|
color: #ffa200
|
|
}
|
|
</style>
|