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.
13810 lines
493 KiB
13810 lines
493 KiB
<!-- 销售商品 -->
|
|
<template>
|
|
<view class="page1">
|
|
<view>
|
|
<view style="width:100%;background:#fff;position: fixed;top: 0;z-index: 101;">
|
|
|
|
<view style="display: inline-block;">
|
|
<radio @tap="voiceGetOne" :checked="voiceGetOneData" />
|
|
<text>根据货号模糊搜索</text>
|
|
</view>
|
|
<view @tap="scanCodeAdd" style="display: inline-block;margin-left: 20px;">
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/b3d67b975feb44edb12f0fd0a6e1afdf.png"
|
|
alt="" style="width: 30px;height: 30px !important;float: left;" @tap="checksaoma()" />
|
|
<text>扫一扫</text>
|
|
</view>
|
|
<view class="bottom-btn" @tap="hangOrderFn">挂单</view>
|
|
<view class="bottom-btn" @tap="clearAll">清空</view>
|
|
|
|
<view @tap="changeMore1" class="bottom-btn">
|
|
<text>更多</text>
|
|
</view>
|
|
<view @tap="isSnList('')" class="bottom-btn">
|
|
<text>新增商品</text>
|
|
</view>
|
|
<view @tap="toggle('center',item)" class="bottom-btn">
|
|
AI开单
|
|
</view>
|
|
|
|
<view @tap="goodsAdd" class="bottom-btn">
|
|
<text>选库存</text>
|
|
</view>
|
|
<view class="bottom-btn" @tap="showPrice1">确认开单</view>
|
|
</view>
|
|
<view style="width:100%;position: fixed;top: 60px;z-index: 102;background:#fff;display: flex;height: 50px;">
|
|
<view class="content-list" @tap="goPopleList('khName')">
|
|
<view class="list-val" style="display: flex;width:auto;">
|
|
<input type="text" placeholder="请选择客户" disabled
|
|
:value="((shopId=='1863043415453863936'|| shopId=='1810179818189361152') && khName.name == '散客')?'客户':khName.name"
|
|
style="border-bottom: 1px solid #fff;text-align: center;max-width: 125px;overflow: hidden;">
|
|
<text v-if="zhiqianqiankuan >= 0">
|
|
(欠:{{zhiqianqiankuan}})
|
|
</text>
|
|
<text v-if="zhiqianqiankuan < 0">
|
|
(余:{{Math.abs(zhiqianqiankuan)}})
|
|
</text>
|
|
</view>
|
|
</view>
|
|
<view class="content-list">
|
|
<view style="height: 40px;width: 160px;display: inline-block;">
|
|
<uni-data-select class="uni-data-select" :localdata="payTypeList" v-model="payType"
|
|
placeholder="支付类型">
|
|
</uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view class="content-list">
|
|
<view style="height: 40px;width: 140px;display: inline-block;">
|
|
<uni-data-select class="uni-data-select" :localdata="categoryList" v-model="xsyId"
|
|
placeholder="销售员"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view class="content-list">
|
|
<view class="list-name" @tap="getCountMethod">
|
|
<view style="float: left;">
|
|
应
|
|
</view>
|
|
<uni-icons type="help" size="15"></uni-icons>
|
|
</view>
|
|
<view class="list-val">
|
|
<input type="digit" ref="relPriceinput" placeholder="应收" v-model="relPrice"
|
|
@tap="obtainPrice($event,'relPrice')" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="content-list">
|
|
<view class="list-name">实</view>
|
|
<view class="list-val">
|
|
<input type="digit" placeholder="实收" v-model="priceOk" @tap="obtainPrice($event,'priceOk')"
|
|
disabled>
|
|
</view>
|
|
<!-- <view v-if="priceOk < 0" @tap="noReturn"
|
|
style="flex: 1;height: 30px;line-height: 30px;font-size: 21px;background: #00BFFF;text-align: center;color: #fff;border-radius: 10px;">
|
|
不退款
|
|
</view> -->
|
|
</view>
|
|
</view>
|
|
<view style="position: fixed;top: 110px;z-index: 101;background:#fff;overflow: hidden;" :style="{height:priceMore?'auto':'50px'}">
|
|
<view class="content-list" style="display: flex;float: left;">
|
|
<view class="list-name">时间</view>
|
|
<uni-datetime-picker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick" />
|
|
</view>
|
|
<view class="content-list" style="float: left;">
|
|
<view class="list-name">销售数</view>
|
|
<view class="list-val" style="padding-left: 10px;width:75px;">
|
|
{{totalAmount}}
|
|
</view>
|
|
</view>
|
|
<view class="content-list" style="float: left;">
|
|
<view class="list-name">销售额</view>
|
|
<view class="list-val">
|
|
<input type="digit" v-model="shouldPay" @blur="xiaoshouChange($event)"
|
|
@focus="obtainPrice($event,'xiaoshou')">
|
|
</view>
|
|
</view>
|
|
<view class="content-list" style="float: left;">
|
|
<view class="list-name">退货数</view>
|
|
<view class="list-val" style="padding-left: 10px;width:75px;">
|
|
{{returnTotalAmount}}
|
|
</view>
|
|
</view>
|
|
<view class="content-list" style="float: left;">
|
|
<view class="list-name">退货额</view>
|
|
<view class="list-val">
|
|
<input type="digit" v-model="returnPay" @blur="tuihuoChange($event)"
|
|
@focus="obtainPrice($event,'tuihuo')">
|
|
</view>
|
|
</view>
|
|
<!-- <view v-if="priceOk < 0"
|
|
style="color: red;font-size: 21px;text-align: left;width: 100%;padding-left: 40rpx;">
|
|
*已收金额为负,默认您已为客户退款,如不退款请更改已收金额
|
|
</view> -->
|
|
<view class="content-list" style="margin-top:10px;" v-if="qiankuandikou != 0">
|
|
<view class="list-name">欠款抵退货</view>
|
|
<view class="list-val">
|
|
<input type="digit" v-model="qiankuandikou" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" style="margin-top:10px;" v-if="yuedikou != 0">
|
|
<view class="list-name">余额抵扣</view>
|
|
<view class="list-val">
|
|
<input type="digit" v-model="yuedikou" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" style="margin-top:10px;" v-if="xiaoshoudikou != 0">
|
|
<view class="list-name">销售抵退货</view>
|
|
<view class="list-val">
|
|
<input type="digit" v-model="xiaoshoudikou" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" style="margin-top:10px;" v-if="zhiqianqiankuan > 0">
|
|
<view class="list-name">累计欠款</view>
|
|
<view class="list-val">
|
|
<input type="digit" v-model="leijiqiankuan" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" style="margin-top:10px;" v-if="leijiqiankuan < 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" style="margin-top:10px;" v-if="noPay >= 0">
|
|
<view class="list-name">本次欠款</view>
|
|
<view class="list-val">
|
|
<input type="digit" v-model="noPay" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" style="margin-top:10px;" v-if="noPay < 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" style="margin-top:10px;float: left;">
|
|
<view class="list-name">其他费用</view>
|
|
<view class="list-val">
|
|
<input type="digit" placeholder="其他费用" v-model="otherExpense">
|
|
</view>
|
|
</view>
|
|
<view class="content-list" style="margin-top:10px;">
|
|
<view class="list-name">备注</view>
|
|
<view style="display:inline-block">
|
|
<textarea maxlength="-1" @input='changeRemark($event)' v-model="remark" />
|
|
</view>
|
|
</view>
|
|
<view class="content-list" style="margin-top:10px;">
|
|
<view class="list-val" style="width:70%;display: flex;">
|
|
<radio-group style="display: flex;">
|
|
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in priceItems"
|
|
:key="item.value" @tap="priceChange(item.value,index)" style="margin-right:0">
|
|
<view>
|
|
<radio :value="item.value" :checked="index === priceCurrent" />
|
|
</view>
|
|
<view style="width: 80px;">{{item.name}}</view>
|
|
</label>
|
|
</radio-group>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" style="margin-top:10px;margin-bottom: 10px;">
|
|
<view class="list-val" style="width:70%;display: flex;">
|
|
<radio-group @change="discountChange" style="display: flex;">
|
|
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in items"
|
|
:key="item.value" style="margin-right:0">
|
|
<view>
|
|
<radio :value="item.value" :checked="index == discountCurrent" />
|
|
</view>
|
|
<view style="width: 80px;">{{item.name}}</view>
|
|
</label>
|
|
</radio-group>
|
|
<view class="discount-num" v-if="discountType == '1'">
|
|
<input type="digit" style="width:60rpx;padding:0;text-align: center;"
|
|
v-model="discountNum" @focus="obtainPrice($event,'zhengti')" @blur="change($event)">
|
|
</view>
|
|
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="scroll-content" style="overflow: scroll;" :style="{'margin-top':priceMore?'257px':'150px'}">
|
|
<view class="content-box" style="border-top:10rpx solid #eee;">
|
|
<view
|
|
style="width: 1360px;background: #088FEB;height: 40px;line-height: 40px;color: #fff;text-align:center;display: flex;">
|
|
<!-- <view style="width: 60px;border-right:1px solid #fff;">#</view> -->
|
|
<view style="width: 70px;border-right:1px solid #fff;">图</view>
|
|
<view style="width: 70px;border-right:1px solid #fff;">操作</view>
|
|
<view style="width: 300px;border-right:1px solid #fff;">货号/名称</view>
|
|
<view style="width: 150px;border-right:1px solid #fff;">颜色</view>
|
|
<view style="width: 130px;border-right:1px solid #fff;">尺码</view>
|
|
<view style="width: 100px;border-right:1px solid #fff;">库存</view>
|
|
<view style="width: 100px;border-right:1px solid #fff;">数量</view>
|
|
<view style="width: 130px;border-right:1px solid #fff;">售价</view>
|
|
<view style="width: 150px;border-right:1px solid #fff;">合计</view>
|
|
<view style="width: 150px;border-right:1px solid #fff;">分类</view>
|
|
</view>
|
|
<view v-for="(value,key) in Array.from(carList)" :key="key" style="width: 1360px;height: auto;line-height: 40px;background: #fff;">
|
|
<view v-for="(values,keys) in Array.from(value[1].stockLogList)" :key='keys'
|
|
:id="values[1].uuid">
|
|
<view v-if="value[1].isNew" style="display: flex;height: 40px;text-align: center;position: relative;">
|
|
|
|
<!-- <view style="width: 60px;border-right:1px solid #fff;">{{keys}}</view> -->
|
|
<view style="width: 70px;border-right:1px solid #eee;position: relative;">
|
|
<view v-if="(value[1].productPicture == '' || value[1].productPicture == undefined) && value[1].isNew == true"
|
|
@tap="uploadFilePromise(value)" style="position: absolute;top: 0;width: 100%;height: 40px;">
|
|
</view>
|
|
<view v-if="value[1].productPicture != '' && value[1].productPicture != undefined && value[1].isNew == true"
|
|
@longpress="uploadFilePromise(value)" @tap="getZhuBigImage(value[1].productPicture)" style="position: absolute;top: 0;width: 100%;height: 40px;">
|
|
</view>
|
|
<view style="width: 30px;height: 30px;text-align: center;">
|
|
<img :src="value[1].productPicture" alt="" style="width: 30px;height: 30px;margin: 5px 20px;"
|
|
v-if="value[1].productPicture !=null && value[1].productPicture !=''">
|
|
<view v-else style="margin: 0 20px;">
|
|
<uni-icons type='plusempty' size='26'></uni-icons>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view style="width: 70px;border-right:1px solid #eee;">
|
|
<uni-icons @tap="changeShowBtn(value[0],values[0])" v-if="keys == 0" type="list" color="#777" size='30'></uni-icons>
|
|
<view v-else class="operate-btn" @tap.stop="delShopSpec(value[0],values[0])" style="background:red;">
|
|
删除
|
|
</view>
|
|
<view v-if="values[1].isShowBtn" style="width: 350px;height: 50px;background: #777;position: absolute;bottom: -55px;left: 70px;z-index: 99;border: 1px solid #eee;border-radius: 10px;padding-top: 5px;">
|
|
<view class="operate-btn" @tap.stop="delShopSpec(value[0],values[0])" style="background:red;">
|
|
删除
|
|
</view>
|
|
<view class="operate-btn" @tap="toggle('oneGoods',value[0],values[0])" style="background:#088FEB;">
|
|
语音
|
|
</view>
|
|
<view class="operate-btn" @tap="AiAddSpec(value[1],1,value[0],values[0])" style="background:#FF9797;">
|
|
加规格
|
|
</view>
|
|
<view class="operate-btn" @tap="pictureAdd(value[0],'',values[0])" style="background:#EEB422;">
|
|
<text>多图 </text>
|
|
<text v-if="value[1].productPictures != ''">
|
|
{{value[1].productPictures.length}}
|
|
</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view style="width: 300px;border-right:1px solid #eee;display: flex;">
|
|
<view class="new-logo">新</view>
|
|
<input type="text" :value="value[1].productName" @blur="getName($event,value[0])" placeholder="品名" style="height: 40px;line-height: 40px;border-right: 1px solid #eee;">
|
|
<input type="text" @focus="newProductId=''" @input="sninput($event,value[0])"
|
|
@blur="getSnIsRepeat($event,value[0])" v-model="value[1].productSn" placeholder="货号" style="height: 40px;line-height: 40px;">
|
|
<uni-icons type="refresh" color="#777" size='30' @tap="getOneId(value[0])"></uni-icons>
|
|
</view>
|
|
<view style="width: 150px;border-right:1px solid #eee;">
|
|
<text @tap="checkSpec('颜色',value[0],values[0],numData(values[0])[0])">
|
|
{{numData(values[0])[0]}}
|
|
</text>
|
|
</view>
|
|
<view style="width: 130px;border-right:1px solid #eee;">
|
|
<text @tap="checkSpec('尺码',value[0],values[0],numData(values[0])[1])">
|
|
{{numData(values[0])[1]}}
|
|
</text>
|
|
</view>
|
|
<view style="width: 100px;border-right:1px solid #eee;">
|
|
<text style="width: 25%;font-size: 21px;color:red"
|
|
v-if="values[1].productNum == null || values[1].productNum === '' || values[1].productNum == undefined">
|
|
无库存
|
|
</text>
|
|
<text style="width: 25%;font-size: 21px;"
|
|
v-if="values[1].productNum != null && values[1].productNum !== ''">
|
|
{{values[1].productNum}}
|
|
</text>
|
|
</view>
|
|
<view style="width: 100px;border-right:1px solid #eee;">
|
|
<view style="height: 40px;line-height: 40px;">
|
|
<!-- <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" disabled
|
|
@tap="obtainPrice($event,'mapdanjishu',value[0],values[0])"
|
|
type="number" style="height: 40px;line-height: 40px;" />
|
|
<!-- <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 style="width: 130px;border-right:1px solid #eee;">
|
|
<input type="digit" v-model="value[1].discountAmount"
|
|
@tap="obtainPrice($event,'danjia',value[0])" disabled style="height: 40px;line-height: 40px;">
|
|
</view>
|
|
<view style="width: 150px;border-right:1px solid #eee;">
|
|
{{value[1].discountAmount * values[1].productCount}}
|
|
</view>
|
|
<view style="width: 150px;border-right:1px solid #eee;">
|
|
<view v-if="value[1].isNew">
|
|
<text>{{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>
|
|
</view>
|
|
<view v-else style="display: flex;height: 40px;text-align: center;position: relative;">
|
|
<!-- <view
|
|
v-if="value[1].buyCount !=null && value[1].buyCount!=undefined && value[1].buyCount!='' && khName.name !='散客'"
|
|
style="position: absolute;top: 110rpx;left: 31rpx;color: #fff;background: red;width: 140rpx;height: 40rpx;font-size: 21px;text-align: center;line-height: 40rpx;border-radius: 5px;">
|
|
购买次数:{{value[1].buyCount}}
|
|
</view> -->
|
|
|
|
<view style="width: 70px;border-right:1px solid #eee;position: relative;">
|
|
<view style="width: 30px;height: 30px;">
|
|
<img @tap="getZhuBigImage(value[1].productPicture)" class="img-radius"
|
|
:src="value[1].productPicture" alt=""
|
|
style="width: 30px;height: 30px;margin: 5px 20px;"
|
|
v-if="value[1].productPicture">
|
|
<!-- 暂无图片 -->
|
|
<view v-else style="width: 100%;height: 100%;color: #777;background: #eee;border-radius: 5px;margin: 5px 20px;"></view>
|
|
</view>
|
|
</view>
|
|
<view style="width: 70px;border-right:1px solid #eee;">
|
|
<uni-icons @tap="changeShowBtn(value[0],values[0])" v-if="keys == 0" type="list" color="#777" size='30'></uni-icons>
|
|
<view v-else class="operate-btn" @tap.stop="delShopSpec(value[0],values[0])" style="background:red;">
|
|
删除
|
|
</view>
|
|
<view v-if="values[1].isShowBtn" style="width: 420px;height: 50px;background: #777;position: absolute;bottom: -55px;left: 70px;z-index: 99;border: 1px solid #eee;border-radius: 10px;padding-top: 5px;">
|
|
<view class="operate-btn" @tap.stop="delShopSpec(value[0],values[0])" style="background:red;">
|
|
删除
|
|
</view>
|
|
<view v-if="keys == 0" class="operate-btn" @tap="toggle('oneGoodsOld',value[0],values[0])" style="background:#088FEB;">
|
|
语音
|
|
</view>
|
|
<view v-if="keys == 0" class="operate-btn" @tap="AiAddSpec(value[1].productId,'',value[0],values[0])" style="background:#FF9797;">
|
|
加规格
|
|
</view>
|
|
<view v-if="keys == 0" @tap.stop="clickPrice(value[0],values[0])" class="operate-btn" style="background:#5fd9ee;">
|
|
改价
|
|
</view>
|
|
<view v-if="keys == 0" @tap.stop="AiAddReturnSpec(value[1].productId,value[0],values[0])"
|
|
style="background:#EEB422;" class="operate-btn">
|
|
同款退货
|
|
</view>
|
|
<view @tap.stop="getHistoryPrice(value[1].productId,value[0],values[1])"
|
|
v-if="khName !=''&&khName.name !='散客'&&keys == 0"
|
|
style="background:green;" class="operate-btn">
|
|
上次价格
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view style="width: 300px;border-right:1px solid #eee;display: flex;height: 40px;line-height: 40px;" >
|
|
{{value[1].productName == null?'':value[1].productName}}
|
|
({{value[1].productSn}})
|
|
</view>
|
|
<view style="width: 150px;border-right:1px solid #eee;">
|
|
<text @tap="checkSpec('颜色',value[0],values[0],numData(values[0])[0])">
|
|
{{numData(values[0])[0]}}
|
|
</text>
|
|
</view>
|
|
<view style="width: 130px;border-right:1px solid #eee;">
|
|
<text @tap="checkSpec('尺码',value[0],values[0],numData(values[0])[1])">
|
|
{{numData(values[0])[1]}}
|
|
</text>
|
|
</view>
|
|
<view style="width: 100px;border-right:1px solid #eee;">
|
|
<text style="width: 25%;font-size: 21px;color:red"
|
|
v-if="values[1].productNum == null || values[1].productNum === '' || values[1].productNum == undefined">
|
|
无库存
|
|
</text>
|
|
<text style="width: 25%;font-size: 21px;"
|
|
v-if="values[1].productNum != null && values[1].productNum !== ''">
|
|
{{values[1].productNum}}
|
|
</text>
|
|
</view>
|
|
<view style="width: 100px;border-right:1px solid #eee;">
|
|
<view style="height: 40px;line-height: 40px;">
|
|
<!-- <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" disabled
|
|
@tap="obtainPrice($event,'mapdanjishu',value[0],values[0])"
|
|
type="number" style="height: 40px;line-height: 40px;" />
|
|
<!-- <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 style="width: 130px;border-right:1px solid #eee;">
|
|
<input type="digit" v-model="value[1].discountAmount"
|
|
@tap="obtainPrice($event,'danjia',value[0])" disabled style="height: 40px;line-height: 40px;">
|
|
</view>
|
|
<view style="width: 150px;border-right:1px solid #eee;">
|
|
{{value[1].discountAmount * values[1].productCount}}
|
|
</view>
|
|
<view style="width: 150px;border-right:1px solid #eee;">
|
|
<view v-if="value[1].isNew">
|
|
<text>{{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>
|
|
</view>
|
|
<view class="shop-type" v-if="keys == '0'">
|
|
<view class="shop-collapse-item" v-if="discountType == '0'">
|
|
<view class="collapse-1">
|
|
<text>单价</text>
|
|
<input class="input" type="text" :value='value[1].unitPrice' disabled>
|
|
</view>
|
|
<view class="collapse-1">
|
|
<text>折扣(0-10)</text>
|
|
<input class="input" type="digit" @focus="obtainPrice($event,'danzhe',value[0])"
|
|
:value='value[1].discount' @blur="changeDis($event,value[0])">
|
|
</view>
|
|
<view class="collapse-1">
|
|
<text>折后价</text>
|
|
<input class="input" type="text" :value='value[1].price' disabled>
|
|
</view>
|
|
<view class="collapse-1">
|
|
<text>数量</text>
|
|
<input class="input" type="number" :value='value[1].productCount' disabled>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view v-for="(values1,keys1) in Array.from(value[1].returnList)" :key='keys1'
|
|
:id="values1[1].uuid" v-if="value[1].returnList !=''" style="color:red;">
|
|
|
|
<view style="display: flex;height: 40px;text-align: center;">
|
|
<view style="width: 70px;border-right:1px solid #eee;"></view>
|
|
<view style="width: 70px;border-right:1px solid #eee;">
|
|
<view class="operate-btn" @tap.stop="delShopReturnSpec(value[0],values1[0])" style="background:red;">
|
|
删除
|
|
</view>
|
|
</view>
|
|
<view style="width: 300px;border-right:1px solid #eee;display: flex;height: 40px;line-height: 40px;" >
|
|
{{value[1].productName == null?'':value[1].productName}}
|
|
({{value[1].productSn}})
|
|
</view>
|
|
<view style="width: 150px;border-right:1px solid #eee;">
|
|
<text @tap="checkSpec('颜色',value[0],values1[0],numData(values1[0])[0])">
|
|
{{numData(values1[0])[0]}}
|
|
</text>
|
|
</view>
|
|
<view style="width: 130px;border-right:1px solid #eee;">
|
|
<text @tap="checkSpec('尺码',value[0],values1[0],numData(values1[0])[1])">
|
|
{{numData(values1[0])[1]}}
|
|
</text>
|
|
</view>
|
|
<view style="width: 100px;border-right:1px solid #eee;">
|
|
<text style="width: 25%;font-size: 21px;color:red"
|
|
v-if="values1[1].productNum == null || values1[1].productNum ==='' ||values1[1].productNum==undefined">
|
|
无库存
|
|
</text>
|
|
<text style="width: 25%;font-size: 21px;"
|
|
v-if="values1[1].productNum != null">
|
|
{{values1[1].productNum}}
|
|
</text>
|
|
</view>
|
|
<view style="width: 100px;border-right:1px solid #eee;">
|
|
<view style="height: 40px;line-height: 40px;">
|
|
<input v-model="values1[1].productCount" disabled
|
|
@tap="obtainPrice($event,'returnmapdanjishu',value[0],values1[0])"
|
|
type="number" style="height: 40px;line-height: 40px;" />
|
|
</view>
|
|
</view>
|
|
<view style="width: 130px;border-right:1px solid #eee;">
|
|
<input type="digit" v-model="value[1].discountAmount"
|
|
@tap="obtainPrice($event,'danjia',value[0])" disabled style="height: 40px;line-height: 40px;">
|
|
</view>
|
|
<view style="width: 150px;border-right:1px solid #eee;">
|
|
{{value[1].discountAmount * values1[1].productCount}}
|
|
</view>
|
|
<view style="width: 150px;border-right:1px solid #eee;">
|
|
<view v-if="value[1].isNew">
|
|
<text>{{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>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="content-box" style="margin-bottom: 130rpx;">
|
|
|
|
<!-- <view class="shop-box">
|
|
<view class="" style="border-bottom: 1px solid #eee;">
|
|
<view class="list-name" style="width: 100%;">发货方式</view>
|
|
<view class="list-val" style="width: 100%;padding-left:20rpx;height:200rpx;">
|
|
<radio-group @change="radioChange">
|
|
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in logisticsType"
|
|
:key="item.value">
|
|
<view>
|
|
<radio :value="item.value" :checked="index === lunbocurrent" />
|
|
</view>
|
|
<view>{{item.name}}</view>
|
|
</label>
|
|
</radio-group>
|
|
</view>
|
|
</view>
|
|
<view class="" v-if="radioType != '2'">
|
|
<view class="content-list" v-if="radioType == '0' || radioType == '1'"
|
|
@tap.stop="goPopleList(radioType == '0'? 'wlName' :'kdName')">
|
|
<view class="list-name" style="width:150rpx;padding-left: 0;">
|
|
{{radioType == '0'? '选择物流' :'选择快递'}}
|
|
</view>
|
|
<view class="list-val">
|
|
<input type="text" placeholder="请选择" disabled
|
|
:value="wlName.companyName || wlName.shippingMethod"
|
|
style="border-bottom: 1px solid #fff;text-align: center;padding-right: 54rpx;">
|
|
<uni-icons type="right" size="16"
|
|
style="margin-left: 80rpx;line-height: 80rpx;"></uni-icons>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="radioType == '4'" @tap.stop="goPopleList('fcName')">
|
|
<view class="list-name" style="width:150rpx;padding-left:0;">选择车号</view>
|
|
<view class="list-val">
|
|
<input type="text" placeholder="请选择" disabled
|
|
:value="wlName.companyName || wlName.shippingMethod"
|
|
style="border-bottom: 1px solid #fff;text-align: center;">
|
|
<uni-icons type="right" size="16"
|
|
style="margin-left: 80rpx;line-height: 80rpx;"></uni-icons>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="radioType == '5'" @tap.stop="goPopleList('dbName')">
|
|
<view class="list-name" style="width:150rpx;padding-left:0;">选择车号</view>
|
|
<view class="list-val">
|
|
<input type="text" placeholder="请选择" disabled
|
|
:value="wlName.companyName || wlName.shippingMethod"
|
|
style="border-bottom: 1px solid #fff;text-align: center;">
|
|
<uni-icons type="right" size="16"
|
|
style="margin-left: 80rpx;line-height: 80rpx;"></uni-icons>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="radioType =='0' || radioType =='5' || radioType =='4'">
|
|
<view class="list-name" style="width:150rpx;padding-left:0;">配送方式</view>
|
|
<view class="list-val" style="line-height: 90rpx;">
|
|
<uni-data-select clear='true' class="uni-data-select" :localdata="sex" v-model="value"
|
|
placeholder="请选择配送方式" @change="checkBoxChange"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="radioType1 == '0' && radioType !=''"
|
|
@tap.stop="goPopleList(radioType == '1'? 'kdyName' :'lbgName')">
|
|
<view class="list-name" style="width:150rpx;padding-left:0;">
|
|
{{radioType == '1'? '快递员' :'拉包工'}}
|
|
</view>
|
|
<view class="list-val">
|
|
<input type="text" placeholder="可指定人员" disabled
|
|
:value="radioType == '1'? kdyName.workerName : lbgName.workerName"
|
|
style="border-bottom: 1px solid #fff;text-align: center;">
|
|
<uni-icons type="right" size="16"
|
|
style="margin-left: 80rpx;line-height: 80rpx;"></uni-icons>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="radioType == '3'">
|
|
<view class="list-name" style="padding-left:0;">拼包地址</view>
|
|
<view class="">
|
|
<textarea maxlength="-1" @input='changePbAddress($event)' :value='pbAddress' />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view> -->
|
|
</view>
|
|
</view>
|
|
<!-- </view> -->
|
|
|
|
<!-- 弹出输入框 -->
|
|
<uni-popup ref="inputDialog" background-color="#fff">
|
|
<view class="popup-pay-content" style="width:500px;">
|
|
<view class="popup-pay-title">
|
|
<text>选择商品价格</text>
|
|
</view>
|
|
<view class="popup-pay-container" @tap.stop="checkPay(lsprice,'')" style="height: 50px;line-height: 50px;">
|
|
<text style="display: inline-block">零售价:¥{{lsprice}}</text>
|
|
</view>
|
|
<view class="popup-pay-container" @tap.stop="checkPay(wholesalePrice,'')" style="height: 50px;line-height: 50px;">
|
|
<text style="display: inline-block">批发价:¥{{wholesalePrice}}</text>
|
|
</view>
|
|
<view class="popup-pay-container"
|
|
style="background: #fff;display: flex;width: 100%;height: 50px;color: #000;border: none;line-height: 50px;">
|
|
<view style="width:230rpx;">自定义售价:</view>
|
|
<input ref='priceD' type="digit"
|
|
style="height: 50px;line-height: 50px;color: #000;width: 200rpx;border-bottom: 1px solid #eee;"
|
|
placeholder="请输入售价" v-model="customPrice" @input="changePay">
|
|
</view>
|
|
<view class="popup-pay-container"
|
|
style="background: #fff;display: flex;width: 100%;height: 50px;color: #000;border: none;line-height: 50px;">
|
|
<view style="width:230rpx;">自定义退货:</view>
|
|
<input ref='returnPriceD' type="digit"
|
|
style="height: 50px;line-height: 50px;color: #000;width: 200rpx;border-bottom: 1px solid #eee;"
|
|
placeholder="请输入退货价" v-model="returnPrice" @input="changeReturnPay">
|
|
</view>
|
|
<view
|
|
style="width: 100%;color: #fff;height: 50px;background: #088FEB;border-radius: 5px;font-size: 21px;text-align: center;line-height: 50px;margin-top: 20rpx;"
|
|
@tap.stop="checkPay(customPrice,returnPrice)">确定</view>
|
|
</view>
|
|
</uni-popup>
|
|
|
|
<!-- 弹出层 -->
|
|
<view class="tanchuceng">
|
|
<uni-popup ref="shopPopup" background-color="#fff">
|
|
<view class="shop-popup-content">
|
|
<view class="shop-popup-title">
|
|
<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: 40px;right: 20rpx;color: #088FEB;text-decoration: underline;z-index: 99;">
|
|
保存已选</view>
|
|
<view style="padding-left: 20rpx;color: #777;">*实心蓝色框为选中状态</view>
|
|
<ul style="border-top:20rpx;">
|
|
<li v-for="(items,index) in goodsDetail.attributeList" v-if="goodsDetail.isNew == true"
|
|
:key="index" style="position: relative;">
|
|
<view class="shop-title-fur">
|
|
<view class="shop-title-name">{{items.name}}</view>
|
|
</view>
|
|
<view @tap="getScanCodeCategroyId(items.name)"
|
|
style="position: absolute;top: 10px;left: 100px;color: #088FEB;text-decoration: underline;font-size: 21px;">
|
|
新增{{items.name}}
|
|
</view>
|
|
<view class="shop-attrs">
|
|
<view class="suibian" @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' : '' " style="position: relative;">
|
|
{{itemTag.value}}
|
|
<view class="kucun" v-if="itemTag.isKucun"></view>
|
|
</view>
|
|
</view>
|
|
</li>
|
|
<li v-for="(items,index) in goodsDetail.attributeList"
|
|
v-if="goodsDetail.isNew != true && index == 0" :key="index" style="position: relative;">
|
|
<view class="shop-title-fur">
|
|
<view class="shop-title-name">{{items.name}}</view>
|
|
</view>
|
|
<view @tap="getScanCodeCategroyId(items.name)" v-if="goodsDetail.isNew == true"
|
|
style="position: absolute;top: 10px;left: 100px;color: #088FEB;text-decoration: underline;font-size: 21px;">
|
|
新增{{items.name}}
|
|
</view>
|
|
<view class="shop-attrs">
|
|
<view class="suibian" v-for="(itemTag, index1) in items.value" :key="index1"
|
|
@tap.stop="attrNameChange(index,itemTag.value,index1) "
|
|
:class="itemTag.isChecked ? 'checkedText' : '' " style="position: relative;">
|
|
{{itemTag.value}}
|
|
<view class="kucun" v-if="itemTag.isKucun"></view>
|
|
</view>
|
|
</view>
|
|
</li>
|
|
</ul>
|
|
<view style="padding-bottom:100rpx;">
|
|
<view class="shop-checkList" v-if="temporaryList != ''">
|
|
<view class="shop-checkList-box" style="width: 69.5%;">
|
|
<text
|
|
style="width: 69%;display: inline-block;font-size: 21px;font-weight: bold;padding-left: 40rpx;">
|
|
规格
|
|
</text>
|
|
<text
|
|
style="color: #777;font-size: 21px;width: 17%;text-align: center;display: inline-block;">
|
|
库存
|
|
</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" @tap="obtainPrice($event,'zongjishu')" disabled
|
|
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: 2.5%;width: 7%;">
|
|
<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: 21px;width: 17%;text-align: center;display: inline-block;"
|
|
v-if="item.productNum == null || item.productNum === '' || item.productNum ==undefined ">
|
|
无库存
|
|
</text>
|
|
<text style="color:#777;font-size: 21px;" v-if="item.productNum != null">
|
|
{{item.productNum}}
|
|
</text>
|
|
</view>
|
|
<!-- <uni-number-box max='1000000' min="-10000" 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)"
|
|
@tap="obtainPrice($event,'danjishu',index)" disabled 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" v-for="(item,index) in temporaryList" :key="index">
|
|
<view class="shop-popup-bottom-left">
|
|
<text>{{zNum}} 件</text>
|
|
<!-- <text>¥{{zPrice}}</text> -->
|
|
</view>
|
|
<view class="shop-popup-bottom-right">
|
|
<view class="bottom-btn" @tap.stop="temporaryCheck(false)">选好了</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
</view>
|
|
<!-- 历史价格弹出层 -->
|
|
<uni-popup ref="historyPopup" background-color="#fff">
|
|
<view class="popup-content">
|
|
<view class="popup-title">
|
|
<text>拿货历史价格</text>
|
|
<uni-icons @tap='this.$refs.historyPopup.close()' type="closeempty" color='red' size="16"
|
|
style="height:40rpx;line-height: 40rpx;position: absolute !important;bottom:0;right: 30rpx;"></uni-icons>
|
|
</view>
|
|
<view class="popup-container" v-if="historyList != null && historyList.discountAmount != null">
|
|
<view style="height: 60rpx;line-height: 60rpx;">上次拿货时间:</view>
|
|
<view style="height: 60rpx;line-height: 60rpx;">{{historyList.createTime}}</view>
|
|
<view style="height: 60rpx;line-height: 60rpx;">上次拿货数:{{historyList.productCount}}</view>
|
|
<view style="height: 60rpx;line-height: 60rpx;font-size: 21px;font-weight: bold;">
|
|
上次拿货价:{{historyList.discountAmount}}</view>
|
|
</view>
|
|
<view class="popup-container" v-else>
|
|
<view style="height: 150rpx;line-height: 150rpx;text-align: center;">暂无拿货历史</view>
|
|
</view>
|
|
<view class="popup-bottom" v-if="historyList != null">
|
|
<view class="popup-btn" @tap="checkPay(historyList.discountAmount,historyList.discountAmount)">
|
|
一键使用历史价格</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- 语音识别弹出层 -->
|
|
<uni-popup ref="popup" background-color="#fff">
|
|
<view class="voice-popup-content"
|
|
:style="{height:(oneGoodsId != ''?'400px':'350px'),'margin-bottom':(isChangeHeight?'300px':'0')}">
|
|
<view class="voice-popup-title">
|
|
<text>语音录入</text>
|
|
<uni-icons @tap='close' type="closeempty" color='red' size="16"
|
|
style="height:40rpx;line-height: 40rpx;position: absolute !important;bottom:0;right: 30rpx;"></uni-icons>
|
|
</view>
|
|
<view style="text-align: center;width: 100%;line-height: 40rpx;font-size: 21px;color: #777;">
|
|
{{oneGoodsId != ''?'语音示例:货号0237,数量10件,单价88,名称:裙子':'语音示例:货号02-37,白色M码,数量10件'}}
|
|
</view>
|
|
<view class="voice-popup-container">
|
|
<textarea maxlength="-1" name="" id="" @input="getText" @focus="isChangeHeight = true"
|
|
@blur="isChangeHeight = false" style="width: 100%;height: 130px;border: 1px solid #eee;margin: 0;"
|
|
v-model="voiceText1" placeholder="等待语音识别中..."></textarea>
|
|
<view>
|
|
<text style="color:red;font-size:21px;">*长按“语音”按钮录入,系统将自动识别</text>
|
|
</view>
|
|
<view class="voice-popup-bottom">
|
|
<view class="voice-popup-btn" @tap="clearText">清空</view>
|
|
<view class="voice-popup-btn" v-if="voiceType == 'new'" @tap="setDetail">确认</view>
|
|
<view class="voice-popup-btn" v-if="voiceType == 'old'" @tap="setOneDetailOld">确认</view>
|
|
</view>
|
|
</view>
|
|
<view class="voice-btn" @touchstart="kaishi" @touchend="jieshu">
|
|
<img src="/static/images/maikefeng.png" style="width: 80%;height: 80%;margin: 10%;" alt="">
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<view class="voice-model" v-if="recordState == true">
|
|
<img src="/static/images/maikefeng.png" alt="">
|
|
<view class="voice-text">语音识别中...</view>
|
|
</view>
|
|
<!-- 金额展示框 -->
|
|
<uni-popup ref="showPopup" background-color="#fff">
|
|
<view class="popup-pay-content" style="width: 550rpx;">
|
|
<view class="popup-pay-title">
|
|
<text>请确认再次确认</text>
|
|
<uni-icons @tap='$refs.showPopup.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="width: 90%;margin: 0 auto;height: 60px;line-height: 80px;font-size: 21px;">
|
|
开单客户:<text
|
|
style="font-weight:bold;color:red;">{{((shopId=='1863043415453863936'|| shopId =='1810179818189361152') && khName.name == '散客')?'客户':khName.name}}</text>
|
|
</view>
|
|
<view>
|
|
<view style="width: 100%;height: 90px;">
|
|
<view
|
|
style="width: 120px;height: 80px;border: 3px solid #FFE4C4;border-radius: 10px;margin-top: 10px;padding-top: 10px;display: flex;flex-direction: column;text-align: center;float: left;margin-left: 31px;">
|
|
<text style="font-weight: bold;">
|
|
销售金额
|
|
</text>
|
|
<text style="font-size: 21px;color: #000;font-weight: bold;">
|
|
¥{{shouldPay}}
|
|
</text>
|
|
</view>
|
|
<view v-if="noPay >= 0"
|
|
style="width: 120px;height: 80px;border: 3px solid #FFE4C4;border-radius: 10px;margin-top: 10px;padding-top: 10px;display: flex;flex-direction: column;text-align: center;float: left;margin-left: 40px;">
|
|
<text style="font-weight: bold;">
|
|
本次欠款
|
|
</text>
|
|
<text style="font-size: 21px;color: #000;font-weight: bold;">
|
|
¥{{noPay}}
|
|
</text>
|
|
</view>
|
|
<view v-if="noPay < 0"
|
|
style="width: 120px;height: 80px;border: 3px solid #FFE4C4;border-radius: 10px;margin-top: 10px;padding-top: 10px;display: flex;flex-direction: column;text-align: center;float: left;margin-left: 40px;">
|
|
<text style="font-weight: bold;">
|
|
本次余额
|
|
</text>
|
|
<text style="font-size: 21px;color: #000;font-weight: bold;">
|
|
¥{{Math.abs(noPay)}}
|
|
</text>
|
|
</view>
|
|
<view
|
|
style="width: 120px;height: 80px;border: 3px solid #FFE4C4;border-radius: 10px;margin-top: 10px;padding-top: 10px;display: flex;flex-direction: column;text-align: center;float: left;margin-left: 40px;">
|
|
<text style="font-weight: bold;">
|
|
应收金额
|
|
</text>
|
|
<text style="font-size: 21px;color: #000;font-weight: bold;">
|
|
¥{{relPrice}}
|
|
</text>
|
|
</view>
|
|
<view
|
|
style="width: 120px;height: 80px;border: 3px solid #FFE4C4;border-radius: 10px;margin-top: 10px;padding-top: 10px;display: flex;flex-direction: column;text-align: center;float: left;margin-left: 40px;">
|
|
<text style="font-weight: bold;">
|
|
已收金额
|
|
</text>
|
|
<text style="font-size: 21px;color: #000;font-weight: bold;">
|
|
¥{{priceOk}}
|
|
</text>
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
<view
|
|
style="width: 90%;height: 215px;border: 3px solid #FFE4C4;border-radius: 10px;text-align: center;margin: 27px auto 0;">
|
|
<view style="height: 50px;line-height:50px;display: flex;width: 50%;float:left;">
|
|
<text style="font-size: 21px;flex: 1;">退货金额:</text>
|
|
<text style="font-size: 21px;flex: 1;font-weight: bold;">¥{{returnPay}}</text>
|
|
</view>
|
|
<view style="height: 50px;line-height:50px;display: flex;width: 50%;float:left;" v-if="zhiqianqiankuan > 0">
|
|
<text style="font-size: 21px;flex: 1;">之前欠款:</text>
|
|
<text style="font-size: 21px;flex: 1;font-weight: bold;">¥{{zhiqianqiankuan}}</text>
|
|
</view>
|
|
<view style="height: 50px;line-height:50px;display: flex;width: 50%;float:left;" v-if="zhiqianqiankuan < 0">
|
|
<text style="font-size: 21px;flex: 1;">客户余额:</text>
|
|
<text style="font-size: 21px;flex: 1;font-weight: bold;">¥{{Math.abs(zhiqianqiankuan)}}</text>
|
|
</view>
|
|
<view style="height: 50px;line-height:50px;display: flex;width: 50%;float:left;">
|
|
<text style="font-size: 21px;flex: 1;">欠款抵退货:</text>
|
|
<text style="font-size: 21px;flex: 1;font-weight: bold;">¥{{qiankuandikou}}</text>
|
|
</view>
|
|
<view style="height: 50px;line-height:50px;display: flex;width: 50%;float:left;">
|
|
<text style="font-size: 21px;flex: 1;">余额抵扣:</text>
|
|
<text style="font-size: 21px;flex: 1;font-weight: bold;">¥{{yuedikou}}</text>
|
|
</view>
|
|
<view style="height: 50px;line-height:50px;display: flex;width: 50%;float:left;">
|
|
<text style="font-size: 21px;flex: 1;">销售抵退货:</text>
|
|
<text style="font-size: 21px;flex: 1;font-weight: bold;">¥{{xiaoshoudikou}}</text>
|
|
</view>
|
|
<view style="height: 50px;line-height:50px;display: flex;width: 50%;float:left;" v-if="leijiqiankuan >= 0">
|
|
<text style="font-size: 21px;flex: 1;">累计欠款:</text>
|
|
<text style="font-size: 21px;flex: 1;font-weight: bold;">¥{{leijiqiankuan}}</text>
|
|
</view>
|
|
<view style="height: 50px;line-height:50px;display: flex;width: 50%;float:left;" v-if="leijiqiankuan < 0">
|
|
<text style="font-size: 21px;flex: 1;">累计余额:</text>
|
|
<text style="font-size: 21px;flex: 1;font-weight: bold;">¥{{Math.abs(leijiqiankuan)}}</text>
|
|
</view>
|
|
<view style="height: 50px;line-height:50px;display: flex;width: 50%;float:left;">
|
|
<text style="font-size: 21px;flex: 1;">其他费用:</text>
|
|
<text
|
|
style="font-size: 21px;flex: 1;font-weight: bold;">¥{{otherExpense == ''?'0':otherExpense}}</text>
|
|
</view>
|
|
</view>
|
|
<view @tap='goSell' class="popup-pay-container" style="text-align: center;width: 90%;margin: 20px auto 0;height: 80px;line-height: 80px;">
|
|
确认无误去开单
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- AI开单选中未入库不展示的框 -->
|
|
<uni-popup ref="AiNoPopup" background-color="#fff">
|
|
<view class="popup-pay-content" style="max-height: 1000rpx;overflow: scroll;">
|
|
<view class="popup-pay-title">
|
|
<text>识别结果</text>
|
|
</view>
|
|
<view style="border-bottom: 1px solid #eee;" v-if="aiNotRecognition != ''">
|
|
<view style="margin-top:20rpx;">抱歉:小助手对“{{getMsg}}”的部分商品未识别,请检查识别信息是否正确:</view>
|
|
<view class="box-right" style="margin: 20rpx 0 20rpx;text-align: left;width: 100%;">
|
|
<text class="box-right-name"
|
|
style="font-size: 21px;padding: 20rpx 0;">{{aiNotRecognition}}</text>
|
|
</view>
|
|
</view>
|
|
<view style="background: #fff;width: 440rpx;">
|
|
<view @tap='$refs.AiNoPopup.close()'
|
|
style="width: 100%;line-height: 100rpx;text-align: center;background: #088FEB;margin-bottom: 10rpx;border-radius: 10px;color: #fff;">
|
|
确认
|
|
</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 v-if="snList.length > 0"
|
|
style="height: 80rpx;font-size: 21px;font-weight: bold;line-height: 80rpx;text-align: center;">
|
|
点击选择已有规则
|
|
</view>
|
|
<view v-if="snList.length > 0" style="width: 90%;margin: 0 auto;">
|
|
<view v-for="(item,index) in snList" @tap="generateSn(item.value)" :key="index"
|
|
style="height: 80rpx;line-height: 80rpx;font-size: 21px;border-bottom: 1px solid #eee;display: flex;">
|
|
<view style="width: 90%;">{{index + 1}} 、 {{item.text}}</view>
|
|
<uni-icons type="right" size="16" style="width: 10%;text-align: center;"></uni-icons>
|
|
</view>
|
|
</view>
|
|
<view style="height: 80rpx;font-size: 21px;font-weight: bold;line-height: 80rpx;text-align: center;">
|
|
生成新规则
|
|
</view>
|
|
<view
|
|
style="height: 80rpx;font-size: 21px;font-weight: bold;line-height: 80rpx;color:red;text-align: center;">
|
|
*如生成新的货号规则,可在下方输入框新增
|
|
</view>
|
|
<view class="sn-content-list">
|
|
<view class="sn-list-name" style="width: 156rpx;">前缀</view>
|
|
<view class="sn-list-val" style="width: 245rpx;">
|
|
<input type="text" placeholder="请输入前缀规则" v-model="prefixRule" style="width:245rpx;">
|
|
</view>
|
|
</view>
|
|
<view class="sn-content-list">
|
|
<view class="sn-list-name" style="width: 156rpx;">生成位数</view>
|
|
<view class="sn-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: 21px;font-weight: bold;line-height: 80rpx;text-align: center;">
|
|
修改当前规格
|
|
</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>
|
|
<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="specDialog" 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: 21px;font-weight: bold;line-height: 120rpx;text-align: center;">
|
|
新增规格值
|
|
</view>
|
|
<view style="height: 80rpx;font-size: 21px;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="请输入规格值" />
|
|
</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="returnDialog" background-color="#fff" :is-mask-click="true">
|
|
<view class="shop-popup-content">
|
|
<view class="shop-popup-title">
|
|
<view class="shop-popup-title-right">
|
|
<view class="shop-popup-title-right-box" style="color: #088FEB;">
|
|
{{(goodsReturnDetail.productName == undefined || goodsReturnDetail.productName == null)?'':goodsReturnDetail.productName}}
|
|
</view>
|
|
<view class="shop-popup-title-right-box">{{goodsReturnDetail.productSn}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="shop-popup-container" style="position: relative;">
|
|
<view style="padding-left: 20rpx;color: #777;">*实心蓝色框为选中状态</view>
|
|
<ul style="border-top:20rpx;">
|
|
<li v-for="(items,index) in goodsReturnDetail.attributeList"
|
|
v-if="goodsReturnDetail.isNew != true && index == 0" :key="index"
|
|
style="position: relative;">
|
|
<view class="shop-title-fur">
|
|
<view class="shop-title-name">{{items.name}}</view>
|
|
</view>
|
|
<view class="shop-attrs">
|
|
<view class="suibian" v-for="(itemTag, index1) in items.value" :key="index1"
|
|
@tap.stop="attrReturnNameChange(index,itemTag.value,index1) "
|
|
:class="itemTag.isChecked ? 'checkedText' : '' " style="position: relative;">
|
|
{{itemTag.value}}
|
|
<view class="kucun" v-if="itemTag.isKucun"></view>
|
|
</view>
|
|
</view>
|
|
</li>
|
|
</ul>
|
|
<view style="padding-bottom:100rpx;">
|
|
<view class="shop-checkList" v-if="temporaryReturnList != ''">
|
|
<view class="shop-checkList-box" style="width: 69.5%;">
|
|
<text
|
|
style="width: 300rpx;display: inline-block;font-size: 21px;font-weight: bold;padding-left: 40rpx;">
|
|
规格
|
|
</text>
|
|
<text
|
|
style="font-size: 21px;color: #000;font-weight: bold;width: 110rpx;display: inline-block;text-align: right;">
|
|
库存
|
|
</text>
|
|
</view>
|
|
<view class="zuni-numbox">
|
|
<view @tap="minusReturnNum" class="zuni-numbox__minus zuni-numbox-btns"
|
|
style="background: #f5f5f5;">
|
|
<text class="zuni-numbox--text">-</text>
|
|
</view>
|
|
<input v-model="allChangeNum" @tap="obtainPrice($event,'zongReturnjishu')" disabled
|
|
class="zuni-numbox__value" type="number" />
|
|
<view @tap="plusReturnNum" 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 temporaryReturnList" :key="index">
|
|
<view @tap.stop="delReturnCarData(index)" style="margin-right: 2.5%;width: 7%;">
|
|
<uni-icons color="red" type="minus" size="26"></uni-icons>
|
|
</view>
|
|
<view class="shop-checkList-box">
|
|
<text style="width: 300rpx;display: inline-block;">{{item.name}}</text>
|
|
<text style="color:#777;font-size: 21px;color:red"
|
|
v-if="item.productNum == null || item.productNum === '' || item.productNum ==undefined ">
|
|
无库存
|
|
</text>
|
|
<text style="color:#777;font-size: 21px;" v-if="item.productNum != null">
|
|
{{item.productNum}}
|
|
</text>
|
|
</view>
|
|
<!-- <uni-number-box max='1000000' min="-10000" v-model="item.productCount"
|
|
@change="temporaryChange($event,item)" /> -->
|
|
<view class="zuni-numbox">
|
|
<view @tap="mapMinusReturnNum(index)" class="zuni-numbox__minus zuni-numbox-btns"
|
|
style="background: #f5f5f5;">
|
|
<text class="zuni-numbox--text">-</text>
|
|
</view>
|
|
<input v-model="item.productCount" @blur="numReturnChange($event,index)"
|
|
@tap="obtainPrice($event,'returndanjishu',index)" disabled
|
|
class="zuni-numbox__value" type="number" />
|
|
<view @tap="mapPlusReturnNum(index)" class="zuni-numbox__plus zuni-numbox-btns"
|
|
style="background: #f5f5f5;">
|
|
<text class="zuni-numbox--text">+</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="shop-popup-bottom" v-for="(item,index) in temporaryReturnList" :key="index">
|
|
<view class="shop-popup-bottom-left">
|
|
<text>{{zReturnNum}} 件</text>
|
|
<!-- <text>¥{{zPrice}}</text> -->
|
|
</view>
|
|
<view class="shop-popup-bottom-right">
|
|
<!-- 退货选好了 -->
|
|
<view class="bottom-btn" @tap.stop="temporaryReturnCheck">选好了</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<uni-popup ref="customPopup" background-color="#fff">
|
|
<view class="popup-content"
|
|
style="width:600rpx;height: auto;max-height: 644px;margin-bottom: 0;overflow: scroll;">
|
|
<view style="height: 80rpx;font-size: 21px;font-weight: bold;line-height: 80rpx;text-align: center;">
|
|
超出最大可退货数量
|
|
</view>
|
|
<view v-for="(item,index) in checkCanBuy" :key="index">
|
|
<view style="height: auto;line-height: 60rpx;border-bottom: 1px solid #eee;">
|
|
<view style="font-weight: bold;">货号:{{item.productSn}}规格:{{item.attributeList}}</view>
|
|
<view>总售出数:{{item.buyCountAll}} 总退回数:{{item.returnCountAll}} <text
|
|
style="color:red;">本次退货数:{{item.returnCountAllNew}}</text></view>
|
|
</view>
|
|
|
|
</view>
|
|
<view @tap="closeCustomPopup"
|
|
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="oneDataPopup" background-color="#fff" :is-mask-click="true" v-show="showTan">
|
|
<view class="type-popup" style="margin-bottom: 0;border-radius: 0;">
|
|
<view style="height: 80rpx;font-size: 21px;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>
|
|
|
|
<view class="mask-model" v-if="methodMask">
|
|
<view>实收金额计算方式</view>
|
|
<view>
|
|
{{methodText}}
|
|
</view>
|
|
</view>
|
|
<view class="mask-model" v-if="isVoice">貌似没有检测到您上次的语音录入信息,正在反复识别中...</view>
|
|
<u-keyboard ref="uKeyboard" @confirm='keyboardConfirm' @cancel="keyCancel" @close="keyCancel"
|
|
@change="valChange" @backspace="backspace" :overlay='true' :closeOnClickOverlay='true'
|
|
:defaultText="keyboardNum" mode="card" :show="showFu"></u-keyboard>
|
|
<u-keyboard ref="uKeyboard" @confirm='keyboardConfirm' @cancel="keyCancel" @close="keyCancel"
|
|
@change="valChange" @backspace="backspace" :overlay='true' :closeOnClickOverlay='true'
|
|
:defaultText="keyboardNum" mode="price" :show="showPrice"></u-keyboard>
|
|
|
|
<uni-popup ref="saomaType" background-color="#fff">
|
|
<view class="popup-pay-content">
|
|
<view class="popup-pay-title">
|
|
<text>选择开单方式</text>
|
|
</view>
|
|
<view class="popup-pay-container" @tap="checkSaomaType('0')">
|
|
<text style="display: inline-block">销售</text>
|
|
</view>
|
|
<view class="popup-pay-container" @tap="checkSaomaType('1')">
|
|
<text style="display: inline-block">退货</text>
|
|
</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" v-if="item.productPicture != ''">
|
|
<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>
|
|
<!-- 价格为零的提醒弹窗 -->
|
|
<uni-popup ref="zeroDialog" background-color="#fff" :is-mask-click="true">
|
|
<view class="type-popup"
|
|
style="width: 400px;margin-bottom: 0;border-radius: 10px;height: 350px;">
|
|
<view style="height: 60px;font-size: 21px;font-weight: bold;line-height: 60px;text-align: center;">
|
|
提示
|
|
</view>
|
|
<view style="font-size: 21px;line-height: 60px;text-align: center;padding: 0 27px 0;">
|
|
您的货号为“
|
|
<text v-for="(item,index) in zeroArr" :key="index"
|
|
style="padding-right: 20rpx;">{{item}}</text>”的商品售价为0,是否继续开单?
|
|
</view>
|
|
<view
|
|
style="width: 100%;height: 60px;line-height: 60px;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.zeroDialog.close()">取消</view>
|
|
<view style="width:50%;background: linear-gradient(90deg, #FF9797, #FFC1E0);"
|
|
@tap="showPrice1('zeroNo')">确认</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- 弹出分类选择 -->
|
|
<uni-popup ref="typePopup" background-color="#fff" :is-mask-click="true">
|
|
<view class="type-popup" style="margin-bottom: 0;width: 400px;height: auto;max-height: 500px;">
|
|
<view style="height: 50px;font-size: 21px;font-weight: bold;line-height: 50px;text-align: center;">
|
|
选择分类
|
|
</view>
|
|
<view style="position: absolute;bottom: 0;height: 80px;width: 100%;background: #fff;z-index: 99;">
|
|
<view @tap="toggle('addGateDialog')"
|
|
style="width: 95%;height: 60px;line-height: 60px;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: 400px;padding-bottom: 90rpx;">
|
|
<view v-for="(item,index) in indexList" :key="index" @tap="clickGategroy(item)"
|
|
style="height: 50px;font-size: 21px;width: 90%;line-height:50px;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: 21px;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>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
generateUUID
|
|
} from '@/utils/global.js'
|
|
import base from '@/utils/ossUploadFile/base64.js';
|
|
var plugin = requirePlugin("WechatSI")
|
|
let manager = plugin.getRecordRecognitionManager()
|
|
export default {
|
|
data() {
|
|
return {
|
|
isChangeShouldPay:false,
|
|
isChangeReturnPay:false,
|
|
isChangeRelPrice:false,
|
|
isChangePriceOk:false,
|
|
attrList: [],
|
|
zeroArr:[],
|
|
newProductId:'',
|
|
productPictures: [],
|
|
billCountPrice:true, //开单的时候是否再计算一次价格
|
|
oneData: {},
|
|
moreData: [],
|
|
voiceData: {},
|
|
showPrice: false,
|
|
swiperDotIndex: 0,
|
|
showFu: false,
|
|
attributeValue: [],
|
|
prefixRule: '',
|
|
numRule: '',
|
|
evalue: [],
|
|
lsprice: 0, //临时零售价
|
|
wholesalePrice: 0, // 临时显示批发价
|
|
price: 0, //总金额
|
|
relPrice: "", //实收金额
|
|
otherExpense: "", // 其他费用
|
|
keyboardNum: '',
|
|
priceMore: false,
|
|
isChangeHeight:false,
|
|
sellObj: {},
|
|
noPay: 0, //欠款
|
|
discountNum: 10, //整体折扣
|
|
priceCurrent: '',
|
|
voiceGetOneData: true,
|
|
goodsDetail: [],
|
|
goodsReturnDetail: [],
|
|
childrenId: '',
|
|
noticeData: ['您每发出一个包,使用拉包工和物流公司送货时,我们将从中拿出XX元,捐入快拾帮帮公益基金中,帮助那些贫困儿童!我们的付出将让世界充满爱!'],
|
|
columns: [],
|
|
colorData:[],
|
|
keyList: [],
|
|
index: '',
|
|
temporary: [],
|
|
oldCustomId:'',//旧的客户id,从选择客户页回来,判断是否切换了客户
|
|
temporaryList: [],
|
|
temporaryReturnList: [],
|
|
zReturnNum: 0,
|
|
zNum: 0,
|
|
isKaiDan:false,
|
|
checkCanBuy:[],
|
|
zPrice: 0,
|
|
priceOk: '', //已收金额
|
|
value: 0,
|
|
valuexsy: '',
|
|
sex: [{
|
|
text: '平台配送',
|
|
value: 0
|
|
}, {
|
|
text: '自送',
|
|
value: 1
|
|
}],
|
|
priceItems: [{
|
|
value: '0',
|
|
name: '零售价'
|
|
},
|
|
{
|
|
value: '1',
|
|
name: '批发价'
|
|
}
|
|
],
|
|
items: [{
|
|
value: '0',
|
|
name: '单品'
|
|
},
|
|
{
|
|
value: '1',
|
|
name: '整体'
|
|
}
|
|
],
|
|
logisticsType: [{
|
|
value: '0',
|
|
name: '物流'
|
|
},
|
|
|
|
{
|
|
value: '3',
|
|
name: '拼包'
|
|
},
|
|
{
|
|
value: '4',
|
|
name: '厢货'
|
|
},
|
|
{
|
|
value: '1',
|
|
name: '快递'
|
|
},
|
|
{
|
|
value: '2',
|
|
name: '自提'
|
|
},
|
|
{
|
|
value: '5',
|
|
name: '大巴'
|
|
}
|
|
],
|
|
discountType: '', //折扣类型
|
|
discountCurrent: "3",
|
|
isVoice: false,
|
|
showTan: false,
|
|
attrBuilt:'',
|
|
currentPopupIndex: 0,
|
|
voiceType:'new',
|
|
current: 0,
|
|
lunbocurrent: 4,
|
|
saomaotype:'0',
|
|
voiceText: ' ',
|
|
voiceText1:' ',
|
|
discCurrent: '', //折扣
|
|
logisticsCurrent: '', //物流
|
|
categoryList: '',
|
|
fenleiList: {},
|
|
payType: 1,
|
|
payTypeList: [{
|
|
value: 1,
|
|
text: "微信"
|
|
}, {
|
|
value: 0,
|
|
text: "现金"
|
|
}, {
|
|
value: 2,
|
|
text: "支付宝"
|
|
}, {
|
|
value: 3,
|
|
text: "银行卡"
|
|
}, {
|
|
value: 4,
|
|
text: "收款码"
|
|
}],
|
|
radioType: "2", //发货方式按钮选择
|
|
khName: [], //客户
|
|
gysName: [], //供应商
|
|
wlName: [], //物流公司/物流/发车
|
|
kdyName: [], //快递员
|
|
lbgName: [], //拉包工姓名
|
|
carList: new Map(), //添加商品页传回来的商品信息
|
|
xsyId: '',
|
|
shouldPay: 0,
|
|
single: '',
|
|
methodText: '',
|
|
methodMask: false,
|
|
returnPay: 0,
|
|
tanyishou: false,
|
|
tanyue: true,
|
|
tanxiaoshou: true,
|
|
khData: {},
|
|
totalAmount: 0,
|
|
returnTotalAmount: 0,
|
|
zhiqianqiankuan: 0,
|
|
qiankuandikou: 0,
|
|
xiaoshoudikou: 0,
|
|
yuedikou: 0,
|
|
leijiqiankuan: 0,
|
|
customPrice: '', //选择自定义金额
|
|
returnPrice: '',
|
|
remark: '',
|
|
pbAddress: '',
|
|
yanseList: new Map(),
|
|
chimaList: new Map(),
|
|
carList1: [],
|
|
specifications: '',
|
|
isPlusAndMinus: false,
|
|
radioType1: 0,
|
|
linshiPrice: 0,
|
|
snName: '',
|
|
shopId:uni.getStorageSync('shopId'),
|
|
saleDetailList: [],
|
|
clearMsg: '',
|
|
snList: [],
|
|
priceType: '',
|
|
multiple: 1,
|
|
productId: '',
|
|
productNum: 0,
|
|
historyList: {},
|
|
afterPrice: 0, //第二次选择商品的时候,先计算这个价格,实收金额= 已经存在的实收金额 + afterPrice
|
|
pageOldTemList: [],
|
|
pageOldTemReturnList: [],
|
|
indexList: [],
|
|
categoryText: '',
|
|
oldTemList: [],
|
|
oldTemReturnList: [],
|
|
goodsList: [],
|
|
goodsReturnList: [],
|
|
|
|
saleId: '',
|
|
newTemList: [],
|
|
newTemReturnList: [],
|
|
pecsList: [],
|
|
oneGoodsId: '',
|
|
dataObj: new Map(),
|
|
allChangeNum: 0,
|
|
recordState: false,
|
|
textareaValue:'',
|
|
currentAnchor: '',
|
|
temporaryNum: 0,
|
|
keyboard: '',
|
|
onePecsReturnNum:0,
|
|
keyboardIndex: '',
|
|
aiNotRecognition: '',
|
|
getMsg: '',
|
|
qrArr: [],
|
|
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,
|
|
}]
|
|
}],
|
|
}
|
|
},
|
|
onShow() {
|
|
uni.authorize({
|
|
scope: 'scope.writePhotosAlbum',
|
|
success() {
|
|
|
|
},
|
|
fail() {
|
|
this.tui.toast("您未授权,图片上传功能可能会出现错误")
|
|
}
|
|
})
|
|
let isTrue = false
|
|
this.xsyList();
|
|
this.initRecord();
|
|
this.analysisQrCode()
|
|
this.getShopCategory()
|
|
this.getSnList()
|
|
this.recordState = false
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
let that = this;
|
|
if (uni.getStorageSync('hangOrder') == true) {
|
|
// this.carList.clear()
|
|
this.remark = ''
|
|
this.xsyId = ''
|
|
this.khName = []
|
|
this.saleId = ''
|
|
|
|
}
|
|
if (this.khName == '' && uni.getStorageSync('khName') == '') {
|
|
|
|
this.getkhName('散客')
|
|
} else {
|
|
this.khName = uni.getStorageSync('khName') ? JSON.parse(uni.getStorageSync('khName')) : JSON.parse(JSON
|
|
.stringify(this.khName))
|
|
this.getkhName(this.khName.id)
|
|
}
|
|
|
|
if (this.khName != '') {
|
|
if(this.oldCustomId != this.khName.id){
|
|
isTrue = true
|
|
}
|
|
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
|
|
}
|
|
|
|
if(this.khName.categoryId != null && this.khName.categoryId != ''){
|
|
this.carList.forEach(function(value, key) {
|
|
if(value.productId != '' && value.productId != null){
|
|
if(value.isChangePrice == undefined){
|
|
value.isChangePrice = false
|
|
}
|
|
if(value.isChangeReturnPrice == undefined){
|
|
value.isChangeReturnPrice = false
|
|
}
|
|
if(value.customerCategoryList != null){
|
|
let truePrice = 0
|
|
let ischeckCustom = false
|
|
let ischeckCustomPrice = false
|
|
for(let i=0;i<value.customerCategoryList.length;i++){
|
|
if(Number(value.unitPrice) == Number(value.customerCategoryList[i].categoryPrice)){
|
|
ischeckCustom = true
|
|
}
|
|
if(that.khName.categoryId == value.customerCategoryList[i].categoryId && value.customerCategoryList[i].categoryPrice != ''){
|
|
truePrice = value.customerCategoryList[i].categoryPrice
|
|
ischeckCustomPrice = true
|
|
}
|
|
/* if(that.khName.categoryId == value.customerCategoryList[i].categoryId && value.customerCategoryList[i].categoryPrice == ''){
|
|
uni.showToast({title:value.productSn+'商品没有维护"'+value.customerCategoryList[i].categoryName+'"价格',mask:true,duration:2000});
|
|
} */
|
|
}
|
|
if(ischeckCustomPrice && (Number(value.unitPrice) == Number(value.wholesalePrice) || Number(value.unitPrice) == Number(value.lsprice) || ischeckCustom) && !value.isChangePrice && !uni.getStorageSync('hangOrder')){
|
|
value.unitPrice = truePrice
|
|
value.discountAmount = truePrice
|
|
}
|
|
if(ischeckCustomPrice == false && !value.isChangePrice && !uni.getStorageSync('hangOrder')){
|
|
value.unitPrice = value.wholesalePrice
|
|
value.discountAmount = value.wholesalePrice
|
|
}
|
|
if(ischeckCustomPrice && (Number(value.returnPrice) == Number(value.wholesalePrice) || Number(value.unitPrice) == Number(value.lsprice) || ischeckCustom) && !value.isChangeReturnPrice && !uni.getStorageSync('hangOrder')){
|
|
value.returnPrice = truePrice
|
|
}
|
|
if(ischeckCustomPrice == false && !value.isChangeReturnPrice && !uni.getStorageSync('hangOrder')){
|
|
value.returnPrice = value.wholesalePrice
|
|
}
|
|
}else{
|
|
if(!value.isChangeReturnPrice){
|
|
value.returnPrice = value.wholesalePrice
|
|
}
|
|
if(!value.isChangePrice){
|
|
value.discountAmount = value.wholesalePrice
|
|
value.unitPrice = value.wholesalePrice
|
|
}else{
|
|
value.discountAmount = value.unitPrice
|
|
}
|
|
|
|
}
|
|
}
|
|
})
|
|
|
|
}else{
|
|
this.carList.forEach(function(value, key) {
|
|
if(value.isChangePrice == undefined){
|
|
value.isChangePrice = false
|
|
}
|
|
if(value.isChangeReturnPrice == undefined){
|
|
value.isChangeReturnPrice = false
|
|
}
|
|
let cusPrice = false
|
|
let cusReturnPrice = false
|
|
if(value.customerCategoryList != null){
|
|
for(let j=0;j<value.customerCategoryList.length;j++){
|
|
if(Number(value.discountAmount) == Number(value.customerCategoryList[j].categoryPrice)){
|
|
cusPrice = true
|
|
}
|
|
if(Number(value.returnPrice) == Number(value.customerCategoryList[j].categoryPrice)){
|
|
cusReturnPrice = true
|
|
}
|
|
}
|
|
}
|
|
if(!cusPrice && (Number(value.discountAmount) != Number(value.wholesalePrice) && Number(value.discountAmount) != Number(value.lsprice))){
|
|
value.isChangePrice = true
|
|
}
|
|
if(!cusReturnPrice && (Number(value.discountAmount) != Number(value.wholesalePrice) && Number(value.discountAmount) != Number(value.lsprice))){
|
|
value.isChangeReturnPrice = true
|
|
}
|
|
if(value.isChangePrice){
|
|
value.discountAmount = value.unitPrice
|
|
}else{
|
|
value.discountAmount = value.wholesalePrice
|
|
value.unitPrice = value.wholesalePrice
|
|
}
|
|
if(!value.isChangeReturnPrice){
|
|
value.returnPrice = value.wholesalePrice
|
|
}
|
|
})
|
|
|
|
}
|
|
}
|
|
this.$forceUpdate()
|
|
this.gysName = JSON.parse(JSON.stringify(this.gysName))
|
|
this.wlName = JSON.parse(JSON.stringify(this.wlName))
|
|
this.kdyName = JSON.parse(JSON.stringify(this.kdyName))
|
|
this.lbgName = JSON.parse(JSON.stringify(this.lbgName))
|
|
this.sex = [{
|
|
text: '平台配送',
|
|
value: 0
|
|
}, {
|
|
text: '自送',
|
|
value: 1
|
|
}]
|
|
//discountAll挂单页传过来的折扣值
|
|
if(uni.getStorageSync('hangOrder')){
|
|
this.discountNum = ''
|
|
}
|
|
if(uni.getStorageSync('discountAll') != ''){
|
|
this.discountNum = uni.getStorageSync('discountAll') == null ?10:uni.getStorageSync('discountAll')
|
|
if(this.discountNum != 10){
|
|
this.discountType = "1"
|
|
this.discountCurrent = "1"
|
|
}
|
|
}
|
|
if (uni.getStorageSync('carList1') != '') {
|
|
isTrue = true
|
|
this.carList.clear()
|
|
|
|
this.carList1 = JSON.parse(uni.getStorageSync('carList1'))
|
|
for(let i = 0;i<this.carList1.length;i++){
|
|
if(this.carList1[i].isChangePrice == undefined){
|
|
this.carList1[i].isChangePrice = false
|
|
}
|
|
if(this.carList1[i].isChangeReturnPrice == undefined){
|
|
this.carList1[i].isChangeReturnPrice = false
|
|
}
|
|
if(this.carList1[i].customerCategoryRule != null){
|
|
let ischeckCustom = false
|
|
let truePrice = 0
|
|
let ischeckCustomPrice = false
|
|
for(let j=0;j<this.carList1[i].customerCategoryRule.length;j++){
|
|
if(Number(this.carList1[i].unitPrice) == Number(this.carList1[i].customerCategoryRule[j].categoryPrice)){
|
|
ischeckCustom = true
|
|
}
|
|
if(that.khName.categoryId == this.carList1[i].customerCategoryRule[j].categoryId && this.carList1[i].customerCategoryRule[j].categoryPrice != ''){
|
|
truePrice = this.carList1[i].customerCategoryRule[j].categoryPrice
|
|
ischeckCustomPrice = true
|
|
}
|
|
}
|
|
if(ischeckCustomPrice && (Number(this.carList1[i].unitPrice) == Number(this.carList1[i].wholesalePrice) || Number(this.carList1[i].unitPrice) == Number(this.carList1[i].lsprice) || ischeckCustom) && !this.carList1[i].isChangePrice && !uni.getStorageSync('hangOrder')){
|
|
this.carList1[i].unitPrice = truePrice
|
|
this.carList1[i].discountAmount = truePrice
|
|
}
|
|
if(ischeckCustomPrice && (Number(this.carList1[i].returnPrice) == Number(this.carList1[i].wholesalePrice) || Number(this.carList1[i].unitPrice) == Number(this.carList1[i].lsprice) || ischeckCustom) && !this.carList1[i].isChangeReturnPrice && !uni.getStorageSync('hangOrder')){
|
|
this.carList1[i].returnPrice = truePrice
|
|
}
|
|
}
|
|
}
|
|
// this.khName = uni.getStorageSync('khName') ? JSON.parse(uni.getStorageSync('khName')) : ''
|
|
if(this.carList1.length>0){
|
|
this.remark = this.carList1[0].remark
|
|
this.saleId = this.carList1[0].saleId
|
|
this.xsyId = this.carList1[0].xsyId
|
|
this.createByName = this.carList1[0].createByName
|
|
}
|
|
|
|
} else {
|
|
if (this.carList1 != '') {
|
|
isTrue = true
|
|
}
|
|
this.carList1 = this.carList1
|
|
}
|
|
// const uuid = generateUUID();
|
|
this.handleData(isTrue)
|
|
},
|
|
filters: {
|
|
sliceMsg(val) {
|
|
var name = ''
|
|
if (typeof(val) == 'string') {
|
|
let newObj = JSON.parse(val)
|
|
for (let as in newObj) {
|
|
name += newObj[as] + ' | '
|
|
}
|
|
}
|
|
return name;
|
|
}
|
|
},
|
|
onLoad(option) {
|
|
this.getDefaultCategory()
|
|
this.getMonth()
|
|
},
|
|
methods: {
|
|
changeShowBtn(index,index1){
|
|
|
|
if(this.carList.get(index).stockLogList.get(index1).isShowBtn == undefined || this.carList.get(index).stockLogList.get(index1).isShowBtn == false){
|
|
this.carList.get(index).stockLogList.get(index1).isShowBtn = true
|
|
}else{
|
|
this.carList.get(index).stockLogList.get(index1).isShowBtn = false
|
|
}
|
|
this.$forceUpdate()
|
|
},
|
|
changeMore1(){
|
|
this.priceMore = !this.priceMore
|
|
},
|
|
clickReturnDiaLog(id){
|
|
this.oneGoodsId = id
|
|
this.$refs.returnDialog.open('bottom')
|
|
},
|
|
checkSaomaType(type){
|
|
let that = this;
|
|
this.saomaotype = type
|
|
this.$refs.saomaType.close()
|
|
this.scanCodeAdd()
|
|
},
|
|
onePecsReturnToCarList(){
|
|
let data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
name: "均色 | 均码",
|
|
productCount: Math.abs(Number(this.onePecsReturnNum)) * -1,
|
|
productNum: this.carList.get(this.oneGoodsId).stockLogList.get('{"颜色":"均色","尺码":"均码"}').productNum
|
|
}
|
|
this.carList.get(this.oneGoodsId).returnList.set(data.attributeList,data)
|
|
this.$refs.returnDialog.close()
|
|
this.$forceUpdate()
|
|
this.carList.get(this.oneGoodsId).returnCount = Number(this.onePecsReturnNum)
|
|
},
|
|
//店铺规格库
|
|
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) => {})
|
|
},
|
|
keyboardConfirm() {
|
|
if (this.keyboardNum != '') {
|
|
if (this.keyboard == 'goodsNum') {
|
|
this.goodsNum = Number(this.keyboardNum)
|
|
} else if (this.keyboard == 'zongjishu') {
|
|
this.allChange(Number(this.keyboardNum))
|
|
}else if (this.keyboard == 'zongReturnjishu') {
|
|
if(this.keyboardNum > 0){
|
|
this.tui.toast('退货数量不能为正数')
|
|
return
|
|
}else{
|
|
this.allReturnChange(Number(this.keyboardNum))
|
|
}
|
|
|
|
} else if (this.keyboard == 'danjishu') {
|
|
this.numChange(Number(this.keyboardNum), this.keyboardIndex)
|
|
}else if (this.keyboard == 'returndanjishu') {
|
|
this.numReturnChange(Number(this.keyboardNum), this.keyboardIndex)
|
|
} else if (this.keyboard == 'mapdanjishu') {
|
|
this.mapnumChange(Number(this.keyboardNum), this.keyboardIndex[0], this.keyboardIndex[1])
|
|
}else if (this.keyboard == 'returnmapdanjishu') {
|
|
if(Number(this.keyboardNum) > 0){
|
|
this.tui.toast('退货栏输入金额不能为正数')
|
|
}else{
|
|
this.mapnumReturnChange(Number(this.keyboardNum), this.keyboardIndex[0], this.keyboardIndex[1])
|
|
}
|
|
} else if (this.keyboard == 'danjia') {
|
|
if(this.newProductId !=''){
|
|
this.keyboardIndex = this.newProductId
|
|
}
|
|
this.clickCollapse(Number(this.keyboardNum), this.keyboardIndex)
|
|
} else if (this.keyboard == 'priceOk') {
|
|
if(this.priceOk == Number(this.keyboardNum)){
|
|
this.isChangePriceOk = false
|
|
}else{
|
|
this.isChangePriceOk = true
|
|
}
|
|
this.changePrice(Number(this.keyboardNum))
|
|
} else if (this.keyboard == 'relPrice') {
|
|
if(this.relPrice == Number(this.keyboardNum)){
|
|
this.isChangeRelPrice = false
|
|
this.isChangePriceOk = false
|
|
}else{
|
|
this.isChangeRelPrice = true
|
|
this.isChangePriceOk = true
|
|
}
|
|
this.changessPrice(Number(this.keyboardNum))
|
|
}
|
|
}
|
|
this.showFu = false
|
|
this.showPrice = false
|
|
this.keyboardNum = ''
|
|
},
|
|
keyCancel() {
|
|
this.showFu = false
|
|
this.showPrice = false
|
|
this.keyboardNum = ''
|
|
},
|
|
// 按键被点击(点击退格键不会触发此事件)
|
|
valChange(val) {
|
|
this.keyboardNum += val
|
|
if (this.keyboard == 'goodsNum') {
|
|
this.goodsNum = this.keyboardNum
|
|
}
|
|
},
|
|
// 退格键被点击
|
|
backspace(val) {
|
|
this.keyboardNum = val
|
|
this.goodsNum = val
|
|
},
|
|
yuyinChange() {
|
|
this.isVoice = false
|
|
},
|
|
//正则匹配处理“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;
|
|
},
|
|
//打印小票二维码,分割二维码字符串
|
|
analysisQrCode() {
|
|
let qrCode = uni.getStorageSync('shopIcon')
|
|
if (qrCode != '') {
|
|
let data = qrCode.split(',')
|
|
for (let i = 0; i < data.length; i++) {
|
|
var weixin = data[i].indexOf("微信");
|
|
var dianpu = data[i].indexOf("店铺");
|
|
var zifubao = data[i].indexOf("支付");
|
|
var yinlian = data[i].indexOf("收款");
|
|
if (dianpu != -1) {
|
|
var result = data[i].substring(dianpu + 2);
|
|
let obj = {
|
|
name: '店铺微信',
|
|
path: result,
|
|
level: "M"
|
|
}
|
|
this.qrArr.push(obj)
|
|
}
|
|
if (weixin != -1) {
|
|
var result = data[i].substring(weixin + 2);
|
|
let obj = {
|
|
name: '微信收款码',
|
|
path: result,
|
|
level: "M"
|
|
}
|
|
this.qrArr.push(obj)
|
|
}
|
|
if (zifubao != -1) {
|
|
var result = data[i].substring(zifubao + 2);
|
|
let obj = {
|
|
name: '支付宝收款码',
|
|
path: result,
|
|
level: "Q"
|
|
}
|
|
this.qrArr.push(obj)
|
|
}
|
|
if (yinlian != -1) {
|
|
var result = data[i].substring(yinlian + 2);
|
|
let obj = {
|
|
name: '银行收款码',
|
|
path: result,
|
|
level: "M"
|
|
}
|
|
this.qrArr.push(obj)
|
|
}
|
|
}
|
|
}
|
|
},
|
|
removePunctuationAndSpaces(str) {
|
|
const regex = /[\u3002\uff0c\uff1a\uFF0E\u3001\s,:;]/g;
|
|
return str.replace(regex, '');
|
|
},
|
|
//查询货号的后面第一个中文字符是不是“数量”,是返回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: 'wholesalePrice',
|
|
regex: /,单价:(.*?),/
|
|
},
|
|
{
|
|
name: 'wholesalePrice',
|
|
regex: /,单价:(.*?)。/
|
|
},
|
|
{
|
|
name: 'productName',
|
|
regex: /,名称:(.*?),/
|
|
},
|
|
{
|
|
name: 'productName',
|
|
regex: /,名称:(.*?)。/
|
|
},
|
|
{
|
|
name: 'wholesalePrice1',
|
|
regex: /,批发价:(.*?),/
|
|
},
|
|
{
|
|
name: 'wholesalePrice1',
|
|
regex: /,批发价:(.*?)。/
|
|
},
|
|
{
|
|
name: 'productCount1',
|
|
regex: /,退:(.*?),/
|
|
},
|
|
{
|
|
name: 'productCount1',
|
|
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.productCount1 && info.productCount1.indexOf(',') != -1) {
|
|
info.productCount = '-'+info.productCount1.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.wholesalePrice1 && info.wholesalePrice1.indexOf(',') != -1) {
|
|
info.wholesalePrice1 = info.wholesalePrice1.split(',')[0]
|
|
}
|
|
return info;
|
|
},
|
|
maskClick() {
|
|
|
|
},
|
|
handleData(isTrue) {
|
|
let that = this;
|
|
|
|
for (let i = 0; i < this.carList1.length; i++) {
|
|
if(this.carList1[i].discount != 10 && this.carList1[i].discount != undefined){
|
|
this.discountType = "0"
|
|
this.discountCurrent = "0"
|
|
}
|
|
if (this.carList1[i].saleDetailQueryDTO) {
|
|
let isChangePrice = false
|
|
let isChangeReturnPrice = false
|
|
if (this.carList.size == 0) { //当前页没有数据
|
|
let obj = {
|
|
attrId: this.carList1[i].attrId,
|
|
purchasePrice: this.carList1[i].purchasePrice, //采购价
|
|
price: 0, //总价
|
|
buyCount:this.carList1[i].buyCount,
|
|
isChangePrice:isChangePrice,
|
|
isChangeReturnPrice:isChangeReturnPrice,
|
|
discount: this.carList1[i].discount ? this.carList1[i].discount:10, //dan品折扣
|
|
customerCategoryList:this.carList1[i].customerCategoryRule,
|
|
categoryId: this.carList1[i].categoryId,
|
|
unitPrice: this.carList1[i].unitPrice || 0, //单价
|
|
discountAmount: this.carList1[i].discountAmount>0? this.carList1[i].discountAmount:( this.carList1[i].wholesalePrice || 0), //折后价
|
|
returnPrice: this.carList1[i].returnPrice ? this.carList1[i].returnPrice : this
|
|
.carList1[i].wholesalePrice || 0,
|
|
disNoAmount: 0, //折前价,用于计算整体折扣
|
|
wholesalePrice: this.carList1[i].wholesalePrice, //批发价
|
|
lsprice: this.carList1[i].lsprice, //零售价
|
|
productCount: 0, //总数量
|
|
returnCount: 0, //退货数量
|
|
productId: this.carList1[i].id,
|
|
productName: this.carList1[i].productName,
|
|
productPicture: this.carList1[i].productPicture,
|
|
productSn: this.carList1[i].productSn,
|
|
stockLogList: new Map(),
|
|
returnList: new Map(),
|
|
returnList1: [],
|
|
stockLogList1: [],
|
|
supplierName: this.carList1[i].supplierName //供应商
|
|
}
|
|
let cusPrice = false
|
|
let cusReturnPrice = false
|
|
if(obj.customerCategoryList != null){
|
|
for(let j=0;j<obj.customerCategoryList.length;j++){
|
|
if(Number(obj.discountAmount) == Number(obj.customerCategoryList[j].categoryPrice)){
|
|
cusPrice = true
|
|
}
|
|
if(Number(obj.returnPrice) == Number(obj.customerCategoryList[j].categoryPrice)){
|
|
cusReturnPrice = true
|
|
}
|
|
}
|
|
}
|
|
if(!cusPrice && (Number(obj.discountAmount) != Number(obj.wholesalePrice) && Number(obj.discountAmount) != Number(obj.lsprice))){
|
|
obj.isChangePrice = true
|
|
}
|
|
if(!cusReturnPrice && obj.returnPrice != undefined && (Number(obj.discountAmount) != Number(obj.wholesalePrice) && Number(obj.discountAmount) != Number(obj.lsprice))){
|
|
obj.isChangeReturnPrice = true
|
|
}
|
|
if(this.khName.categoryId != null && this.khName.categoryId != ''){
|
|
if(obj.customerCategoryList != null && obj.customerCategoryList != ''){
|
|
for(let i=0;i<obj.customerCategoryList.length;i++){
|
|
|
|
if(this.khName.categoryId == obj.customerCategoryList[i].categoryId){
|
|
if(obj.customerCategoryList[i].categoryPrice != '' && !uni.getStorageSync('hangOrder')){
|
|
if(obj.unitPrice == obj.wholesalePrice){
|
|
obj.discountAmount = obj.customerCategoryList[i].categoryPrice
|
|
obj.unitPrice = obj.customerCategoryList[i].categoryPrice
|
|
}
|
|
if(obj.returnPrice == obj.wholesalePrice){
|
|
obj.returnPrice = obj.customerCategoryList[i].categoryPrice
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
if(!uni.getStorageSync('hangOrder')){
|
|
obj.discountAmount = obj.unitPrice
|
|
}
|
|
}
|
|
|
|
}else{
|
|
if(!uni.getStorageSync('hangOrder')){
|
|
obj.discountAmount = obj.unitPrice
|
|
}
|
|
}
|
|
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 != undefined ? this
|
|
.carList1[i].saleDetailQueryDTO[m].productNum : this.carList1[i]
|
|
.saleDetailQueryDTO[m].stockCount
|
|
}
|
|
|
|
|
|
if (this.carList1[i].saleDetailQueryDTO[m].productCount < 0) { //退货数量
|
|
obj.returnCount += Math.abs(this.carList1[i].saleDetailQueryDTO[m].productCount)
|
|
obj.returnList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
|
|
} else {
|
|
obj.productCount += Number(this.carList1[i].saleDetailQueryDTO[m].productCount)
|
|
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
|
|
}
|
|
|
|
}
|
|
this.carList.set(this.carList1[i].id, obj)
|
|
} else { //当前页有数据
|
|
if (this.carList.has(this.carList1[i].id) == true) { //商品相同
|
|
let cusReturnPrice1 = false
|
|
if(this.carList1[i].customerCategoryList != null){
|
|
for(let j=0;j<this.carList1[i].customerCategoryList.length;j++){
|
|
if(Number(this.carList1[i].returnPrice) == Number(this.carList1[i].customerCategoryList[j].categoryPrice)){
|
|
cusReturnPrice1 = true
|
|
}
|
|
}
|
|
}
|
|
if(!cusReturnPrice1 && this.carList1[i].returnPrice != undefined && (Number(this.carList1[i].returnPrice) != Number(this.carList1[i].wholesalePrice) && Number(this.carList1[i].returnPrice) != Number(this.carList1[i].lsprice))){
|
|
this.carList.get(this.carList1[i].id).isChangeReturnPrice = true
|
|
this.carList.get(this.carList1[i].id).returnPrice = this.carList1[i].returnPrice
|
|
}
|
|
/* if ((this.carList.get(this.carList1[i].id).returnPrice == 0|| this.carList.get(this.carList1[i].id).returnPrice != this.carList1[i].returnPrice || this.carList.get(this.carList1[i].id).returnPrice == ''||this.carList.get(this.carList1[i].id).returnPrice == null) && !this.carList.get(this.carList1[i].id).isChangeReturnPrice) {
|
|
this.carList.get(this.carList1[i].id).returnPrice = this.carList1[i].returnPrice
|
|
} */
|
|
|
|
this.carList.get(this.carList1[i].id).productCount = 0
|
|
this.carList.get(this.carList1[i].id).returnCount = 0
|
|
if(this.carList1[i].saleDetailQueryDTO.length == 0 && uni.getStorageSync('KuCunBack') && that.carList.get(this.carList1[i].id).returnList.size== 0){
|
|
that.carList.delete(this.carList1[i].id)
|
|
}
|
|
if(uni.getStorageSync('KuCunBack')){
|
|
that.carList.get(this.carList1[i].id).stockLogList = new Map()
|
|
|
|
if(this.carList1[i].returnList == '' || this.carList1[i].returnList == undefined){
|
|
this.carList.get(this.carList1[i].id).returnList = new Map()
|
|
}else{
|
|
this.carList.get(this.carList1[i].id).returnList = new Map(JSON.parse(decodeURIComponent(this.carList1[i].returnList)))
|
|
}
|
|
}
|
|
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) { //规格相同
|
|
if(uni.getStorageSync('hangOrder')){
|
|
var data1 = {
|
|
productCount: Number(this.carList1[i].saleDetailQueryDTO[m].productCount),
|
|
name: this.carList1[i].saleDetailQueryDTO[m].name,
|
|
productNum: this.carList1[i].saleDetailQueryDTO[m].productNum !=
|
|
undefined ? this.carList1[i].saleDetailQueryDTO[m].productNum : this
|
|
.carList1[i].saleDetailQueryDTO[m].stockCount
|
|
}
|
|
if(data1.productCount >= 0){
|
|
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i]
|
|
.saleDetailQueryDTO[m].attributeList, data1)
|
|
}else if(data1.productCount < 0){
|
|
this.carList.get(this.carList1[i].id).returnList.set(this.carList1[i]
|
|
.saleDetailQueryDTO[m].attributeList, data1)
|
|
}
|
|
}else{
|
|
if(uni.getStorageSync('KuCunBack')){
|
|
var data1 = {
|
|
productCount: Number(this.carList1[i].saleDetailQueryDTO[m].productCount),
|
|
name: this.carList1[i].saleDetailQueryDTO[m].name,
|
|
productNum: this.carList1[i].saleDetailQueryDTO[m].productNum !=
|
|
undefined ? this.carList1[i].saleDetailQueryDTO[m].productNum : this
|
|
.carList1[i].saleDetailQueryDTO[m].stockCount
|
|
}
|
|
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i]
|
|
.saleDetailQueryDTO[m].attributeList, data1)
|
|
}else{
|
|
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 !=
|
|
undefined ? this.carList1[i].saleDetailQueryDTO[m].productNum : this
|
|
.carList1[i].saleDetailQueryDTO[m].stockCount
|
|
}
|
|
if(data1.productCount >= 0){
|
|
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i]
|
|
.saleDetailQueryDTO[m].attributeList, data1)
|
|
}else if(data1.productCount < 0){
|
|
this.carList.get(this.carList1[i].id).returnList.set(this.carList1[i]
|
|
.saleDetailQueryDTO[m].attributeList, data1)
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// if(data1.productCount >= 0){
|
|
// this.carList.get(this.carList1[i].id).productCount += data1.productCount
|
|
// }else if(data1.productCount < 0){
|
|
// this.carList.get(this.carList1[i].id).returnCount += Math.abs(data1.productCount)
|
|
// }
|
|
|
|
|
|
} 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 !=
|
|
undefined ? this.carList1[i].saleDetailQueryDTO[m].productNum : this
|
|
.carList1[i].saleDetailQueryDTO[m].stockCount
|
|
}
|
|
// if(data1.productCount >= 0){
|
|
// this.carList.get(this.carList1[i].id).productCount += data1.productCount
|
|
// }else if(data1.productCount < 0){
|
|
// this.carList.get(this.carList1[i].id).returnCount += Math.abs(data1.productCount)
|
|
// }
|
|
if(data1.productCount >= 0){
|
|
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i]
|
|
.saleDetailQueryDTO[m].attributeList, data1)
|
|
}else if(data1.productCount < 0){
|
|
this.carList.get(this.carList1[i].id).returnList.set(this.carList1[i]
|
|
.saleDetailQueryDTO[m].attributeList, data1)
|
|
}
|
|
|
|
}
|
|
}
|
|
this.carList.get(this.carList1[i].id).returnList.forEach(function(value, key) {
|
|
if(value.productCount < 0){
|
|
that.carList.get(that.carList1[i].id).returnCount += Math.abs(value.productCount)
|
|
}
|
|
|
|
})
|
|
this.carList.get(this.carList1[i].id).stockLogList.forEach(function(value, key) {
|
|
if(value.productCount < 0){
|
|
that.carList.get(that.carList1[i].id).returnCount += Math.abs(value.productCount)
|
|
}else{
|
|
that.carList.get(that.carList1[i].id).productCount += value.productCount
|
|
}
|
|
})
|
|
} else { //商品不同
|
|
let isChangePrice = false
|
|
let isChangeReturnPrice = false
|
|
|
|
let obj = {
|
|
attrId: this.carList1[i].attrId,
|
|
purchasePrice: this.carList1[i].purchasePrice, //采购价
|
|
price: 0,
|
|
isChangeReturnPrice:isChangeReturnPrice,
|
|
isChangePrice:isChangePrice,
|
|
buyCount:this.carList1[i].buyCount,
|
|
discount: this.carList1[i].discount ? this.carList1[i].discount:10, //折扣
|
|
categoryId: this.carList1[i].categoryId,
|
|
customerCategoryList:this.carList1[i].customerCategoryRule,
|
|
discountAmount: this.carList1[i].discountAmount>0? this.carList1[i].discountAmount:( this.carList1[i].wholesalePrice || 0),
|
|
returnPrice: this.carList1[i].returnPrice ? this.carList1[i].returnPrice : this
|
|
.carList1[i].wholesalePrice || 0,
|
|
disNoAmount: 0, //折前价,用于计算整体折扣
|
|
unitPrice: this.carList1[i].unitPrice || 0, //单价
|
|
wholesalePrice: this.carList1[i].wholesalePrice, //批发价
|
|
lsprice: this.carList1[i].lsprice, //零售价
|
|
productCount: 0,
|
|
returnCount: 0,
|
|
productId: this.carList1[i].id,
|
|
productName: this.carList1[i].productName,
|
|
productPicture: this.carList1[i].productPicture,
|
|
stockLogList: new Map(),
|
|
returnList: new Map(),
|
|
returnList1: [],
|
|
stockLogList1: [],
|
|
productSn: this.carList1[i].productSn,
|
|
supplierName: this.carList1[i].supplierName
|
|
}
|
|
let cusPrice = false
|
|
let cusReturnPrice = false
|
|
if(obj.customerCategoryList != null){
|
|
for(let j=0;j<obj.customerCategoryList.length;j++){
|
|
if(Number(obj.discountAmount) == Number(obj.customerCategoryList[j].categoryPrice)){
|
|
cusPrice = true
|
|
}
|
|
if(Number(obj.returnPrice) == Number(obj.customerCategoryList[j].categoryPrice)){
|
|
cusReturnPrice = true
|
|
}
|
|
}
|
|
}
|
|
if(!cusPrice && (Number(obj.discountAmount) != Number(obj.wholesalePrice) && Number(obj.discountAmount) != Number(obj.lsprice))){
|
|
obj.isChangePrice = true
|
|
}
|
|
if(!cusReturnPrice && (Number(obj.discountAmount) != Number(obj.wholesalePrice) && Number(obj.discountAmount) != Number(obj.lsprice))){
|
|
obj.isChangeReturnPrice = true
|
|
}
|
|
if(this.khName.categoryId != null && this.khName.categoryId != ''){
|
|
if(obj.customerCategoryList != null && obj.customerCategoryList != ''){
|
|
for(let i=0;i<obj.customerCategoryList.length;i++){
|
|
if(this.khName.categoryId == obj.customerCategoryList[i].categoryId){
|
|
if(obj.customerCategoryList[i].categoryPrice != '' && !uni.getStorageSync('hangOrder')){
|
|
if(obj.unitPrice == obj.wholesalePrice){
|
|
obj.discountAmount = obj.customerCategoryList[i].categoryPrice
|
|
obj.unitPrice = obj.customerCategoryList[i].categoryPrice
|
|
}
|
|
if(obj.returnPrice == obj.wholesalePrice){
|
|
obj.returnPrice = obj.customerCategoryList[i].categoryPrice
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
if(!uni.getStorageSync('hangOrder')){
|
|
obj.discountAmount = obj.unitPrice
|
|
}
|
|
}
|
|
|
|
}else{
|
|
if(!uni.getStorageSync('hangOrder')){
|
|
obj.discountAmount = obj.unitPrice
|
|
}
|
|
}
|
|
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
|
|
// obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList1[i]
|
|
// .saleDetailQueryDTO[m].productCount)
|
|
// obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
|
|
var data1 = {
|
|
productCount: Number(this.carList1[i].saleDetailQueryDTO[m].productCount),
|
|
name: this.carList1[i].saleDetailQueryDTO[m].name,
|
|
productNum: this.carList1[i].saleDetailQueryDTO[m].productNum != undefined ?
|
|
this.carList1[i].saleDetailQueryDTO[m].productNum : this.carList1[i]
|
|
.saleDetailQueryDTO[m].stockCount
|
|
}
|
|
|
|
|
|
obj.name = this.carList1[i].saleDetailQueryDTO[m].name
|
|
if (this.carList1[i].saleDetailQueryDTO[m].productCount < 0) { //退货数量
|
|
obj.returnCount += Math.abs(this.carList1[i].saleDetailQueryDTO[m].productCount)
|
|
obj.returnList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
|
|
} else {
|
|
obj.productCount += Number(this.carList1[i].saleDetailQueryDTO[m].productCount)
|
|
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
|
|
}
|
|
}
|
|
this.carList.set(this.carList1[i].id, obj)
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
this.carList1 = []
|
|
this.carList.forEach(function(value, key) {
|
|
if(value.isChangePrice == undefined){
|
|
value.isChangePrice = false
|
|
}
|
|
if(value.isChangeReturnPrice == undefined){
|
|
value.isChangeReturnPrice = false
|
|
}
|
|
if (that.priceType == '') {
|
|
if(value.returnPrice =='' || value.returnPrice ==null || value.returnPrice ==0){
|
|
value.returnPrice = !value.isChangeReturnPrice ? value.returnPrice : value.wholesalePrice
|
|
}
|
|
if(value.unitPrice){
|
|
value.unitPrice = value.unitPrice
|
|
}else{
|
|
value.unitPrice = value.discountAmount > 0 ? value.discountAmount : value.wholesalePrice
|
|
}
|
|
|
|
} else if (that.priceType == 0) { //零售
|
|
value.unitPrice = !value.isChangePrice ? value.lsprice : value.unitPrice
|
|
value.discountAmount = !value.isChangePrice ? value.lsprice : value.unitPrice
|
|
value.returnPrice = !value.isChangeReturnPrice ? value.lsprice : value.unitPrice
|
|
} else if (that.priceType == 1) { //批发
|
|
value.unitPrice = !value.isChangePrice ? value.wholesalePrice : value.unitPrice
|
|
value.discountAmount = !value.isChangePrice ? value.wholesalePrice : value.unitPrice
|
|
value.returnPrice = !value.isChangeReturnPrice ? value.wholesalePrice : value.unitPrice
|
|
}
|
|
if(!uni.getStorageSync('hangOrder')){
|
|
if (that.discountType == 1) { //整体折扣
|
|
value.discountAmount = value.discountAmount * that.discountNum / 10
|
|
value.discountAmount = Number(value.discountAmount.toFixed(2))
|
|
value.price = value.unitPrice * 10000 * Number(value.productCount) * that.discountNum / 10 / 10000
|
|
}else if(that.discountType == 0){
|
|
value.discountAmount = value.discountAmount * value.discount / 10
|
|
value.discountAmount = Number(value.discountAmount.toFixed(2))
|
|
}
|
|
}
|
|
|
|
})
|
|
|
|
// this.getAllPrice()
|
|
|
|
if (isTrue) {
|
|
this.getAmountAndWho()
|
|
}
|
|
|
|
// this.noPay = this.shouldPay
|
|
if (this.xsyId == '') {
|
|
this.xsyId = uni.getStorageSync('id')
|
|
this.createByName = uni.getStorageSync('nickname')
|
|
}
|
|
if (this.carList1 != '') {
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
uni.removeStorageSync('hangOrder');
|
|
uni.removeStorageSync('KuCunBack');
|
|
uni.removeStorageSync('carList1')
|
|
uni.removeStorageSync('khName')
|
|
uni.removeStorageSync('saoma')
|
|
uni.removeStorageSync('clearMsg')
|
|
uni.removeStorageSync('discountAll')
|
|
}, 2000)
|
|
} else {
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 300)
|
|
setTimeout(res => {
|
|
uni.removeStorageSync('carList1')
|
|
uni.removeStorageSync('khName')
|
|
uni.removeStorageSync('saoma')
|
|
uni.removeStorageSync('KuCunBack');
|
|
uni.removeStorageSync('clearMsg')
|
|
uni.removeStorageSync('discountAll')
|
|
uni.removeStorageSync('hangOrder');
|
|
}, 2000)
|
|
|
|
}
|
|
},
|
|
checksaoma(){
|
|
this.$refs.saomaType.open()
|
|
},
|
|
AiHandleData() {
|
|
let that = this;
|
|
for (let i = 0; i < this.carList1.length; i++) {
|
|
|
|
if (this.carList1[i].stockLogList1) {
|
|
if (this.carList.size == 0) { //当前页没有数据
|
|
|
|
let obj = {
|
|
attrId:this.carList1[i].attrId,
|
|
purchasePrice: this.carList1[i].purchasePrice, //采购价
|
|
price: 0, //总价
|
|
discount: 10, //折扣
|
|
buyCount:this.carList1[i].buyCount,
|
|
isNew: this.carList1[i].isNew,
|
|
customerCategoryList:this.carList1[i].customerCategoryRule != null?JSON.parse(this.carList1[i].customerCategoryRule):null,
|
|
productId: this.carList1[i].productId,
|
|
categoryId: this.carList1[i].categoryId,
|
|
categoryName: this.carList1[i].isNew ? '默认分类' : this.carList1[i].categoryName,
|
|
unitPrice: this.carList1[i].wholesalePrice || 0, //单价
|
|
discountAmount: this.carList1[i].wholesalePrice || 0, //折后价
|
|
returnPrice: this.carList1[i].wholesalePrice || 0,
|
|
disNoAmount: 0, //折前价,用于计算整体折扣
|
|
wholesalePrice: this.carList1[i].wholesalePrice, //批发价
|
|
lsprice: this.carList1[i].price, //零售价
|
|
productCount: 0, //总数量
|
|
id: this.carList1[i].productId,
|
|
returnCount: 0,
|
|
productName: this.carList1[i].productName == null ? this.carList1[i].productSn : this
|
|
.carList1[i].productName,
|
|
productPicture: this.carList1[i].productPicture || "",
|
|
productPictures: this.carList1[i].productPictures || [],
|
|
productSn: this.carList1[i].productSn,
|
|
stockLogList: new Map(),
|
|
returnList: new Map(),
|
|
returnList1: [],
|
|
stockLogList1: [],
|
|
supplierName: this.carList1[i].supplierName //供应商
|
|
}
|
|
if(this.khName.categoryId != null && this.khName.categoryId != ''){
|
|
if(obj.customerCategoryList != null && obj.customerCategoryList != ''){
|
|
for(let i=0;i<obj.customerCategoryList.length;i++){
|
|
if(this.khName.categoryId == obj.customerCategoryList[i].categoryId){
|
|
if(obj.customerCategoryList[i].categoryPrice != ''){
|
|
if(obj.unitPrice == obj.wholesalePrice){
|
|
obj.discountAmount = obj.customerCategoryList[i].categoryPrice
|
|
obj.unitPrice = obj.customerCategoryList[i].categoryPrice
|
|
}
|
|
if(obj.returnPrice == obj.wholesalePrice){
|
|
obj.returnPrice = obj.customerCategoryList[i].categoryPrice
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
obj.discountAmount = obj.unitPrice
|
|
}
|
|
|
|
}else{
|
|
obj.discountAmount = obj.unitPrice
|
|
}
|
|
for (let m = 0; m < this.carList1[i].stockLogList1.length; m++) {
|
|
var data1 = {
|
|
productCount: Number(this.carList1[i].stockLogList1[m].productCount),
|
|
name: this.sliceMsg(this.carList1[i].stockLogList1[m].attributeList),
|
|
productNum: this.carList1[i].stockLogList1[m].stockCount
|
|
}
|
|
obj.stockLogList.set(this.carList1[i].stockLogList1[m].attributeList, data1)
|
|
if (this.carList1[i].stockLogList1[m].productCount < 0) { //退货数量
|
|
obj.returnCount += Math.abs(this.carList1[i].stockLogList1[m].productCount)
|
|
} else {
|
|
obj.productCount += Number(this.carList1[i].stockLogList1[m].productCount)
|
|
}
|
|
}
|
|
this.carList.set(this.carList1[i].productId, obj)
|
|
} else { //当前页有数据
|
|
if (this.carList.has(this.carList1[i].productId) == true) { //商品相同
|
|
this.carList.get(this.carList1[i].productId).productCount = 0
|
|
this.carList.get(this.carList1[i].productId).returnCount = 0
|
|
|
|
for (let m = 0; m < this.carList1[i].stockLogList1.length; m++) {
|
|
|
|
if (this.carList.get(this.carList1[i].productId).stockLogList.has(this.carList1[i]
|
|
.stockLogList1[m].attributeList) == true) { //规格相同
|
|
|
|
var data1 = {
|
|
productCount: Number(this.carList.get(this.carList1[i].productId).stockLogList
|
|
.get(this.carList1[i].stockLogList1[m].attributeList).productCount) +
|
|
Number(this.carList1[i].stockLogList1[m].productCount),
|
|
name: this.sliceMsg(this.carList1[i].stockLogList1[m].attributeList),
|
|
productNum: this.carList1[i].stockLogList1[m].stockCount
|
|
}
|
|
// if(data1.productCount >= 0){
|
|
// this.carList.get(this.carList1[i].id).productCount += data1.productCount
|
|
// }else if(data1.productCount < 0){
|
|
// this.carList.get(this.carList1[i].id).returnCount += Math.abs(data1.productCount)
|
|
// }
|
|
this.carList.get(this.carList1[i].productId).stockLogList.set(this.carList1[i]
|
|
.stockLogList1[m].attributeList, data1)
|
|
} else { //规格不同
|
|
|
|
var data1 = {
|
|
productCount: Number(this.carList1[i].stockLogList1[m].productCount),
|
|
name: this.sliceMsg(this.carList1[i].stockLogList1[m].attributeList),
|
|
productNum: this.carList1[i].stockLogList1[m].stockCount
|
|
}
|
|
// if(data1.productCount >= 0){
|
|
// this.carList.get(this.carList1[i].id).productCount += data1.productCount
|
|
// }else if(data1.productCount < 0){
|
|
// this.carList.get(this.carList1[i].id).returnCount += Math.abs(data1.productCount)
|
|
// }
|
|
this.carList.get(this.carList1[i].productId).stockLogList.set(this.carList1[i]
|
|
.stockLogList1[m].attributeList, data1)
|
|
}
|
|
}
|
|
this.carList.get(this.carList1[i].productId).returnList.forEach(function(value, key) {
|
|
if(value.productCount < 0){
|
|
that.carList.get(that.carList1[i].productId).returnCount += Math.abs(value.productCount)
|
|
}
|
|
|
|
})
|
|
this.carList.get(this.carList1[i].productId).stockLogList.forEach(function(value, key) {
|
|
if(value.productCount < 0){
|
|
that.carList.get(that.carList1[i].productId).returnCount += Math.abs(value.productCount)
|
|
}else{
|
|
that.carList.get(that.carList1[i].productId).productCount += value.productCount
|
|
}
|
|
})
|
|
} else { //商品不同
|
|
let obj = {
|
|
attrId:this.carList1[i].attrId,
|
|
purchasePrice: this.carList1[i].purchasePrice, //采购价
|
|
price: 0, //总价
|
|
discount: 10, //折扣
|
|
buyCount:this.carList1[i].buyCount,
|
|
categoryId: this.carList1[i].categoryId,
|
|
customerCategoryList:this.carList1[i].customerCategoryRule != null?JSON.parse(this.carList1[i].customerCategoryRule):null,
|
|
categoryName: this.carList1[i].isNew ? '默认分类' : this.carList1[i].categoryName,
|
|
productId: this.carList1[i].productId,
|
|
isNew: this.carList1[i].isNew,
|
|
unitPrice: this.carList1[i].wholesalePrice || 0, //单价
|
|
discountAmount: this.carList1[i].wholesalePrice || 0, //折后价
|
|
returnPrice: this.carList1[i].wholesalePrice || 0,
|
|
disNoAmount: 0, //折前价,用于计算整体折扣
|
|
wholesalePrice: this.carList1[i].wholesalePrice, //批发价
|
|
lsprice: this.carList1[i].price, //零售价
|
|
productCount: 0, //总数量
|
|
returnPrice: this.carList1[i].wholesalePrice || 0,
|
|
returnCount: 0,
|
|
id: this.carList1[i].productId,
|
|
productName: this.carList1[i].productName == null ? this.carList1[i].productSn :
|
|
this.carList1[i].productName,
|
|
productPicture: this.carList1[i].productPicture,
|
|
productPictures: this.carList1[i].productPictures || [],
|
|
productSn: this.carList1[i].productSn,
|
|
stockLogList: new Map(),
|
|
returnList: new Map(),
|
|
returnList1: [],
|
|
stockLogList1: [],
|
|
supplierName: this.carList1[i].supplierName //供应商
|
|
}
|
|
if(this.khName.categoryId != null && this.khName.categoryId != ''){
|
|
if(obj.customerCategoryList != null && obj.customerCategoryList != ''){
|
|
for(let i=0;i<obj.customerCategoryList.length;i++){
|
|
if(this.khName.categoryId == obj.customerCategoryList[i].categoryId){
|
|
if(obj.customerCategoryList[i].categoryPrice != ''){
|
|
if(obj.unitPrice == obj.wholesalePrice){
|
|
obj.discountAmount = obj.customerCategoryList[i].categoryPrice
|
|
obj.unitPrice = obj.customerCategoryList[i].categoryPrice
|
|
}
|
|
if(obj.returnPrice == obj.wholesalePrice){
|
|
obj.returnPrice = obj.customerCategoryList[i].categoryPrice
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
obj.discountAmount = obj.unitPrice
|
|
}
|
|
|
|
}else{
|
|
obj.discountAmount = obj.unitPrice
|
|
}
|
|
for (let m = 0; m < this.carList1[i].stockLogList1.length; m++) {
|
|
// obj.stockLogList.set(this.carList1[i].stockLogList1[m].attributeList, this.carList1[i]
|
|
// .stockLogList1[m].productCount)
|
|
// obj.productCount += this.carList1[i].stockLogList1[m].productCount
|
|
var data1 = {
|
|
productCount: Number(this.carList1[i].stockLogList1[m].productCount),
|
|
name: this.sliceMsg(this.carList1[i].stockLogList1[m].attributeList),
|
|
productNum: this.carList1[i].stockLogList1[m].stockCount
|
|
}
|
|
obj.stockLogList.set(this.carList1[i].stockLogList1[m].attributeList, data1)
|
|
|
|
obj.name = this.sliceMsg(this.carList1[i].stockLogList1[m].attributeList)
|
|
if (this.carList1[i].stockLogList1[m].productCount < 0) { //退货数量
|
|
obj.returnCount += Math.abs(this.carList1[i].stockLogList1[m].productCount)
|
|
} else {
|
|
obj.productCount += Number(this.carList1[i].stockLogList1[m].productCount)
|
|
}
|
|
}
|
|
this.carList.set(this.carList1[i].productId, obj)
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
this.$nextTick(() => {
|
|
this.carList1 = []
|
|
this.carList.forEach(function(value, key) {
|
|
/* if (that.priceType == '') {
|
|
value.unitPrice = value.discountAmount>0?value.discountAmount: value.wholesalePrice
|
|
} else if (that.priceType == 0) { //零售
|
|
value.unitPrice = value.lsprice
|
|
} else if (that.priceType == 1) { //批发
|
|
value.unitPrice = value.wholesalePrice
|
|
} */
|
|
if(value.isChangePrice == undefined){
|
|
value.isChangePrice = false
|
|
}
|
|
if(value.isChangeReturnPrice == undefined){
|
|
value.isChangeReturnPrice = false
|
|
}
|
|
if (that.priceType == '') {
|
|
if(value.returnPrice =='' || value.returnPrice ==null || value.returnPrice ==0){
|
|
value.returnPrice = !value.isChangeReturnPrice ? value.returnPrice : value.wholesalePrice
|
|
}
|
|
value.unitPrice = value.discountAmount > 0 ? value.discountAmount : value.wholesalePrice
|
|
} else if (that.priceType == 0) { //零售
|
|
value.unitPrice = !value.isChangePrice ? value.lsprice : value.unitPrice
|
|
value.discountAmount = !value.isChangePrice ? value.lsprice : value.unitPrice
|
|
value.returnPrice = !value.isChangeReturnPrice ? value.lsprice : value.unitPrice
|
|
} else if (that.priceType == 1) { //批发
|
|
value.unitPrice = !value.isChangePrice ? value.wholesalePrice : value.unitPrice
|
|
value.discountAmount = !value.isChangePrice ? value.wholesalePrice : value.unitPrice
|
|
value.returnPrice = !value.isChangeReturnPrice ? value.wholesalePrice : value.unitPrice
|
|
}
|
|
if (that.discountType == 1) { //整体折扣
|
|
value.price = value.unitPrice * 10000 * Number(value.productCount) * that.discountNum /
|
|
10 / 10000
|
|
}
|
|
})
|
|
// this.getAllPrice()
|
|
this.getAmountAndWho()
|
|
})
|
|
},
|
|
|
|
AiHandleDataNew(newData) {
|
|
let that = this;
|
|
for (let i = 0; i < newData.length; i++) {
|
|
let id = that.oneGoodsId
|
|
|
|
let specMap = new Map() //新的临时存放值那个更改过的值的map
|
|
that.$nextTick(() => {
|
|
that.carList.forEach(function(value, key) {
|
|
if (key != value.id) {
|
|
specMap.set(value.productId?value.productId:value.id, value)
|
|
} else {
|
|
specMap.set(key, value)
|
|
}
|
|
})
|
|
that.carList = specMap
|
|
})
|
|
let purchaseDetails = newData[i]
|
|
|
|
that.$nextTick(() => {
|
|
for (let i = 0; i < purchaseDetails.stockLogList1.length; i++) {
|
|
purchaseDetails.stockLogList1[i].name = that.sliceMsg(
|
|
purchaseDetails.stockLogList1[i].attributeList)
|
|
if (that.carList.get(id).stockLogList.size == 0) {
|
|
that.carList.get(id).stockLogList.set(purchaseDetails.stockLogList1[i].attributeList,
|
|
purchaseDetails.stockLogList1[i])
|
|
} else {
|
|
if (that.carList.get(id).stockLogList.has(
|
|
purchaseDetails.stockLogList1[i]
|
|
.attributeList) == true) {
|
|
that.carList.get(id).stockLogList.get(
|
|
purchaseDetails.stockLogList1[i]
|
|
.attributeList).productCount +=
|
|
purchaseDetails.stockLogList1[i]
|
|
.productCount ?
|
|
Number(purchaseDetails.stockLogList1[i]
|
|
.productCount):0
|
|
} else {
|
|
that.carList.get(id).stockLogList.set(
|
|
purchaseDetails.stockLogList1[i]
|
|
.attributeList, purchaseDetails
|
|
.stockLogList1[i])
|
|
}
|
|
}
|
|
|
|
if(purchaseDetails.stockLogList1[i].productCount > 0){
|
|
that.carList.get(id).productCount += Number(
|
|
purchaseDetails.stockLogList1[i].productCount)
|
|
}else{
|
|
that.carList.get(id).returnCount += Math.abs(purchaseDetails.stockLogList1[i].productCount)
|
|
}
|
|
if(that.carList.get(id).stockLogList.has(
|
|
'{"颜色":"均色","尺码":"均码"}')){
|
|
if (that.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}').productCount == 0 &&
|
|
purchaseDetails.stockLogList1.length > 0) {
|
|
that.carList.get(id).stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
}
|
|
|
|
}
|
|
// that.carList.get(id).returnList.forEach(function(value, key) {
|
|
// if(value.productCount > 0){
|
|
// that.carList.get(id).productCount += value.productCount
|
|
// }else{
|
|
// that.carList.get(id).returnCount += Math.abs(value.productCount)
|
|
// }
|
|
// })
|
|
// that.carList.get(id).stockLogList.forEach(function(value, key) {
|
|
// if(value.productCount > 0){
|
|
// that.carList.get(id).productCount += value.productCount
|
|
// }else{
|
|
// that.carList.get(id).returnCount += Math.abs(value.productCount)
|
|
// }
|
|
// })
|
|
that.carList.get(id).price = Number(that.carList.get(id)
|
|
.productCount) * that.carList.get(id).discountAmount
|
|
})
|
|
|
|
this.$nextTick(() => {
|
|
this.carList1 = []
|
|
this.carList.forEach(function(value, key) {
|
|
/* if (that.priceType == '') {
|
|
value.unitPrice = value.discountAmount>0?value.discountAmount: value.wholesalePrice
|
|
} else if (that.priceType == 0) { //零售
|
|
value.unitPrice = value.lsprice
|
|
} else if (that.priceType == 1) { //批发
|
|
value.unitPrice = value.wholesalePrice
|
|
} */
|
|
if(value.isChangePrice == undefined){
|
|
value.isChangePrice = false
|
|
}
|
|
if(value.isChangeReturnPrice == undefined){
|
|
value.isChangeReturnPrice = false
|
|
}
|
|
if (that.priceType == '') {
|
|
if(value.returnPrice =='' || value.returnPrice ==null || value.returnPrice ==0){
|
|
value.returnPrice = !value.isChangeReturnPrice ? value.returnPrice : value.wholesalePrice
|
|
}
|
|
value.unitPrice = value.discountAmount > 0 ? value.discountAmount : value.wholesalePrice
|
|
} else if (that.priceType == 0) { //零售
|
|
value.unitPrice = !value.isChangePrice ? value.lsprice : value.unitPrice
|
|
value.discountAmount = !value.isChangePrice ? value.lsprice : value.unitPrice
|
|
value.returnPrice = !value.isChangeReturnPrice ? value.lsprice : value.unitPrice
|
|
} else if (that.priceType == 1) { //批发
|
|
value.unitPrice = !value.isChangePrice ? value.wholesalePrice : value.unitPrice
|
|
value.discountAmount = !value.isChangePrice ? value.wholesalePrice : value.unitPrice
|
|
value.returnPrice = !value.isChangeReturnPrice ? value.wholesalePrice : value.unitPrice
|
|
}
|
|
if (that.discountType == 1) { //整体折扣
|
|
value.price = value.unitPrice * 10000 * Number(value.productCount) * that.discountNum /
|
|
10 / 10000
|
|
}
|
|
})
|
|
// this.getAllPrice()
|
|
this.getAmountAndWho()
|
|
})
|
|
}
|
|
},
|
|
//保存已选
|
|
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
|
|
}
|
|
}
|
|
},
|
|
sliceMsg(val) {
|
|
var name = ''
|
|
if (typeof(val) == 'string') {
|
|
let newObj = JSON.parse(val)
|
|
for (let as in newObj) {
|
|
if (as == '尺码') {
|
|
name += newObj[as]
|
|
} else {
|
|
name += newObj[as] + ' | '
|
|
}
|
|
|
|
}
|
|
}
|
|
return name;
|
|
},
|
|
combination(arr) {
|
|
let result = [
|
|
[]
|
|
]
|
|
arr.map(x => {
|
|
var res = []
|
|
result.map(y => {
|
|
x.specs.map(z => {
|
|
res.push([...y, z])
|
|
})
|
|
})
|
|
result = res
|
|
})
|
|
return result;
|
|
},
|
|
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) {
|
|
this.temporary = [id, attr, type, value]
|
|
let num = type == '颜色' ? 0 : 1
|
|
this.getGategoryLowList()
|
|
},
|
|
//初始化获取子分类列表
|
|
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.$refs.getaPopup.open()
|
|
},
|
|
//店铺默认分类
|
|
getDefaultCategory() {
|
|
this.tui.request("/app/productCategory/getDefaultCategory", "POST", {}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
this.fenleiList = res.result
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
//新增商品
|
|
isSnList(img) {
|
|
this.addPageGoods(img, '')
|
|
},
|
|
//进入页面,查询货号列表
|
|
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) => {})
|
|
},
|
|
async startGetSn() {
|
|
var that = this;
|
|
if (this.prefixRule == '') {
|
|
this.tui.toast('请输入货号生成前缀规则')
|
|
return
|
|
}
|
|
if (this.numRule == '') {
|
|
this.tui.toast('请输入货号生成位数规则')
|
|
return
|
|
}
|
|
await 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('重新启用成功')
|
|
setTimeout(res => {
|
|
that.$refs.SNDialog.close()
|
|
that.getSnList()
|
|
that.generateSn(that
|
|
.prefixRule)
|
|
that.$forceUpdate()
|
|
}, 1000)
|
|
} else {
|
|
that.tui.toast(res2.message)
|
|
}
|
|
that.$forceUpdate()
|
|
}).catch((res) => {})
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
that.$refs.SNDialog.close()
|
|
if (this.oneGoodsId != '') {
|
|
that.generateSn(that.prefixRule)
|
|
} else {
|
|
that.addPageGoods(that.zhuImg, res1.result)
|
|
}
|
|
that.getSnList()
|
|
}
|
|
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
addPageGoods(path, sn) {
|
|
let obj = {
|
|
attrId:'',
|
|
id: generateUUID(),
|
|
categoryName: this.fenleiList.categoryName,
|
|
categoryId: this.fenleiList.categoryId,
|
|
isNew: true,
|
|
productPictures: [],
|
|
customerCategoryRule:null,
|
|
purchasePrice: "", //采购价
|
|
price: 0, //总价
|
|
discount: 10, //折扣
|
|
unitPrice: 0, //单价
|
|
discountAmount: 0, //折后价
|
|
returnPrice: 0,
|
|
disNoAmount: 0, //折前价,用于计算整体折扣
|
|
wholesalePrice: 0, //批发价
|
|
lsprice: 0, //零售价
|
|
productCount: 1, //总数量
|
|
returnCount: 0, //退货数量
|
|
productId: '',
|
|
productName: '',
|
|
productPicture: '',
|
|
productSn: sn ? sn : "",
|
|
stockLogList: new Map(),
|
|
returnList: new Map(),
|
|
returnList1: [],
|
|
stockLogList1: [],
|
|
supplierName: '' //供应商
|
|
}
|
|
let data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
name: '均色 | 均码',
|
|
productCount: 1,
|
|
productNum: null
|
|
}
|
|
obj.stockLogList.set(data.attributeList, data)
|
|
obj.stockLogList1.push(data)
|
|
this.carList.set(obj.id, obj)
|
|
|
|
this.$forceUpdate()
|
|
},
|
|
//点击某一个规格,可修改
|
|
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()
|
|
})
|
|
|
|
},
|
|
//销售员列表
|
|
xsyList() {
|
|
this.tui.request('/app/common/user/findAllUserByShopId', 'get', {
|
|
|
|
}, false, false, true).then((res) => {
|
|
if (res.code !== 200) return
|
|
if (this.xsyId == '') {
|
|
this.xsyId = uni.getStorageSync('id')
|
|
this.createByName = uni.getStorageSync('nickname')
|
|
}
|
|
// this.xsyId = res.result[0].id
|
|
// this.createByName = res.result[0].nickname
|
|
this.categoryList = res.result.map(item => {
|
|
return {
|
|
value: item.id,
|
|
text: item.nickname
|
|
}
|
|
})
|
|
})
|
|
},
|
|
seeCustomCategory(){
|
|
this.$refs.customPopup.open()
|
|
},
|
|
allChange(e) {
|
|
this.allChangeNum = e
|
|
//监听到输入框改变,给所有的都赋值
|
|
if (this.isPlusAndMinus == false) {
|
|
for (var i = 0; i < this.temporaryList.length; i++) {
|
|
if (this.evalue.length == 0) {
|
|
if(Number(this.allChangeNum) > this.temporaryList[i].productNum && (this.shopId == '1838094297858183168' || this.shopId == '1811579958284390400' || this.shopId == '1818888277105709056')){
|
|
this.tui.toast(this.temporaryList[i].name + "已超出可售数量",300)
|
|
}else{
|
|
this.temporaryList[i].productCount = Number(this.allChangeNum)
|
|
if(this.temporaryList[i].productCount < 0 && this.khName.name!='散客'){
|
|
this.checkCanReturn(this.goodsDetail.productSn,this.goodsDetail.id,this.temporaryList[i].attributeList,this.khName.id,this.temporaryList[i].productCount)
|
|
}
|
|
}
|
|
} else {
|
|
for (var j = 0; j < this.evalue.length; j++) {
|
|
if (this.evalue[j] == this.temporaryList[i].name) {
|
|
if(Number(this.allChangeNum) > this.temporaryList[i].productNum && (this.shopId == '1838094297858183168' || this.shopId == '1811579958284390400' || this.shopId == '1818888277105709056')){
|
|
this.tui.toast(this.temporaryList[i].name + "已超出可售数量",300)
|
|
}else{
|
|
this.temporaryList[i].productCount = Number(this.allChangeNum)
|
|
if(this.temporaryList[i].productCount < 0 && this.khName.name!='散客'){
|
|
this.checkCanReturn(this.goodsDetail.productSn,this.goodsDetail.id,this.temporaryList[i].attributeList,this.khName.id,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)
|
|
}
|
|
}
|
|
}
|
|
setTimeout(res => {
|
|
if(this.checkCanBuy.length > 0){
|
|
this.seeCustomCategory()
|
|
}
|
|
}, 500)
|
|
|
|
}
|
|
this.isPlusAndMinus == false
|
|
this.temporaryChange()
|
|
},
|
|
allReturnChange(e) {
|
|
this.allChangeNum = e
|
|
//监听到输入框改变,给所有的都赋值
|
|
if (this.isPlusAndMinus == false) {
|
|
for (var i = 0; i < this.temporaryReturnList.length; i++) {
|
|
if (this.evalue.length == 0) {
|
|
this.temporaryReturnList[i].productCount = Number(this.allChangeNum)
|
|
if(this.temporaryReturnList[i].productCount < 0 && this.khName.name!='散客'){
|
|
this.checkCanReturn(this.goodsReturnDetail.productSn,this.goodsReturnDetail.id,this.temporaryReturnList[i].attributeList,this.khName.id,this.temporaryReturnList[i].productCount)
|
|
}
|
|
} else {
|
|
for (var j = 0; j < this.evalue.length; j++) {
|
|
if (this.evalue[j] == this.temporaryReturnList[i].name) {
|
|
this.temporaryReturnList[i].productCount = Number(this.allChangeNum)
|
|
if(this.temporaryReturnList[i].productCount < 0 && this.khName.name!='散客'){
|
|
this.checkCanReturn(this.goodsReturnDetail.productSn,this.goodsReturnDetail.id,this.temporaryReturnList[i].attributeList,this.khName.id,this.temporaryReturnList[i].productCount)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
for (var m = 0; m < this.pageOldTemReturnList.length; m++) {
|
|
if (this.temporaryReturnList[i].attributeList == this.pageOldTemReturnList[m].attributeList) {
|
|
this.pageOldTemReturnList[m].productCount = Number(this.temporaryReturnList[i].productCount)
|
|
}
|
|
}
|
|
for (var j = 0; j < this.oldTemReturnList.length; j++) {
|
|
if (this.temporaryReturnList[i].attributeList == this.oldTemReturnList[j].attributeList) {
|
|
this.oldTemReturnList[j].productCount = Number(this.temporaryReturnList[i].productCount)
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
setTimeout(res => {
|
|
if(this.checkCanBuy.length > 0){
|
|
this.seeCustomCategory()
|
|
}
|
|
}, 500)
|
|
this.isPlusAndMinus == false
|
|
this.temporaryReturnChange()
|
|
},
|
|
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 {
|
|
if(this.temporaryList[i].productCount + 1 > this.temporaryList[i].productNum && (this.shopId == '1838094297858183168' || this.shopId == '1811579958284390400' || this.shopId == '1818888277105709056')){
|
|
this.tui.toast(this.temporaryList[i].name + "已超出可售数量",300)
|
|
}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 {
|
|
if(this.temporaryList[i].productCount + 1 > this.temporaryList[i].productNum && (this.shopId == '1838094297858183168' || this.shopId == '1811579958284390400' || this.shopId == '1818888277105709056')){
|
|
this.tui.toast(this.temporaryList[i].name + "已超出可售数量",300)
|
|
}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--
|
|
if(this.temporaryList[i].productCount < 0 && this.khName.name!='散客'){
|
|
this.checkCanReturn(this.goodsDetail.productSn,this.goodsDetail.id,this.temporaryList[i].attributeList,this.khName.id,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--
|
|
if(this.temporaryList[i].productCount < 0 && this.khName.name!='散客'){
|
|
this.checkCanReturn(this.goodsDetail.productSn,this.goodsDetail.id,this.temporaryList[i].attributeList,this.khName.id,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)
|
|
}
|
|
}
|
|
}
|
|
setTimeout(res => {
|
|
if(this.checkCanBuy.length > 0){
|
|
this.seeCustomCategory()
|
|
}
|
|
}, 500)
|
|
this.temporaryChange()
|
|
},
|
|
plusReturnNum() {
|
|
this.isPlusAndMinus == true
|
|
//监听到点击+的操作,给所有的都+1
|
|
for (var i = 0; i < this.temporaryReturnList.length; i++) {
|
|
if (this.evalue.length == 0) {
|
|
if (this.temporaryReturnList[i].productCount == undefined) {
|
|
this.temporaryReturnList[i].productCount = -1
|
|
} else {
|
|
if(this.temporaryReturnList[i].productCount+1 > 0){
|
|
this.temporaryReturnList[i].productCount = 0
|
|
}else{
|
|
this.temporaryReturnList[i].productCount++
|
|
}
|
|
|
|
}
|
|
} else {
|
|
for (var j = 0; j < this.evalue.length; j++) {
|
|
if (this.evalue[j] == this.temporaryReturnList[i].name) {
|
|
if (this.temporaryReturnList[i].productCount == undefined) {
|
|
this.temporaryReturnList[i].productCount = -1
|
|
} else {
|
|
if(this.temporaryReturnList[i].productCount+1 > 0){
|
|
this.temporaryReturnList[i].productCount = 0
|
|
}else{
|
|
this.temporaryReturnList[i].productCount++
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
for (var m = 0; m < this.pageOldTemReturnList.length; m++) {
|
|
if (this.temporaryReturnList[i].attributeList == this.pageOldTemReturnList[m].attributeList) {
|
|
this.pageOldTemReturnList[m].productCount = Number(this.temporaryReturnList[i].productCount)
|
|
}
|
|
}
|
|
for (var j = 0; j < this.oldTemReturnList.length; j++) {
|
|
if (this.temporaryReturnList[i].attributeList == this.oldTemReturnList[j].attributeList) {
|
|
this.oldTemReturnList[j].productCount = Number(this.temporaryReturnList[i].productCount)
|
|
}
|
|
}
|
|
}
|
|
this.temporaryReturnChange()
|
|
},
|
|
minusReturnNum() {
|
|
this.isPlusAndMinus == true
|
|
//监听到点击-的操作,给所有的都-1
|
|
|
|
for (var i = 0; i < this.temporaryReturnList.length; i++) {
|
|
if (this.evalue.length == 0) {
|
|
this.temporaryReturnList[i].productCount--
|
|
if(this.temporaryReturnList[i].productCount < 0 && this.khName.name!='散客'){
|
|
this.checkCanReturn(this.goodsReturnDetail.productSn,this.goodsReturnDetail.id,this.temporaryReturnList[i].attributeList,this.khName.id,this.temporaryReturnList[i].productCount)
|
|
}
|
|
} else {
|
|
for (var j = 0; j < this.evalue.length; j++) {
|
|
if (this.evalue[j] == this.temporaryReturnList[i].name) {
|
|
this.temporaryReturnList[i].productCount--
|
|
if(this.temporaryReturnList[i].productCount < 0 && this.khName.name!='散客'){
|
|
this.checkCanReturn(this.goodsReturnDetail.productSn,this.goodsReturnDetail.id,this.temporaryReturnList[i].attributeList,this.khName.id,this.temporaryReturnList[i].productCount)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
for (var m = 0; m < this.pageOldTemReturnList.length; m++) {
|
|
if (this.temporaryReturnList[i].attributeList == this.pageOldTemReturnList[m].attributeList) {
|
|
this.pageOldTemReturnList[m].productCount = Number(this.temporaryReturnList[i].productCount)
|
|
}
|
|
}
|
|
for (var j = 0; j < this.oldTemReturnList.length; j++) {
|
|
if (this.temporaryReturnList[i].attributeList == this.oldTemReturnList[j].attributeList) {
|
|
this.oldTemReturnList[j].productCount = Number(this.temporaryReturnList[i].productCount)
|
|
}
|
|
}
|
|
}
|
|
setTimeout(res => {
|
|
if(this.checkCanBuy.length > 0){
|
|
this.seeCustomCategory()
|
|
}
|
|
}, 500)
|
|
this.temporaryReturnChange()
|
|
},
|
|
getScanCodeCategroyId(num) {
|
|
this.isOpenId = num == '颜色' ? 0 : 1
|
|
this.goodsId = this.goodsDetail.id
|
|
this.$refs.specDialog.open('bottom')
|
|
this.isBottom = true
|
|
},
|
|
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)
|
|
}
|
|
})
|
|
},
|
|
attrReturnNameChange(index, data1, index1) {
|
|
let that = this;
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
this.goodsReturnDetail.attributeList[index].isChecked = !this.goodsReturnDetail.attributeList[index].isChecked;
|
|
this.goodsReturnDetail.attributeList[index].value[index1].isChecked = !this.goodsReturnDetail.attributeList[index]
|
|
.value[index1].isChecked;
|
|
|
|
this.evalue = []
|
|
var value = []
|
|
for (let i = 0, data = this.goodsReturnDetail.attributeList[0].value; i < data.length; i++) {
|
|
if (data[i].isChecked) {
|
|
for (let j = 0, dataJ = this.goodsReturnDetail.attributeList[1].value; j < dataJ.length; j++) {
|
|
var name = ''
|
|
let value1 = "{"
|
|
|
|
name = data[i].value + ' | ' + dataJ[j].value
|
|
value1 += '"' + '颜色' + '":"' + data[i].value + '",'
|
|
value1 += '"' + '尺码' + '":"' + dataJ[j].value + '"'
|
|
value1 += "}"
|
|
value.push(value1)
|
|
this.evalue.push(name)
|
|
}
|
|
}
|
|
}
|
|
if (this.temporaryReturnList == undefined || this.temporaryReturnList.length == 0) {
|
|
this.temporaryReturnList = []
|
|
for (var i = 0; i < value.length; i++) {
|
|
this.attributeList = {
|
|
attributeList: value[i],
|
|
productCount: Number(this.temporaryNum),
|
|
productNum: null,
|
|
name: this.evalue[i],
|
|
price: this.purchasePrice
|
|
}
|
|
this.temporaryReturnList.push(this.attributeList);
|
|
}
|
|
} else {
|
|
let newProductCount = 0;
|
|
for (var i = 0; i < value.length; i++) {
|
|
for (var m = 0; m < this.temporaryReturnList.length; m++) {
|
|
if (this.temporaryReturnList[m].attributeList == value[i]) {
|
|
newProductCount = Number(this.temporaryReturnList[m].productCount)
|
|
}
|
|
}
|
|
this.attributeList = {
|
|
attributeList: value[i],
|
|
productCount: newProductCount,
|
|
productNum: null,
|
|
name: this.evalue[i],
|
|
price: this.purchasePrice
|
|
}
|
|
|
|
this.newTemReturnList.push(this.attributeList);
|
|
newProductCount = 0;
|
|
}
|
|
for (var i = 0; i < this.oldTemReturnList.length; i++) {
|
|
let oldAttributeList = '';
|
|
let oldProductCount = '';
|
|
let notChcek = true;
|
|
for (var m = 0; m < this.newTemReturnList.length; m++) {
|
|
if (this.oldTemReturnList[i].attributeList == this.newTemReturnList[m].attributeList) {
|
|
this.newTemReturnList[m].productCount = Number(this.oldTemReturnList[i].productCount)
|
|
notChcek = false;
|
|
}
|
|
}
|
|
if (this.newTemReturnList.length > 0 && notChcek) {
|
|
this.newTemReturnList.push(this.oldTemReturnList[i]);
|
|
}
|
|
}
|
|
|
|
for (var i = 0; i < this.pageOldTemReturnList.length; i++) {
|
|
let oldAttributeList = '';
|
|
let oldProductCount = '';
|
|
let notChcek = true;
|
|
for (var m = 0; m < this.newTemReturnList.length; m++) {
|
|
if (this.pageOldTemReturnList[i].attributeList == this.newTemReturnList[m].attributeList) {
|
|
this.newTemReturnList[m].productCount = Number(this.pageOldTemReturnList[i].productCount)
|
|
notChcek = false;
|
|
}
|
|
}
|
|
if (this.newTemReturnList.length > 0 && notChcek) {
|
|
this.newTemReturnList.push(this.pageOldTemReturnList[i]);
|
|
}
|
|
}
|
|
}
|
|
this.$nextTick(() => {
|
|
for (var i = 0; i < this.temporaryReturnList.length; i++) {
|
|
for (var m = 0; m < this.pecsList.length; m++) {
|
|
if (this.temporaryReturnList[i].attributeList == this.pecsList[m].attributeList) {
|
|
this.temporaryReturnList[i].productNum = this.pecsList[m].stockCount
|
|
}
|
|
}
|
|
}
|
|
})
|
|
if (this.newTemReturnList.length != 0) {
|
|
this.temporaryReturnList = this.newTemReturnList;
|
|
this.oldTemReturnList = []
|
|
this.newTemReturnList = []
|
|
}
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 200)
|
|
},
|
|
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.goodsDetail.isNew) {
|
|
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)
|
|
} else {
|
|
this.evalue = []
|
|
var value = []
|
|
for (let i = 0, data = this.goodsDetail.attributeList[0].value; i < data.length; i++) {
|
|
if (data[i].isChecked) {
|
|
for (let j = 0, dataJ = this.goodsDetail.attributeList[1].value; j < dataJ.length; j++) {
|
|
var name = ''
|
|
let value1 = "{"
|
|
|
|
name = data[i].value + ' | ' + dataJ[j].value
|
|
value1 += '"' + '颜色' + '":"' + data[i].value + '",'
|
|
value1 += '"' + '尺码' + '":"' + dataJ[j].value + '"'
|
|
value1 += "}"
|
|
value.push(value1)
|
|
this.evalue.push(name)
|
|
}
|
|
}
|
|
}
|
|
if (this.temporaryList.length == 0) {
|
|
for (var i = 0; i < value.length; i++) {
|
|
this.attributeList = {
|
|
attributeList: value[i],
|
|
productCount: Number(this.temporaryNum),
|
|
productNum: null,
|
|
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,
|
|
productNum: null,
|
|
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]);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (this.newTemList.length != 0) {
|
|
this.temporaryList = this.newTemList;
|
|
this.oldTemList = []
|
|
this.newTemList = []
|
|
}
|
|
this.$nextTick(() => {
|
|
for (var i = 0; i < this.temporaryList.length; i++) {
|
|
for (var m = 0; m < this.pecsList.length; m++) {
|
|
if (this.temporaryList[i].attributeList == this.pecsList[m].attributeList) {
|
|
this.temporaryList[i].productNum = this.pecsList[m].stockCount
|
|
}
|
|
}
|
|
}
|
|
})
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 200)
|
|
}
|
|
this.$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 //当天
|
|
},
|
|
obtainPrice(e, type, num, num1) {
|
|
|
|
this.linshiPrice = e.target.value
|
|
if (type == 'relPrice') {
|
|
this.showPrice = true
|
|
this.keyboard = 'relPrice'
|
|
// this.relPrice = ''
|
|
} else if (type == 'priceOk') {
|
|
this.showPrice = true
|
|
this.keyboard = 'priceOk'
|
|
} else if (type == 'zhengti') {
|
|
this.discountNum = ''
|
|
} else if (type == 'xiaoshou') {
|
|
this.shouldPay = ''
|
|
}else if (type == 'tuihuo') {
|
|
this.returnPay = ''
|
|
} else if (type == 'danzhe') {
|
|
this.carList.get(num).discount = ''
|
|
this.$forceUpdate()
|
|
} else if (type == 'danjishu') {
|
|
this.keyboard = 'danjishu'
|
|
this.keyboardIndex = num
|
|
this.showFu = true
|
|
}else if (type == 'returndanjishu') {
|
|
this.keyboard = 'returndanjishu'
|
|
this.keyboardIndex = num
|
|
this.showFu = true
|
|
} else if (type == 'zongjishu') {
|
|
this.keyboard = 'zongjishu'
|
|
this.showFu = true
|
|
}else if (type == 'zongReturnjishu') {
|
|
this.keyboard = 'zongReturnjishu'
|
|
this.showFu = true
|
|
} else if (type == 'danjia') {
|
|
this.showPrice = true
|
|
this.keyboard = 'danjia'
|
|
this.keyboardIndex = num
|
|
} else if (type == 'mapdanjishu') {
|
|
this.showFu = true
|
|
this.keyboard = 'mapdanjishu'
|
|
this.keyboardIndex = [num, num1]
|
|
}else if (type == 'returnmapdanjishu') {
|
|
this.showFu = true
|
|
this.keyboard = 'returnmapdanjishu'
|
|
this.keyboardIndex = [num, num1]
|
|
} else {
|
|
this.showPrice = true
|
|
this.priceOk = ''
|
|
}
|
|
},
|
|
numChange(e, index) {
|
|
if(Number(e) > this.temporaryList[index].productCount && (this.shopId == '1838094297858183168' || this.shopId == '1811579958284390400' || this.shopId == '1818888277105709056')){
|
|
this.tui.toast("已超出可售数量",300)
|
|
}else{
|
|
this.temporaryList[index].productCount = Number(e)
|
|
if(this.temporaryList[index].productCount < 0 && this.khName.name!='散客'){
|
|
this.checkCanReturn(this.goodsDetail.productSn,this.goodsDetail.id,this.temporaryList[index].attributeList,this.khName.id,this.temporaryList[index].productCount)
|
|
}
|
|
setTimeout(res => {
|
|
if(this.checkCanBuy.length > 0){
|
|
this.seeCustomCategory()
|
|
}
|
|
}, 500)
|
|
this.$forceUpdate()
|
|
this.temporaryChange()
|
|
}
|
|
},
|
|
numReturnChange(e, index) {
|
|
if(e > 0){
|
|
this.tui.toast('退货数量不能为正数')
|
|
}else{
|
|
this.temporaryReturnList[index].productCount = Number(e)
|
|
if(this.temporaryReturnList[index].productCount < 0 && this.khName.name!='散客'){
|
|
this.checkCanReturn(this.goodsReturnDetail.productSn,this.goodsReturnDetail.id,this.temporaryReturnList[index].attributeList,this.khName.id,this.temporaryReturnList[index].productCount)
|
|
}
|
|
this.$forceUpdate()
|
|
setTimeout(res => {
|
|
if(this.checkCanBuy.length > 0){
|
|
this.seeCustomCategory()
|
|
}
|
|
}, 500)
|
|
this.temporaryReturnChange()
|
|
}
|
|
|
|
},
|
|
mapnumChange(e, id, id1) {
|
|
this.changePriceStatus()
|
|
let that = this;
|
|
if(!this.carList.get(id).isNew && e > this.carList.get(id).stockLogList.get(id1).productNum && (this.shopId == '1838094297858183168' || this.shopId == '1811579958284390400' || this.shopId == '1818888277105709056')){
|
|
this.tui.toast("已超出可售数量",300)
|
|
}else{
|
|
this.carList.get(id).productCount = 0
|
|
this.carList.get(id).returnCount = 0
|
|
|
|
this.carList.get(id).stockLogList.get(id1).productCount = Number(e)
|
|
if(this.carList.get(id).stockLogList.get(id1).productCount < 0 && this.khName.name!='散客'){
|
|
this.checkCanReturn(this.carList.get(id).productSn,this.carList.get(id).productId,id1,this.khName.id,this.carList.get(id).stockLogList.get(id1).productCount)
|
|
}
|
|
setTimeout(res => {
|
|
if(this.checkCanBuy.length > 0){
|
|
this.seeCustomCategory()
|
|
}
|
|
}, 500)
|
|
this.carList.get(id).stockLogList.forEach(function(value, key) {
|
|
if (value.productCount < 0) {
|
|
that.carList.get(id).returnCount = 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.carList.get(id).returnList.forEach(function(value, key) {
|
|
that.carList.get(id).returnCount = that.carList.get(id).returnCount + Math.abs(value
|
|
.productCount)
|
|
})
|
|
this.$nextTick(() => {
|
|
// if (that.discountType != 0) { //单品折扣
|
|
that.carList.get(id).price = Number(that.carList.get(id).productCount) * that.carList
|
|
.get(id).discountAmount
|
|
that.carList.get(id).price = Number(that.carList.get(id).price.toFixed(2))
|
|
// }
|
|
})
|
|
this.$nextTick(() => {
|
|
this.getAllPrice()
|
|
})
|
|
}
|
|
},
|
|
mapnumReturnChange(e, id, id1) {
|
|
this.changePriceStatus()
|
|
let that = this;
|
|
this.carList.get(id).returnCount = 0
|
|
|
|
this.carList.get(id).returnList.get(id1).productCount = Number(e)
|
|
|
|
this.carList.get(id).returnList.forEach(function(value, key) {
|
|
if (value.productCount < 0) {
|
|
that.carList.get(id).returnCount = that.carList.get(id).returnCount + Math.abs(value
|
|
.productCount)
|
|
} else {
|
|
that.carList.get(id).returnCount = 0
|
|
}
|
|
})
|
|
this.$nextTick(() => {
|
|
this.getAllPrice()
|
|
})
|
|
},
|
|
mapMinusNum(index) {
|
|
this.temporaryList[index].productCount--
|
|
if(this.temporaryList[index].productCount < 0 && this.khName.name!='散客'){
|
|
this.checkCanReturn(this.goodsDetail.productSn,this.goodsDetail.id,this.temporaryList[index].attributeList,this.khName.id,this.temporaryList[index].productCount)
|
|
}
|
|
setTimeout(res => {
|
|
if(this.checkCanBuy.length > 0){
|
|
this.seeCustomCategory()
|
|
}
|
|
}, 500)
|
|
this.temporaryChange()
|
|
},
|
|
mapPlusNum(index) {
|
|
if(this.temporaryList[index].productCount + 1 > this.temporaryList[index].productNum && (this.shopId == '1838094297858183168' || this.shopId == '1811579958284390400' || this.shopId == '1818888277105709056')){
|
|
this.tui.toast("已超出可售数量",300)
|
|
}else{
|
|
this.temporaryList[index].productCount++
|
|
this.temporaryChange()
|
|
}
|
|
},
|
|
mapMinusReturnNum(index) {
|
|
uni.showLoading({
|
|
title: '加载中...',
|
|
mask:true
|
|
})
|
|
this.temporaryReturnList[index].productCount--
|
|
if(this.temporaryReturnList[index].productCount < 0 && this.khName.name!='散客'){
|
|
this.checkCanReturn(this.goodsReturnDetail.productSn,this.goodsReturnDetail.id,this.temporaryReturnList[index].attributeList,this.khName.id,this.temporaryReturnList[index].productCount)
|
|
}
|
|
setTimeout(res => {
|
|
if(this.checkCanBuy.length > 0){
|
|
this.seeCustomCategory()
|
|
}
|
|
uni.hideLoading()
|
|
}, 500)
|
|
this.temporaryReturnChange()
|
|
},
|
|
mapPlusReturnNum(index) {
|
|
if(this.temporaryReturnList[index].productCount >=0){
|
|
this.tui.toast('退货数量不能为正数')
|
|
return
|
|
}else{
|
|
this.temporaryReturnList[index].productCount++
|
|
}
|
|
this.temporaryReturnChange()
|
|
},
|
|
checkCanReturn(productSn,productId,attributeList,customerId,goodsNumNew){
|
|
this.tui.request(
|
|
"/app/customer/getCustomerBuyHistory",
|
|
"POST", {
|
|
productId: productId,
|
|
attributeList: attributeList,
|
|
customerId: customerId
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
let buyCount = res1.result.buyCount==null?0:res1.result.buyCount
|
|
let returnCount = res1.result.returnCount==null?0:res1.result.returnCount
|
|
if(Number(buyCount) <= 0 || (Number(buyCount) - Number(returnCount) + Number(goodsNumNew)) < 0){
|
|
let obj = {
|
|
productSn:productSn,
|
|
attributeList:attributeList,
|
|
buyCountAll:buyCount,
|
|
returnCountAll:returnCount,
|
|
returnCountAllNew:goodsNumNew
|
|
}
|
|
this.checkCanBuy.push(obj)
|
|
}
|
|
uni.hideLoading()
|
|
}
|
|
}).catch((res) => {
|
|
uni.hideLoading()
|
|
})
|
|
},
|
|
async oneMinusNum(index, index1) {
|
|
this.changePriceStatus()
|
|
let that = this;
|
|
this.carList.get(index).productCount = 0
|
|
this.carList.get(index).returnCount = 0
|
|
this.carList.get(index).stockLogList.get(index1).productCount--
|
|
if(this.carList.get(index).stockLogList.get(index1).productCount < 0 && this.khName.name!='散客'){
|
|
this.checkCanReturn(this.carList.get(index).productSn,this.carList.get(index).productId,index1,this.khName.id,this.carList.get(index).stockLogList.get(index1).productCount)
|
|
}
|
|
|
|
setTimeout(res => {
|
|
if(this.checkCanBuy.length > 0){
|
|
this.seeCustomCategory()
|
|
}
|
|
}, 500)
|
|
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)
|
|
}
|
|
})
|
|
this.carList.get(index).returnList.forEach(function(value, key) {
|
|
that.carList.get(index).returnCount = that.carList.get(index).returnCount + Math.abs(value
|
|
.productCount)
|
|
})
|
|
|
|
await this.$nextTick(() => {
|
|
// if (that.discountType != 0) { //单品折扣
|
|
that.carList.get(index).price = Number(that.carList.get(index).productCount) * that.carList
|
|
.get(index).discountAmount
|
|
that.carList.get(index).price = Number(that.carList.get(index).price.toFixed(2))
|
|
// }
|
|
})
|
|
this.$forceUpdate()
|
|
this.getAllPrice()
|
|
},
|
|
closeCustomPopup(){
|
|
this.checkCanBuy = []
|
|
this.$refs.customPopup.close()
|
|
},
|
|
onePlusNum(index, index1) {
|
|
this.changePriceStatus()
|
|
let that = this;
|
|
if(!this.carList.get(index).isNew && this.carList.get(index).stockLogList.get(index1).productCount + 1 > this.carList.get(index).stockLogList.get(index1).productNum && (this.shopId == '1838094297858183168' || this.shopId == '1811579958284390400' || this.shopId == '1818888277105709056')){
|
|
this.tui.toast("已超出可售数量")
|
|
}else{
|
|
this.carList.get(index).stockLogList.get(index1).productCount++
|
|
this.carList.get(index).productCount = 0
|
|
this.carList.get(index).returnCount = 0
|
|
|
|
this.carList.get(index).stockLogList.forEach(function(value, key) {
|
|
if (value.productCount < 0) {
|
|
that.carList.get(index).returnCount = that.carList.get(index).returnCount + Math.abs(value
|
|
.productCount)
|
|
} else {
|
|
that.carList.get(index).productCount = Number(that.carList.get(index).productCount) + Number(value
|
|
.productCount)
|
|
}
|
|
})
|
|
this.carList.get(index).returnList.forEach(function(value, key) {
|
|
that.carList.get(index).returnCount = that.carList.get(index).returnCount + Math.abs(value
|
|
.productCount)
|
|
})
|
|
this.$nextTick(() => {
|
|
// if (that.discountType != 0) { //单品折扣
|
|
that.carList.get(index).price = Number(that.carList.get(index).productCount) * that.carList
|
|
.get(index).discountAmount
|
|
that.carList.get(index).price = Number(that.carList.get(index).price.toFixed(2))
|
|
// }
|
|
})
|
|
this.$nextTick(() => {
|
|
this.getAllPrice()
|
|
})
|
|
}
|
|
},
|
|
async oneMinusReturnNum(index, index1) {
|
|
this.changePriceStatus()
|
|
let that = this;
|
|
this.carList.get(index).returnCount = 0
|
|
this.carList.get(index).returnList.get(index1).productCount--
|
|
await this.carList.get(index).returnList.forEach(function(value, key) {
|
|
if (value.productCount < 0) {
|
|
that.carList.get(index).returnCount = Number(that.carList.get(index).returnCount) +
|
|
Math.abs(value.productCount)
|
|
}
|
|
})
|
|
await this.carList.get(index).stockLogList.forEach(function(value, key) {
|
|
if (value.productCount < 0) {
|
|
that.carList.get(index).returnCount = that.carList.get(index).returnCount + Math.abs(value
|
|
.productCount)
|
|
}
|
|
})
|
|
this.$forceUpdate()
|
|
this.getAllPrice()
|
|
},
|
|
onePlusReturnNum(index, index1) {
|
|
this.changePriceStatus()
|
|
let that = this;
|
|
this.carList.get(index).returnCount = 0
|
|
if(this.carList.get(index).returnList.get(index1).productCount+1 > 0){
|
|
this.tui.toast('退货数量不能为正数')
|
|
return
|
|
}else{
|
|
this.carList.get(index).returnList.get(index1).productCount++
|
|
}
|
|
|
|
this.carList.get(index).returnList.forEach(function(value, key) {
|
|
if (value.productCount < 0) {
|
|
that.carList.get(index).returnCount = that.carList.get(index).returnCount + Math.abs(value
|
|
.productCount)
|
|
} else if(value.productCount > 0) {
|
|
that.carList.get(index).returnCount = 0
|
|
}
|
|
})
|
|
this.carList.get(index).stockLogList.forEach(function(value, key) {
|
|
if (value.productCount < 0) {
|
|
that.carList.get(index).returnCount = that.carList.get(index).returnCount + Math.abs(value
|
|
.productCount)
|
|
}
|
|
})
|
|
this.$nextTick(() => {
|
|
this.getAllPrice()
|
|
})
|
|
},
|
|
|
|
//实收金额失去焦点
|
|
changessPrice(e) {
|
|
this.relPrice = e
|
|
this.priceOk = this.checkRealPay(this.relPrice)
|
|
this.noPay = this.relPrice - this.priceOk;
|
|
},
|
|
//滨海商贸要求已收金额不计算
|
|
checkRealPay(realPay){
|
|
if(this.shopId == '1838094297858183168' || this.shopId == '1818888277105709056'){
|
|
if(this.isChangePriceOk == false){
|
|
return 0
|
|
}else{
|
|
return this.priceOk
|
|
}
|
|
}else{
|
|
if(this.isChangePriceOk == false){
|
|
return realPay
|
|
}else{
|
|
return this.priceOk
|
|
}
|
|
}
|
|
},
|
|
changePrice(e) {
|
|
this.tanyishou = true
|
|
this.priceOk = e
|
|
this.noPay = this.relPrice - this.priceOk;
|
|
this.noPay = Number(this.noPay.toFixed(2))
|
|
this.leijiqiankuan = Number((Number(this.zhiqianqiankuan) - Number(this.qiankuandikou) + Number(this
|
|
.yuedikou) + Number(this.noPay)).toFixed(2))
|
|
this.$forceUpdate()
|
|
},
|
|
changePriceStatus(){
|
|
this.isChangeShouldPay = false
|
|
this.isChangeReturnPay = false
|
|
this.isChangeRelPrice = false
|
|
this.isChangePriceOk = false
|
|
},
|
|
getImg(key) {
|
|
return this.carList.get(key).productPicture
|
|
},
|
|
//获取客户拿货历史
|
|
getHistoryPrice(id, index,name) {
|
|
this.carList.get(index).stockLogList.get(name).isShowBtn = false
|
|
this.index = index
|
|
this.tui.request("/app/product/getByUserIdAndProductId", "POST", {
|
|
userId: this.khName.id,
|
|
productId: id
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
this.historyList = res1.result
|
|
this.$refs.historyPopup.open()
|
|
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
getText(e){
|
|
this.voiceText = e.detail.value
|
|
},
|
|
//切换销售员
|
|
categoryChange(e) {
|
|
for (let i = 0; i < this.categoryList.length; i++) {
|
|
if (this.categoryList[i].value == e) {
|
|
this.xsyId = e;
|
|
this.createByName = this.categoryList[i].text
|
|
}
|
|
}
|
|
},
|
|
//切换销售员
|
|
payTypeChange(e) {
|
|
for (let i = 0; i < this.payTypeList.length; i++) {
|
|
if (this.payTypeList[i].value == e) {
|
|
this.payType = e;
|
|
}
|
|
}
|
|
},
|
|
//清空语音输入的文字
|
|
clearText() {
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
},
|
|
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件',
|
|
'实价': '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]);
|
|
},
|
|
//编辑挂单信息
|
|
async setDetail(e) {
|
|
if (this.oneGoodsId) {
|
|
this.setOneDetail()
|
|
return
|
|
}
|
|
if (this.voiceText == '') {
|
|
this.tui.toast('识别内容不能为空')
|
|
return
|
|
}
|
|
let convertedStr = this.trimWhitespace(this.voiceText);
|
|
convertedStr = this.convertChineseToArabic(convertedStr);
|
|
if (convertedStr.indexOf('退') != -1 && 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.indexOf('名称') == -1 &&convertedStr.indexOf('单价') == -1 &&convertedStr.indexOf('批发价') == -1){
|
|
convertedStr = convertedStr + ','
|
|
}
|
|
if (convertedStr.indexOf('点') != -1) {
|
|
convertedStr = this.replaceCharAfterNumber(convertedStr, '点', '.')
|
|
}
|
|
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, '名称')
|
|
}
|
|
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, ',退:')
|
|
}
|
|
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
|
|
if((this.shopId == '1863043415453863936' || this.shopId == '1855423693308694528') && 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++) {
|
|
if (this.voiceGetOneData == true) { //模糊搜索
|
|
setTimeout(resData => {
|
|
this.voiceData = this.extractInfo(convertedStr[i] + '。')
|
|
|
|
if (this.voiceData.productSn) {
|
|
this.voiceData.productSn = this.voiceData.productSn.replace(/[沟勾钩]/g,
|
|
'J');
|
|
}
|
|
if (this.voiceData.productCount) {
|
|
this.voiceData.productCount = this.voiceData.productCount.match(
|
|
regexCount);
|
|
}
|
|
|
|
if (this.voiceData.wholesalePrice) {
|
|
this.voiceData.wholesalePrice = this.replaceCharAfterNumber(this
|
|
.voiceData.wholesalePrice, '块', '.')
|
|
if (this.voiceData.wholesalePrice.indexOf('元') != -1) {
|
|
this.voiceData.wholesalePrice = this.voiceData.wholesalePrice.replace(/元/g, '')
|
|
}
|
|
this.voiceData.wholesalePrice = this.voiceData.wholesalePrice.replace(
|
|
/[^0-9.]/g, '');
|
|
}
|
|
if (this.voiceData.wholesalePrice1) {
|
|
this.voiceData.wholesalePrice1 = this.replaceCharAfterNumber(this
|
|
.voiceData.wholesalePrice1, '块', '.')
|
|
if (this.voiceData.wholesalePrice1.indexOf('元') != -1) {
|
|
this.voiceData.wholesalePrice1 = this.voiceData.wholesalePrice1.replace(/元/g, '')
|
|
}
|
|
this.voiceData.wholesalePrice = this.voiceData.wholesalePrice1.replace(
|
|
/[^0-9.]/g, '');
|
|
}
|
|
if (i == convertedStr.length - 1) {
|
|
this.getOneData(this.voiceData, true)
|
|
} else {
|
|
this.getOneData(this.voiceData)
|
|
}
|
|
}, 100 * i)
|
|
} else { //精准搜索
|
|
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.wholesalePrice) {
|
|
voiceData.wholesalePrice = this.replaceCharAfterNumber(voiceData.wholesalePrice,
|
|
'块', '.')
|
|
if (voiceData.indexOf('元') != -1) {
|
|
voiceData.wholesalePrice = voiceData.wholesalePrice.replace(/元/g, '')
|
|
}
|
|
voiceData.wholesalePrice = voiceData.wholesalePrice.replace(/[^0-9.]/g, "");
|
|
}
|
|
if (voiceData.wholesalePrice1) {
|
|
voiceData.wholesalePrice1 = this.replaceCharAfterNumber(voiceData.wholesalePrice1,
|
|
'块', '.')
|
|
if (voiceData.wholesalePrice1.indexOf('元') != -1) {
|
|
voiceData.wholesalePrice1 = voiceData.wholesalePrice1.replace(/元/g, '')
|
|
}
|
|
voiceData.wholesalePrice = voiceData.wholesalePrice1.replace(/[^0-9.]/g, "");
|
|
}
|
|
this.tui.request('/app/product/getByProductSn', "post", {
|
|
customerId:this.khName.id,
|
|
productSn: voiceData.productSn
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.result != '') {
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
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: voiceData.productCount != undefined?Number(voiceData.productCount[0]):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: voiceData.productCount != undefined?Number(voiceData.productCount[0]):1,
|
|
stockCount: res1.result.stock[
|
|
i]
|
|
.stockCount
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
|
|
}
|
|
|
|
setTimeout(ress => {
|
|
res.result[0].productId = res.result[0]
|
|
.id
|
|
res.result[0].stockLogList1 = []
|
|
res.result[0].stockLogList1.push(data)
|
|
if (voiceData.wholesalePrice) {
|
|
res.result[0].wholesalePrice =
|
|
voiceData
|
|
.wholesalePrice
|
|
res.result[0].unitPrice = voiceData
|
|
.wholesalePrice
|
|
res.result[0].discountAmount =
|
|
voiceData
|
|
.wholesalePrice
|
|
res.result[0].returnPrice =
|
|
voiceData
|
|
.wholesalePrice
|
|
}
|
|
if (!res.result[0].productCount) {
|
|
res.result[0].productCount = ''
|
|
}
|
|
if (res.result[0].productCount == '') {
|
|
if (voiceData.productCount < 0) {
|
|
res.result[0].returnCount =
|
|
Number(voiceData.productCount[0])
|
|
res.result[0].returnPrice = res
|
|
.result[
|
|
0].wholesalePrice
|
|
} else {
|
|
res.result[0].productCount =
|
|
Number(voiceData.productCount)
|
|
}
|
|
|
|
}
|
|
let purchaseDetails = res.result
|
|
|
|
let id = this.oneGoodsId
|
|
if (purchaseDetails.length > 0) {
|
|
this.carList1 = purchaseDetails
|
|
this.$nextTick(() => {
|
|
this.AiHandleData()
|
|
})
|
|
|
|
} else {
|
|
this.tui.toast(
|
|
"抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确"
|
|
)
|
|
}
|
|
}, 500 * i)
|
|
} else {
|
|
this.tui.toast(res1.message)
|
|
}
|
|
}).catch((res) => {})
|
|
|
|
|
|
} else {
|
|
this.tui.toast(voiceData.productSn+'为新商品,请点击顶部“新增商品”按钮添加')
|
|
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
} 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, '件,')
|
|
}
|
|
this.tui.request("/app/sale/buyAi", "POST", {
|
|
customerId: this.khName.id,
|
|
aiMsg: this.getMsg
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if(res.result.data.length > 0){
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.close()
|
|
this.aiNotRecognition = res.result.aiNotRecognition
|
|
// if (this.isInventory == true) {
|
|
let newData = []
|
|
|
|
for (let i = 0; i < res.result.data.length; i++) {
|
|
let newList = []
|
|
let newProduct = true
|
|
if (res.result.data[i].productId == null) {
|
|
this.tui.toast(res.result.data[i].productSn+'为新商品,请点击顶部“新增商品”按钮添加')
|
|
// res.result.data[i].isNew = true
|
|
// res.result.data[i].productId = res.result.data[i].productSn || res.result
|
|
// .data[i].productName
|
|
|
|
/* return; */
|
|
} else {
|
|
newProduct = false
|
|
res.result.data[i].isNew = false
|
|
}
|
|
if(!newProduct){
|
|
// res.result.data[i].productCount = 0
|
|
if (res.result.data[i].stockLogList1.length > 0) {
|
|
for (let m = 0; m < res.result.data[i].stockLogList1.length; m++) {
|
|
// if (res.result.data[i].stockLogList1[m].stockCount != null) {
|
|
newList.push(res.result.data[i].stockLogList1[m])
|
|
// }
|
|
}
|
|
} else {
|
|
let data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
name: '均色 | 均码',
|
|
productCount: 1,
|
|
productNum: null
|
|
}
|
|
newList.push(data)
|
|
}
|
|
|
|
|
|
res.result.data[i].stockLogList1 = newList
|
|
if (newList.length > 0) {
|
|
newData.push(res.result.data[i])
|
|
}
|
|
}
|
|
}
|
|
if(newData.length > 0){
|
|
this.carList1 = newData
|
|
// } else {
|
|
// this.carList1 = res.result.data
|
|
// }
|
|
|
|
if (res.result.aiNotRecognition != '') {
|
|
this.$refs.AiNoPopup.open()
|
|
}
|
|
this.$nextTick(() => {
|
|
this.AiHandleData()
|
|
})
|
|
}
|
|
}else{
|
|
this.tui.toast(voiceData.productSn+'为新商品,请点击顶部“新增商品”按钮添加')
|
|
}
|
|
|
|
} else {
|
|
this.tui.toast("抱歉:小助手对" + this.getMsg + "的部分商品未识别,请检查识别信息是否正确")
|
|
}
|
|
}).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, '件,')
|
|
}
|
|
this.tui.request("/app/sale/buyAi", "POST", {
|
|
customerId: this.khName.id,
|
|
aiMsg: this.getMsg
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if(res.result.data.length > 0){
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.close()
|
|
this.aiNotRecognition = res.result.aiNotRecognition
|
|
// if (this.isInventory == true) {
|
|
let newData = []
|
|
for (let i = 0; i < res.result.data.length; i++) {
|
|
let newList = []
|
|
let newProduct = true
|
|
if (res.result.data[i].productId == null) {
|
|
this.tui.toast(res.result.data[i].productSn+'为新商品,请点击顶部“新增商品”按钮添加')
|
|
// res.result.data[i].isNew = true
|
|
// res.result.data[i].productId = res.result.data[i].productSn || res.result
|
|
// .data[i].productName
|
|
|
|
/* return; */
|
|
} else {
|
|
newProduct = false
|
|
res.result.data[i].isNew = false
|
|
}
|
|
if(!newProduct){
|
|
// res.result.data[i].productCount = 0
|
|
if (res.result.data[i].stockLogList1.length > 0) {
|
|
for (let m = 0; m < res.result.data[i].stockLogList1.length; m++) {
|
|
// if (res.result.data[i].stockLogList1[m].stockCount != null) {
|
|
newList.push(res.result.data[i].stockLogList1[m])
|
|
// }
|
|
}
|
|
} else {
|
|
let data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
name: '均色 | 均码',
|
|
productCount: 1,
|
|
productNum: null
|
|
}
|
|
newList.push(data)
|
|
}
|
|
|
|
|
|
res.result.data[i].stockLogList1 = newList
|
|
if (newList.length > 0) {
|
|
newData.push(res.result.data[i])
|
|
}
|
|
}
|
|
}
|
|
if(newData.length > 0){
|
|
this.carList1 = newData
|
|
// } else {
|
|
// this.carList1 = res.result.data
|
|
// }
|
|
|
|
if (res.result.aiNotRecognition != '') {
|
|
this.$refs.AiNoPopup.open()
|
|
}
|
|
this.$nextTick(() => {
|
|
this.AiHandleData()
|
|
})
|
|
}
|
|
}else{
|
|
this.tui.toast(voiceData.productSn+'为新商品,请点击顶部“新增商品”按钮添加')
|
|
}
|
|
|
|
} else {
|
|
this.tui.toast("抱歉:小助手对" + this.getMsg + "的部分商品未识别,请检查识别信息是否正确")
|
|
}
|
|
}).catch((res) => {
|
|
this.tui.toast(res)
|
|
})
|
|
}
|
|
},
|
|
//去掉空格和换行
|
|
trimWhitespace(str) {
|
|
return str.replace(/\s+/g, '');
|
|
},
|
|
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) => {})
|
|
},
|
|
//编辑挂单信息
|
|
async setOneDetail(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.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.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.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
|
|
if((this.shopId == '1863043415453863936' || this.shopId == '1855423693308694528') && 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++) {
|
|
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.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.wholesalePrice1) {
|
|
voiceData.wholesalePrice1 = this.replaceCharAfterNumber(voiceData.wholesalePrice1, '块',
|
|
'.')
|
|
if (voiceData.wholesalePrice1.indexOf('元') != -1) {
|
|
this.voiceData.wholesalePrice1 = this.voiceData.wholesalePrice1.replace(/元/g, '')
|
|
}
|
|
voiceData.wholesalePrice = voiceData.wholesalePrice1.replace(/[^0-9.]/g, "");
|
|
}
|
|
if(this.voiceGetOneData == true){
|
|
let oldProduCount = 1
|
|
if(this.carList.get(this.oneGoodsId).productCount == 1 && this.carList.get(this.oneGoodsId).stockLogList.size == 1 && this.carList.get(this.oneGoodsId).stockLogList.get('{"颜色":"均色","尺码":"均码"}').productCount == 1){
|
|
this.carList.get(this.oneGoodsId).productCount = 0
|
|
this.carList.get(this.oneGoodsId).stockLogList.get('{"颜色":"均色","尺码":"均码"}').productCount = 0
|
|
}else{
|
|
if(voiceData.productCount == undefined){
|
|
oldProduCount = 0
|
|
}
|
|
}
|
|
|
|
this.tui.request('/app/product/getShareList', "post", {
|
|
customerId:this.khName.id,
|
|
categoryId: "",
|
|
pageNum: 1,
|
|
pageSize: '1000',
|
|
searchStr: voiceData.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++) {
|
|
res.result.records[i].stockLogList1 = []
|
|
if (voiceData.wholesalePrice) {
|
|
res.result.records[i].wholesalePrice = voiceData.wholesalePrice
|
|
res.result.records[i].unitPrice = voiceData.wholesalePrice
|
|
res.result.records[i].discountAmount = voiceData.wholesalePrice
|
|
|
|
}
|
|
if(voiceData.productCount){
|
|
res.result.records[i].productCount = Number(voiceData.productCount[0])
|
|
}
|
|
let data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
productCount: voiceData.productCount != undefined ? Number(voiceData.productCount[0]):oldProduCount,
|
|
stockCount: res.result.records[i].defaultStockCount
|
|
}
|
|
|
|
res.result.records[i].stockLogList1.push(data)
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
this.moreData.push(res.result.records)
|
|
this.oneData = voiceData
|
|
})
|
|
|
|
} else {
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.close();
|
|
let data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
productCount: voiceData.productCount != undefined ? Number(voiceData.productCount[0]):oldProduCount,
|
|
stockCount: res.result.records[0].defaultStockCount
|
|
}
|
|
|
|
setTimeout(ress => {
|
|
res.result.records[0].productId = res.result.records[0].id
|
|
res.result.records[0].stockLogList1 = []
|
|
res.result.records[0].stockLogList1.push(data)
|
|
if (voiceData.wholesalePrice) {
|
|
res.result.records[0].wholesalePrice =
|
|
voiceData.wholesalePrice
|
|
}
|
|
let purchaseDetails = res.result.records
|
|
|
|
let id = this.oneGoodsId
|
|
if (purchaseDetails.length > 0) {
|
|
this.carList.get(id)
|
|
.customerCategoryList =
|
|
purchaseDetails[0]
|
|
.customerCategoryRule != null ?JSON.parse(purchaseDetails[0]
|
|
.customerCategoryRule):null
|
|
this.carList.get(id)
|
|
.buyCount =purchaseDetails[0].buyCount
|
|
|
|
if(this.khName.categoryId != null && this.khName.categoryId != ''){
|
|
if(this.carList.get(id).customerCategoryList != null){
|
|
for(let i=0;i<this.carList.get(id).customerCategoryList.length;i++){
|
|
if(this.khName.categoryId == this.carList.get(id).customerCategoryList[i].categoryId){
|
|
if(this.carList.get(id).customerCategoryList[i].categoryPrice != ''){
|
|
if(this.carList.get(id).unitPrice == this.carList.get(id).wholesalePrice){
|
|
this.carList.get(id).discountAmount = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
this.carList.get(id).unitPrice = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
}
|
|
if(this.carList.get(id).returnPrice == this.carList.get(id).wholesalePrice){
|
|
this.carList.get(id).returnPrice = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
this.carList.get(id).discountAmount = this.carList.get(id).unitPrice
|
|
}
|
|
|
|
}else{
|
|
this.carList.get(id).discountAmount = this.carList.get(id).unitPrice
|
|
}
|
|
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)
|
|
.wholesalePrice == ''
|
|
) {
|
|
this.carList.get(id)
|
|
.wholesalePrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
if (this.carList.get(id)
|
|
.productCount == '') {
|
|
if (purchaseDetails[0]
|
|
.productCount < 0
|
|
) {
|
|
this.carList.get(id)
|
|
.returnCount =
|
|
Number(purchaseDetails[0]
|
|
.productCount)
|
|
this.carList.get(
|
|
id)
|
|
.returnPrice =
|
|
this.carList.get(
|
|
id)
|
|
.returnPrice != ''?this.carList.get(
|
|
id)
|
|
.returnPrice:
|
|
purchaseDetails[0].wholesalePrice
|
|
} else {
|
|
this.carList.get(id)
|
|
.productCount =
|
|
Number(purchaseDetails[0]
|
|
.productCount)
|
|
}
|
|
|
|
}
|
|
if (purchaseDetails[0]
|
|
.wholesalePrice) {
|
|
this.carList.get(id)
|
|
.discountAmount =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id)
|
|
.unitPrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
if (this.carList.get(id)
|
|
.unitPrice == '') {
|
|
this.carList.get(id)
|
|
.unitPrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
if (this.carList.get(id)
|
|
.categoryId == '') {
|
|
this.carList.get(id)
|
|
.categoryId =
|
|
purchaseDetails[0]
|
|
.categoryId
|
|
}
|
|
if (this.carList.get(id)
|
|
.categoryName == '') {
|
|
this.carList.get(id)
|
|
.categoryName =
|
|
purchaseDetails[0]
|
|
.categoryName
|
|
}
|
|
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)
|
|
.productPicture == ''
|
|
) {
|
|
this.carList.get(id)
|
|
.productPicture =
|
|
purchaseDetails[0]
|
|
.productPicture
|
|
}
|
|
if (this.carList.get(id)
|
|
.returnPrice == '') {
|
|
this.carList.get(id)
|
|
.returnPrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
if (this.carList.get(id)
|
|
.productId == '') {
|
|
this.carList.get(id)
|
|
.productId =
|
|
purchaseDetails[0]
|
|
.id
|
|
}
|
|
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 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&&
|
|
purchaseDetails[0]
|
|
.stockLogList1.length > 0) {
|
|
this.carList.get(id)
|
|
.stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
}
|
|
this.carList.get(id).price = Number(this
|
|
.carList.get(id).productCount) *
|
|
this.carList.get(id)
|
|
.wholesalePrice
|
|
} 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 =
|
|
purchaseDetails[0]
|
|
.customerCategoryRule != null ?JSON.parse(purchaseDetails[0]
|
|
.customerCategoryRule):null
|
|
|
|
|
|
if (this.carList.get(id)
|
|
.productPicture == '') {
|
|
this.carList.get(id)
|
|
.productPicture =
|
|
purchaseDetails[0]
|
|
.productPicture
|
|
}
|
|
if (this.carList.get(id)
|
|
.productId == '') {
|
|
this.carList.get(id)
|
|
.productId =
|
|
purchaseDetails[0].id
|
|
}
|
|
if (this.carList.get(id)
|
|
.returnPrice == '') {
|
|
this.carList.get(id)
|
|
.returnPrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
/* this.carList.get(id).returnCount =
|
|
0
|
|
this.carList.get(id).productCount =
|
|
0 */
|
|
if (purchaseDetails[0].productId) {
|
|
this.carList.get(id).attrId =
|
|
purchaseDetails[0].attrId
|
|
this.carList.get(id)
|
|
.wholesalePrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id)
|
|
.discountAmount =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id)
|
|
.unitPrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id).lsprice =
|
|
purchaseDetails[0].price
|
|
this.carList.get(id).price =
|
|
purchaseDetails[0]
|
|
.wholesalePrice * Number(this
|
|
.carList.get(id)
|
|
.productCount)
|
|
if(this.khName.categoryId != null && this.khName.categoryId != ''){
|
|
if(this.carList.get(id).customerCategoryList != null){
|
|
for(let i=0;i<this.carList.get(id).customerCategoryList.length;i++){
|
|
if(this.khName.categoryId == this.carList.get(id).customerCategoryList[i].categoryId){
|
|
if(this.carList.get(id).customerCategoryList[i].categoryPrice != ''){
|
|
|
|
if(this.carList.get(id).unitPrice == this.carList.get(id).wholesalePrice){
|
|
this.carList.get(id).discountAmount = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
this.carList.get(id).unitPrice = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
}
|
|
if(this.carList.get(id).returnPrice == this.carList.get(id).wholesalePrice){
|
|
this.carList.get(id).returnPrice = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
this.carList.get(id).discountAmount = this.carList.get(id).unitPrice
|
|
}
|
|
|
|
}else{
|
|
this.carList.get(id).discountAmount = this.carList.get(id).unitPrice
|
|
}
|
|
} else {
|
|
this.carList.get(id)
|
|
.productId =
|
|
purchaseDetails[0].id
|
|
this.carList.get(id)
|
|
.wholesalePrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id)
|
|
.discountAmount =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id).lsprice =
|
|
purchaseDetails[0].price
|
|
this.carList.get(id).price =
|
|
purchaseDetails[0]
|
|
.wholesalePrice * Number(this
|
|
.carList.get(id)
|
|
.productCount)
|
|
}
|
|
|
|
let specMap =
|
|
new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList.forEach(
|
|
function(value,
|
|
key) {
|
|
if (key !=
|
|
value
|
|
.id) {
|
|
specMap
|
|
.set(
|
|
value
|
|
.productId?value
|
|
.productId: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
|
|
]
|
|
)
|
|
}
|
|
}
|
|
if (purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount <
|
|
0) {
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.returnCount +=
|
|
Math
|
|
.abs(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount
|
|
)
|
|
} else {
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.productCount +=
|
|
Number(purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount)
|
|
}
|
|
|
|
}
|
|
}
|
|
this.carList.get(id)
|
|
.price = Number(this
|
|
.carList.get(id)
|
|
.productCount) *
|
|
this.carList.get(
|
|
id)
|
|
.wholesalePrice
|
|
if (this.carList.get(
|
|
id)
|
|
.stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
.productCount ==
|
|
0 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1 &&
|
|
purchaseDetails[0]
|
|
.stockLogList1
|
|
.length > 0) {
|
|
this.carList.get(
|
|
id)
|
|
.stockLogList
|
|
.delete(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
}
|
|
})
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
this.getAmountAndWho()
|
|
this.oneGoodsId = ''
|
|
})
|
|
} else {
|
|
this.tui.toast(
|
|
"抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
}, 500)
|
|
}
|
|
|
|
|
|
|
|
} 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.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.wholesalePrice1) {
|
|
voiceData.wholesalePrice1 = this.replaceCharAfterNumber(voiceData
|
|
.wholesalePrice1, '块', '.')
|
|
if (voiceData.wholesalePrice1.indexOf('元') != -1) {
|
|
voiceData.wholesalePrice1 = voiceData.wholesalePrice1.replace(/元/g, '')
|
|
}
|
|
voiceData.wholesalePrice = voiceData.wholesalePrice1.replace(
|
|
/[^0-9.]/g, "");
|
|
}
|
|
let data = {
|
|
id: voiceData.productSn,
|
|
productCount: Number(voiceData.productCount)>=0?Number(voiceData.productCount):0,
|
|
returnCount: Number(voiceData.productCount)<0?Math.abs(Number(voiceData.productCount)):0,
|
|
productName: voiceData.productName,
|
|
productSn: voiceData.productSn,
|
|
customerCategoryList:null,
|
|
buyCount:null,
|
|
categoryId: this.fenleiList.categoryId,
|
|
categoryName: this.fenleiList.categoryName,
|
|
unitPrice: voiceData.wholesalePrice || 0,
|
|
discountAmount: voiceData.wholesalePrice || 0,
|
|
wholesalePrice: voiceData.wholesalePrice || 0,
|
|
returnPrice: voiceData.wholesalePrice || 0,
|
|
stockLogList1: [{
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
productCount: Number(voiceData.productCount) || oldProduCount,
|
|
stockCount: null
|
|
}]
|
|
}
|
|
let purchaseDetails = []
|
|
purchaseDetails.push(data)
|
|
let id = this.oneGoodsId
|
|
if (purchaseDetails.length > 0) {
|
|
if (this.carList.get(id).productSn != '') {
|
|
for (let j = 0; j < purchaseDetails.length; j++) {
|
|
this.carList.get(id)
|
|
.buyCount =purchaseDetails[j].buyCount
|
|
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) {
|
|
this.carList.get(id).purchasePrice =
|
|
purchaseDetails[0].purchasePrice
|
|
}
|
|
if (this.carList.get(id).returnPrice == '') {
|
|
this.carList.get(id).returnPrice = purchaseDetails[
|
|
0].wholesalePrice
|
|
}
|
|
if (this.carList.get(id).productPicture == '') {
|
|
this.carList.get(id).productPicture =
|
|
purchaseDetails[0].productPicture
|
|
}
|
|
if (this.carList.get(id).wholesalePrice == '') {
|
|
this.carList.get(id).wholesalePrice =
|
|
purchaseDetails[0].wholesalePrice
|
|
this.carList.get(id).unitPrice =
|
|
purchaseDetails[0].wholesalePrice
|
|
}
|
|
|
|
if (this.carList.get(id).discountAmount == '') {
|
|
this.carList.get(id).discountAmount =
|
|
purchaseDetails[0].wholesalePrice
|
|
this.carList.get(id).unitPrice = purchaseDetails[0].wholesalePrice
|
|
}
|
|
|
|
if (this.carList.get(id).categoryId == '') {
|
|
this.carList.get(id).categoryId = purchaseDetails[
|
|
0].categoryId
|
|
}
|
|
if (this.carList.get(id).categoryName == '') {
|
|
this.carList.get(id).categoryName =
|
|
purchaseDetails[0].categoryName
|
|
}
|
|
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])
|
|
}
|
|
}
|
|
if (this.carList.get(id).productCount == '') {
|
|
this.carList.get(id).productCount =
|
|
Number(purchaseDetails[0].productCount)
|
|
}else{
|
|
if(Number(purchaseDetails[j].stockLogList1[i].productCount) >=0){
|
|
this.carList.get(id).productCount += Number(purchaseDetails[j]
|
|
.stockLogList1[i].productCount)
|
|
}else{
|
|
this.carList.get(id).returnCount += Math.abs(Number(purchaseDetails[j]
|
|
.stockLogList1[i].productCount))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}').productCount == 0 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&&
|
|
purchaseDetails[0].stockLogList1.length > 0) {
|
|
this.carList.get(id).stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
this.carList.get(id).price = Number(this.carList.get(id)
|
|
.productCount) * this.carList.get(id).wholesalePrice
|
|
} 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
|
|
}
|
|
if (this.carList.get(id).productPicture == '') {
|
|
this.carList.get(id).productPicture = purchaseDetails[0]
|
|
.productPicture
|
|
}
|
|
if (this.carList.get(id).returnPrice == '') {
|
|
this.carList.get(id).returnPrice = purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
if (purchaseDetails[0].productId) {
|
|
this.carList.get(id).attrId = purchaseDetails[0].attrId
|
|
|
|
this.carList.get(id).lsprice = purchaseDetails[0].lsprice
|
|
}
|
|
if (that.carList.get(id).wholesalePrice == '' || that.carList
|
|
.get(id).wholesalePrice == null) {
|
|
if(that.carList.get(id).discountAmount == '' || that.carList
|
|
.get(id).discountAmount == null){
|
|
that.carList.get(id).wholesalePrice = purchaseDetails[0]
|
|
.wholesalePrice
|
|
that.carList.get(id).unitPrice = purchaseDetails[0]
|
|
.wholesalePrice
|
|
}else{
|
|
that.carList.get(id).wholesalePrice = that.carList.get(id).discountAmount
|
|
that.carList.get(id).unitPrice = that.carList.get(id).discountAmount
|
|
}
|
|
|
|
}
|
|
if (that.carList.get(id).discountAmount == '' || that.carList
|
|
.get(id).discountAmount == null) {
|
|
that.carList.get(id).discountAmount = purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
|
|
that.carList.get(id).lsprice = purchaseDetails[0].price
|
|
that.carList.get(id).price = Number((that.carList.get(id).discountAmount * Number(purchaseDetails[0].productCount)).toFixed(2))
|
|
let specMap = new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList.forEach(function(value, key) {
|
|
if (key != value.id) {
|
|
specMap.set(value.productId?value.productId: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])
|
|
}
|
|
}
|
|
if(Number(purchaseDetails[j].stockLogList1[i]
|
|
.productCount) >=0){
|
|
this.carList.get(id).productCount +=
|
|
Number(purchaseDetails[j].stockLogList1[i]
|
|
.productCount)
|
|
}else{
|
|
this.carList.get(id).returnCount +=
|
|
Math.abs(Number(purchaseDetails[j].stockLogList1[i]
|
|
.productCount))
|
|
}
|
|
}
|
|
}
|
|
this.carList.get(id).price = Number(this.carList.get(id)
|
|
.productCount) * this.carList.get(id)
|
|
.discountAmount
|
|
if (this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}').productCount ==
|
|
0 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&& purchaseDetails[0].stockLogList1.length >
|
|
0) {
|
|
this.carList.get(id).stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
})
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
this.getAmountAndWho()
|
|
this.oneGoodsId = ''
|
|
})
|
|
} else {
|
|
this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
|
|
}
|
|
setTimeout(res => {
|
|
if (this.moreData.length > 0) {
|
|
this.$refs.popup.close()
|
|
this.$refs.oneDataPopup.open()
|
|
this.showPopup(0)
|
|
}
|
|
}, 300)
|
|
|
|
}
|
|
})
|
|
}else{
|
|
let oldProduCount = 1
|
|
if(this.carList.get(this.oneGoodsId).productCount == 1 && this.carList.get(this.oneGoodsId).stockLogList.size == 1 && this.carList.get(this.oneGoodsId).stockLogList.get('{"颜色":"均色","尺码":"均码"}').productCount == 1){
|
|
this.carList.get(this.oneGoodsId).productCount = 0
|
|
this.carList.get(this.oneGoodsId).stockLogList.get('{"颜色":"均色","尺码":"均码"}').productCount = 0
|
|
}else{
|
|
if(voiceData.productCount == undefined){
|
|
oldProduCount = 0
|
|
}
|
|
}
|
|
this.tui.request('/app/product/getByProductSn', "post", {
|
|
customerId:this.khName.id,
|
|
productSn: voiceData.productSn
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.result != '') {
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
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) || oldProduCount,
|
|
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) || oldProduCount,
|
|
stockCount: res1.result.stock[i]
|
|
.stockCount
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
|
|
}
|
|
|
|
setTimeout(ress => {
|
|
res.result[0].productId = res.result[0].id
|
|
res.result[0].stockLogList1 = []
|
|
res.result[0].stockLogList1.push(data)
|
|
if (voiceData.wholesalePrice) {
|
|
res.result[0].wholesalePrice =
|
|
voiceData.wholesalePrice
|
|
}
|
|
let purchaseDetails = res.result
|
|
|
|
let id = this.oneGoodsId
|
|
if (purchaseDetails.length > 0) {
|
|
this.carList.get(id)
|
|
.buyCount =purchaseDetails[0].buyCount
|
|
this.carList.get(id)
|
|
.customerCategoryList =
|
|
purchaseDetails[0]
|
|
.customerCategoryRule != null ?JSON.parse(purchaseDetails[0]
|
|
.customerCategoryRule):null
|
|
|
|
if(this.khName.categoryId != null && this.khName.categoryId != ''){
|
|
if(this.carList.get(id).customerCategoryList != null){
|
|
for(let i=0;i<this.carList.get(id).customerCategoryList.length;i++){
|
|
if(this.khName.categoryId == this.carList.get(id).customerCategoryList[i].categoryId){
|
|
if(this.carList.get(id).customerCategoryList[i].categoryPrice != ''){
|
|
if(this.carList.get(id).unitPrice == this.carList.get(id).wholesalePrice){
|
|
this.carList.get(id).discountAmount = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
this.carList.get(id).unitPrice = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
}
|
|
if(this.carList.get(id).returnPrice == this.carList.get(id).wholesalePrice){
|
|
this.carList.get(id).returnPrice = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
this.carList.get(id).discountAmount = this.carList.get(id).unitPrice
|
|
}
|
|
|
|
}else{
|
|
this.carList.get(id).discountAmount = this.carList.get(id).unitPrice
|
|
}
|
|
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)
|
|
.wholesalePrice == ''
|
|
) {
|
|
this.carList.get(id)
|
|
.wholesalePrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
if (this.carList.get(id)
|
|
.productCount == '') {
|
|
if (purchaseDetails[0]
|
|
.productCount < 0
|
|
) {
|
|
this.carList.get(id)
|
|
.returnCount =
|
|
Number(purchaseDetails[0]
|
|
.productCount)
|
|
this.carList.get(
|
|
id)
|
|
.returnPrice =
|
|
this.carList.get(
|
|
id)
|
|
.returnPrice != ''?this.carList.get(
|
|
id)
|
|
.returnPrice:
|
|
purchaseDetails[0].wholesalePrice
|
|
} else {
|
|
this.carList.get(id)
|
|
.productCount =
|
|
Number(purchaseDetails[0]
|
|
.productCount)
|
|
}
|
|
|
|
}
|
|
if (purchaseDetails[0]
|
|
.wholesalePrice) {
|
|
this.carList.get(id)
|
|
.discountAmount =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id)
|
|
.unitPrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
if (this.carList.get(id)
|
|
.unitPrice == '') {
|
|
this.carList.get(id)
|
|
.unitPrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
if (this.carList.get(id)
|
|
.categoryId == '') {
|
|
this.carList.get(id)
|
|
.categoryId =
|
|
purchaseDetails[0]
|
|
.categoryId
|
|
}
|
|
if (this.carList.get(id)
|
|
.categoryName == '') {
|
|
this.carList.get(id)
|
|
.categoryName =
|
|
purchaseDetails[0]
|
|
.categoryName
|
|
}
|
|
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)
|
|
.productPicture == ''
|
|
) {
|
|
this.carList.get(id)
|
|
.productPicture =
|
|
purchaseDetails[0]
|
|
.productPicture
|
|
}
|
|
if (this.carList.get(id)
|
|
.returnPrice == '') {
|
|
this.carList.get(id)
|
|
.returnPrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
if (this.carList.get(id)
|
|
.productId == '') {
|
|
this.carList.get(id)
|
|
.productId =
|
|
purchaseDetails[0]
|
|
.id
|
|
}
|
|
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 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&&
|
|
purchaseDetails[0]
|
|
.stockLogList1.length > 0) {
|
|
this.carList.get(id)
|
|
.stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
}
|
|
this.carList.get(id).price = Number(this
|
|
.carList.get(id).productCount) *
|
|
this.carList.get(id)
|
|
.wholesalePrice
|
|
} 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 =
|
|
purchaseDetails[0]
|
|
.customerCategoryRule != null ?JSON.parse(purchaseDetails[0]
|
|
.customerCategoryRule):null
|
|
|
|
|
|
if (this.carList.get(id)
|
|
.productPicture == '') {
|
|
this.carList.get(id)
|
|
.productPicture =
|
|
purchaseDetails[0]
|
|
.productPicture
|
|
}
|
|
if (this.carList.get(id)
|
|
.productId == '') {
|
|
this.carList.get(id)
|
|
.productId =
|
|
purchaseDetails[0].id
|
|
}
|
|
if (this.carList.get(id)
|
|
.returnPrice == '') {
|
|
this.carList.get(id)
|
|
.returnPrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
/* this.carList.get(id).returnCount =
|
|
0
|
|
this.carList.get(id).productCount =
|
|
0 */
|
|
if (purchaseDetails[0].productId) {
|
|
this.carList.get(id).attrId =
|
|
purchaseDetails[0].attrId
|
|
this.carList.get(id)
|
|
.wholesalePrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id)
|
|
.discountAmount =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id)
|
|
.unitPrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id).lsprice =
|
|
purchaseDetails[0].price
|
|
this.carList.get(id).price =
|
|
purchaseDetails[0]
|
|
.wholesalePrice * Number(this
|
|
.carList.get(id)
|
|
.productCount)
|
|
if(this.khName.categoryId != null && this.khName.categoryId != ''){
|
|
if(this.carList.get(id).customerCategoryList != null){
|
|
for(let i=0;i<this.carList.get(id).customerCategoryList.length;i++){
|
|
if(this.khName.categoryId == this.carList.get(id).customerCategoryList[i].categoryId){
|
|
if(this.carList.get(id).customerCategoryList[i].categoryPrice != ''){
|
|
|
|
if(this.carList.get(id).unitPrice == this.carList.get(id).wholesalePrice){
|
|
this.carList.get(id).discountAmount = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
this.carList.get(id).unitPrice = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
}
|
|
if(this.carList.get(id).returnPrice == this.carList.get(id).wholesalePrice){
|
|
this.carList.get(id).returnPrice = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
this.carList.get(id).discountAmount = this.carList.get(id).unitPrice
|
|
}
|
|
|
|
}else{
|
|
this.carList.get(id).discountAmount = this.carList.get(id).unitPrice
|
|
}
|
|
} else {
|
|
this.carList.get(id)
|
|
.productId =
|
|
purchaseDetails[0].id
|
|
this.carList.get(id)
|
|
.wholesalePrice =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id)
|
|
.discountAmount =
|
|
purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id).lsprice =
|
|
purchaseDetails[0].price
|
|
this.carList.get(id).price =
|
|
purchaseDetails[0]
|
|
.wholesalePrice * Number(this
|
|
.carList.get(id)
|
|
.productCount)
|
|
}
|
|
|
|
let specMap =
|
|
new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList.forEach(
|
|
function(value,
|
|
key) {
|
|
if (key !=
|
|
value
|
|
.id) {
|
|
specMap
|
|
.set(
|
|
value
|
|
.productId?value
|
|
.productId: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
|
|
]
|
|
)
|
|
}
|
|
}
|
|
if (purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount <
|
|
0) {
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.returnCount +=
|
|
Math
|
|
.abs(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount
|
|
)
|
|
} else {
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.productCount +=
|
|
Number(purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount)
|
|
}
|
|
|
|
}
|
|
}
|
|
this.carList.get(id)
|
|
.price = Number(this
|
|
.carList.get(id)
|
|
.productCount) *
|
|
this.carList.get(
|
|
id)
|
|
.wholesalePrice
|
|
if (this.carList.get(
|
|
id)
|
|
.stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
.productCount ==
|
|
0 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&&
|
|
purchaseDetails[0]
|
|
.stockLogList1
|
|
.length > 0) {
|
|
this.carList.get(
|
|
id)
|
|
.stockLogList
|
|
.delete(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
}
|
|
})
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
this.getAmountAndWho()
|
|
this.oneGoodsId = ''
|
|
})
|
|
} else {
|
|
this.tui.toast(
|
|
"抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
}, 500)
|
|
} 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.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.wholesalePrice1) {
|
|
voiceData.wholesalePrice1 = this.replaceCharAfterNumber(voiceData
|
|
.wholesalePrice1, '块', '.')
|
|
if (voiceData.wholesalePrice1.indexOf('元') != -1) {
|
|
voiceData.wholesalePrice1 = voiceData.wholesalePrice1.replace(/元/g, '')
|
|
}
|
|
voiceData.wholesalePrice = voiceData.wholesalePrice1.replace(
|
|
/[^0-9.]/g, "");
|
|
}
|
|
let data = {
|
|
id: voiceData.productSn,
|
|
productCount: Number(voiceData.productCount) || 0,
|
|
productName: voiceData.productName,
|
|
productSn: voiceData.productSn,
|
|
customerCategoryList:null,
|
|
buyCount:null,
|
|
categoryId: this.fenleiList.categoryId,
|
|
categoryName: this.fenleiList.categoryName,
|
|
unitPrice: voiceData.wholesalePrice || 0,
|
|
discountAmount: voiceData.wholesalePrice || 0,
|
|
wholesalePrice: voiceData.wholesalePrice || 0,
|
|
stockLogList1: [{
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
productCount: Number(voiceData.productCount) || oldProduCount,
|
|
stockCount: null
|
|
}]
|
|
}
|
|
let purchaseDetails = []
|
|
purchaseDetails.push(data)
|
|
let id = this.oneGoodsId
|
|
if (purchaseDetails.length > 0) {
|
|
if (this.carList.get(id).productSn != '') {
|
|
for (let j = 0; j < purchaseDetails.length; j++) {
|
|
this.carList.get(id)
|
|
.buyCount =purchaseDetails[j].buyCount
|
|
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) {
|
|
this.carList.get(id).purchasePrice =
|
|
purchaseDetails[0].purchasePrice
|
|
}
|
|
if (this.carList.get(id).returnPrice == '') {
|
|
this.carList.get(id).returnPrice = purchaseDetails[
|
|
0].wholesalePrice
|
|
}
|
|
if (this.carList.get(id).productPicture == '') {
|
|
this.carList.get(id).productPicture =
|
|
purchaseDetails[0].productPicture
|
|
}
|
|
if (this.carList.get(id).wholesalePrice == '') {
|
|
if(this.carList.get(id).discountAmount == ''){
|
|
this.carList.get(id).wholesalePrice =
|
|
purchaseDetails[0].wholesalePrice
|
|
this.carList.get(id).unitPrice =
|
|
purchaseDetails[0].wholesalePrice
|
|
}else{
|
|
this.carList.get(id).wholesalePrice =
|
|
this.carList.get(id).discountAmount
|
|
this.carList.get(id).unitPrice =
|
|
this.carList.get(id).discountAmount
|
|
}
|
|
|
|
}
|
|
if (this.carList.get(id).productCount == '') {
|
|
this.carList.get(id).productCount =
|
|
Number(purchaseDetails[0].productCount)
|
|
}
|
|
if (this.carList.get(id).discountAmount == '') {
|
|
this.carList.get(id).discountAmount =
|
|
purchaseDetails[0].wholesalePrice
|
|
this.carList.get(id).unitPrice = purchaseDetails[0].wholesalePrice
|
|
}
|
|
|
|
if (this.carList.get(id).categoryId == '') {
|
|
this.carList.get(id).categoryId = purchaseDetails[
|
|
0].categoryId
|
|
}
|
|
if (this.carList.get(id).categoryName == '') {
|
|
this.carList.get(id).categoryName =
|
|
purchaseDetails[0].categoryName
|
|
}
|
|
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 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&&
|
|
purchaseDetails[0].stockLogList1.length > 0) {
|
|
this.carList.get(id).stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
this.carList.get(id).price = Number(this.carList.get(id)
|
|
.productCount) * this.carList.get(id).discountAmount
|
|
} 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
|
|
}
|
|
if (this.carList.get(id).productPicture == '') {
|
|
this.carList.get(id).productPicture = purchaseDetails[0]
|
|
.productPicture
|
|
}
|
|
if (this.carList.get(id).returnPrice == '') {
|
|
this.carList.get(id).returnPrice = purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
if (purchaseDetails[0].productId) {
|
|
this.carList.get(id).attrId = purchaseDetails[0].attrId
|
|
|
|
this.carList.get(id).lsprice = purchaseDetails[0].lsprice
|
|
}
|
|
if (this.carList.get(id).wholesalePrice == '') {
|
|
if(this.carList.get(id).discountAmount == ''){
|
|
this.carList.get(id).wholesalePrice = purchaseDetails[0]
|
|
.wholesalePrice
|
|
}else{
|
|
this.carList.get(id).wholesalePrice = this.carList.get(id).discountAmount
|
|
}
|
|
}
|
|
if (this.carList.get(id).discountAmount == '') {
|
|
this.carList.get(id).discountAmount = purchaseDetails[0]
|
|
.wholesalePrice
|
|
this.carList.get(id).unitPrice = purchaseDetails[0]
|
|
.wholesalePrice
|
|
}
|
|
if (this.carList.get(id).lsprice == '') {
|
|
this.carList.get(id).lsprice = purchaseDetails[0].price
|
|
}
|
|
this.carList.get(id).price = Number((this.carList.get(id).discountAmount * Number(purchaseDetails[0].productCount)).toFixed(2))
|
|
let specMap = new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList.forEach(function(value, key) {
|
|
if (key != value.id) {
|
|
specMap.set(value.productId?value.productId: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).price = Number(this.carList.get(id)
|
|
.productCount) * this.carList.get(id)
|
|
.discountAmount
|
|
if (this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}').productCount ==
|
|
0 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&& purchaseDetails[0].stockLogList1.length >
|
|
0) {
|
|
this.carList.get(id).stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
})
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
this.getAmountAndWho()
|
|
this.oneGoodsId = ''
|
|
})
|
|
} else {
|
|
this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
let id = this.oneGoodsId
|
|
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, '件,')
|
|
}
|
|
|
|
if(this.carList.get(id).isFirst == undefined){
|
|
this.carList.get(id).isFirst = false
|
|
}else{
|
|
if (this.getMsg.startsWith("货号")) {
|
|
this.getMsg = this.getMsg.replace(/货号/g, '')
|
|
}
|
|
this.getMsg = '请返回以下规格:'+this.getMsg
|
|
}
|
|
await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", {
|
|
customerId:this.khName.id,
|
|
questionMsg: this.getMsg
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.close()
|
|
let purchaseDetails = res.result.data.purchaseDetails
|
|
|
|
if (purchaseDetails.length > 0) {
|
|
// this.carList.get(id).productCount = 0
|
|
// this.carList.get(id).returnCount = 0
|
|
if (this.carList.get(id).productName == '') {
|
|
this.carList.get(id).productName = purchaseDetails[0].productName
|
|
}
|
|
|
|
this.carList.get(id).customerCategoryList = purchaseDetails[0].customerCategoryRule!= null ? JSON.parse(purchaseDetails[0].customerCategoryRule):null
|
|
this.carList.get(id).buyCount = purchaseDetails[0].buyCount
|
|
this.carList.get(id).attrId = purchaseDetails[0].attrId
|
|
let isTrue = false
|
|
this.carList.forEach(function(value, key) {
|
|
if (value.productSn == purchaseDetails[0].productSn) {
|
|
isTrue = true
|
|
}
|
|
})
|
|
if (isTrue) {
|
|
this.carList.get(id).productSn = ''
|
|
this.carList.get(id).productName = ''
|
|
this.$forceUpdate()
|
|
this.tui.toast('该货号被页面其他商品占用,请重新输入!')
|
|
return
|
|
}
|
|
this.$nextTick(() => {
|
|
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 == 0){
|
|
if (this.carList.get(id).purchasePrice == '' || this.carList.get(id)
|
|
.purchasePrice == null && purchaseDetails[0].productId != null) {
|
|
this.carList.get(id).purchasePrice = purchaseDetails[0].purchasePrice
|
|
}
|
|
if (this.carList.get(id).productPicture == '' || this.carList.get(id)
|
|
.productPicture == null && purchaseDetails[0].productId != null) {
|
|
this.carList.get(id).productPicture = purchaseDetails[0].productPicture
|
|
}
|
|
if (purchaseDetails[0].productId) {
|
|
if(purchaseDetails[0].wholesalePrice > 0){
|
|
this.carList.get(id).wholesalePrice = purchaseDetails[0].wholesalePrice
|
|
this.carList.get(id).discountAmount = purchaseDetails[0].wholesalePrice
|
|
}
|
|
if(purchaseDetails[0].lsprice > 0){
|
|
this.carList.get(id).lsprice = purchaseDetails[0].lsprice
|
|
}
|
|
if(this.khName.categoryId != null && this.khName.categoryId != ''){
|
|
if(this.carList.get(id).customerCategoryList != null){
|
|
for(let i=0;i<this.carList.get(id).customerCategoryList.length;i++){
|
|
if(this.khName.categoryId == this.carList.get(id).customerCategoryList[i].categoryId){
|
|
if(this.carList.get(id).customerCategoryList[i].categoryPrice != ''){
|
|
if(this.carList.get(id).unitPrice == this.carList.get(id).wholesalePrice){
|
|
this.carList.get(id).discountAmount = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
this.carList.get(id).unitPrice = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
}
|
|
if(this.carList.get(id).returnPrice == this.carList.get(id).wholesalePrice){
|
|
this.carList.get(id).returnPrice = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
this.carList.get(id).discountAmount = this.carList.get(id).unitPrice
|
|
}
|
|
|
|
}else{
|
|
this.carList.get(id).discountAmount = this.carList.get(id).unitPrice
|
|
}
|
|
} else {
|
|
if(purchaseDetails[0].purchasePrice > 0){
|
|
this.carList.get(id).wholesalePrice = purchaseDetails[0].purchasePrice
|
|
this.carList.get(id).unitPrice = purchaseDetails[0].purchasePrice
|
|
this.carList.get(id).discountAmount = purchaseDetails[0].purchasePrice
|
|
this.carList.get(id).returnPrice = purchaseDetails[0].purchasePrice
|
|
}
|
|
}
|
|
|
|
let specMap = new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList.forEach(function(value, key) {
|
|
if (key != value.id) {
|
|
specMap.set(value.productId?value.productId:value.id, value)
|
|
} else {
|
|
specMap.set(key, value)
|
|
}
|
|
})
|
|
this.carList = specMap
|
|
})
|
|
this.$nextTick(() => {
|
|
for (let i = 0; i < purchaseDetails[0].stockLogList1.length; i++) {
|
|
purchaseDetails[0].stockLogList1[i].name = this.sliceMsg(
|
|
purchaseDetails[0].stockLogList1[i].attributeList)
|
|
if (this.carList.get(id).stockLogList.size == 0) {
|
|
this.carList.get(id).stockLogList.set(purchaseDetails[
|
|
0].stockLogList1[i].attributeList,
|
|
purchaseDetails[0].stockLogList1[i])
|
|
} else {
|
|
this.carList.get(id).stockLogList.get(
|
|
purchaseDetails[0].stockLogList1[i]
|
|
.attributeList).productNum = purchaseDetails[0].stockLogList1[i]
|
|
stockCount
|
|
if (this.carList.get(id).stockLogList.has(
|
|
purchaseDetails[0].stockLogList1[i]
|
|
.attributeList) == true) {
|
|
this.carList.get(id).stockLogList.get(
|
|
purchaseDetails[0].stockLogList1[i]
|
|
.attributeList).productCount +=
|
|
purchaseDetails[0].stockLogList1[i]
|
|
.productCount ?
|
|
Number(purchaseDetails[0].stockLogList1[i]
|
|
.productCount):0
|
|
} else {
|
|
this.carList.get(id).stockLogList.set(
|
|
purchaseDetails[0].stockLogList1[i]
|
|
.attributeList, purchaseDetails[0]
|
|
.stockLogList1[i])
|
|
}
|
|
}
|
|
|
|
if(purchaseDetails[0].stockLogList1[i].productCount > 0){
|
|
this.carList.get(id).productCount += Number(
|
|
purchaseDetails[0].stockLogList1[i].productCount)
|
|
}else{
|
|
this.carList.get(id).returnCount += Math.abs(purchaseDetails[0].stockLogList1[i].productCount)
|
|
}
|
|
if (this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}').productCount == 0 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&&
|
|
purchaseDetails[0].stockLogList1.length > 0) {
|
|
this.carList.get(id).stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
}
|
|
// this.carList.get(id).returnList.forEach(function(value, key) {
|
|
// if(value.productCount > 0){
|
|
// this.carList.get(id).productCount += value.productCount
|
|
// }else{
|
|
// this.carList.get(id).returnCount += Math.abs(value.productCount)
|
|
// }
|
|
// })
|
|
// this.carList.get(id).stockLogList.forEach(function(value, key) {
|
|
// if(value.productCount > 0){
|
|
// this.carList.get(id).productCount += value.productCount
|
|
// }else{
|
|
// this.carList.get(id).returnCount += Math.abs(value.productCount)
|
|
// }
|
|
// })
|
|
this.carList.get(id).price = Number(this.carList.get(id)
|
|
.productCount) * this.carList.get(id).discountAmount
|
|
})
|
|
this.$nextTick(() => {
|
|
this.getAmountAndWho()
|
|
this.oneGoodsId = ''
|
|
})
|
|
} else {
|
|
this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
|
|
} else {
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "抱歉:小助手对" + this.getMsg + "的部分商品未识别,请检查识别信息是否正确",
|
|
success: function(res) {}
|
|
})
|
|
}
|
|
}).catch((res) => {
|
|
this.tui.toast(res)
|
|
})
|
|
}
|
|
} else {
|
|
let id = this.oneGoodsId
|
|
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, '件,')
|
|
}
|
|
|
|
if(this.carList.get(id).isFirst == undefined){
|
|
this.carList.get(id).isFirst = false
|
|
}else{
|
|
if (this.getMsg.startsWith("货号")) {
|
|
this.getMsg = this.getMsg.replace(/货号/g, '')
|
|
}
|
|
this.getMsg = '请返回以下规格:'+this.getMsg
|
|
}
|
|
await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", {
|
|
customerId:this.khName.id,
|
|
questionMsg: this.getMsg
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.close()
|
|
let purchaseDetails = res.result.data.purchaseDetails
|
|
if (purchaseDetails.length > 0) {
|
|
if (this.carList.get(id).productName == '') {
|
|
this.carList.get(id).productName = purchaseDetails[0].productName
|
|
}
|
|
this.carList.get(id).buyCount = purchaseDetails[0].buyCount
|
|
this.carList.get(id).attrId = purchaseDetails[0].attrId
|
|
this.carList.get(id).customerCategoryList = purchaseDetails[0].customerCategoryRule!= null ? JSON.parse(purchaseDetails[0].customerCategoryRule):null
|
|
let isTrue = false
|
|
this.carList.forEach(function(value, key) {
|
|
if (value.productSn == purchaseDetails[0].productSn) {
|
|
isTrue = true
|
|
}
|
|
})
|
|
if (isTrue) {
|
|
this.carList.get(id).productSn = ''
|
|
this.carList.get(id).productName = ''
|
|
this.$forceUpdate()
|
|
this.tui.toast('该货号被页面其他商品占用,请重新输入!')
|
|
return
|
|
}
|
|
this.$nextTick(() => {
|
|
if (isTrue == false && this.carList.get(id).productSn == '') {
|
|
this.carList.get(id).productSn = purchaseDetails[0].productSn
|
|
}
|
|
if (isTrue == false && this.carList.get(id).isFirst == undefined) {
|
|
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 == 0){
|
|
if (this.carList.get(id).purchasePrice == '' || this.carList.get(id)
|
|
.purchasePrice == null && purchaseDetails[0].productId != null) {
|
|
this.carList.get(id).purchasePrice = purchaseDetails[0].purchasePrice
|
|
}
|
|
if (this.carList.get(id).productPicture == '' || this.carList.get(id)
|
|
.productPicture == null && purchaseDetails[0].productId != null) {
|
|
this.carList.get(id).productPicture = purchaseDetails[0].productPicture
|
|
}
|
|
if (purchaseDetails[0].productId) {
|
|
this.carList.get(id).unitPrice = purchaseDetails[0].wholesalePrice
|
|
if(purchaseDetails[0].wholesalePrice > 0){
|
|
this.carList.get(id).wholesalePrice = purchaseDetails[0].wholesalePrice
|
|
this.carList.get(id).discountAmount = purchaseDetails[0].wholesalePrice
|
|
|
|
}
|
|
if(purchaseDetails[0].lsprice > 0){
|
|
this.carList.get(id).lsprice = purchaseDetails[0].lsprice
|
|
}
|
|
if(this.khName.categoryId != null && this.khName.categoryId != ''){
|
|
if(this.carList.get(id).customerCategoryList != null){
|
|
for(let i=0;i<this.carList.get(id).customerCategoryList.length;i++){
|
|
if(this.khName.categoryId == this.carList.get(id).customerCategoryList[i].categoryId){
|
|
if(this.carList.get(id).customerCategoryList[i].categoryPrice != ''){
|
|
if(this.carList.get(id).unitPrice == this.carList.get(id).wholesalePrice){
|
|
this.carList.get(id).discountAmount = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
this.carList.get(id).unitPrice = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
}
|
|
if(this.carList.get(id).returnPrice == this.carList.get(id).wholesalePrice){
|
|
this.carList.get(id).returnPrice = this.carList.get(id).customerCategoryList[i].categoryPrice
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
this.carList.get(id).discountAmount = this.carList.get(id).unitPrice
|
|
}
|
|
|
|
}else{
|
|
this.carList.get(id).discountAmount = this.carList.get(id).unitPrice
|
|
}
|
|
} else {
|
|
if(purchaseDetails[0].purchasePrice > 0){
|
|
this.carList.get(id).wholesalePrice = purchaseDetails[0].purchasePrice
|
|
this.carList.get(id).unitPrice = purchaseDetails[0].purchasePrice
|
|
this.carList.get(id).discountAmount = purchaseDetails[0].purchasePrice
|
|
this.carList.get(id).returnPrice = purchaseDetails[0].purchasePrice
|
|
}
|
|
|
|
}
|
|
|
|
let specMap = new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList.forEach(function(value, key) {
|
|
if (key != value.id) {
|
|
specMap.set(value.productId?value.productId: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[
|
|
0].stockLogList1[i].attributeList) == true) {
|
|
this.carList.get(id).stockLogList.get(purchaseDetails[
|
|
0].stockLogList1[i].attributeList)
|
|
.productCount +=
|
|
purchaseDetails[j].stockLogList1[i]
|
|
.productCount ?
|
|
Number(purchaseDetails[j].stockLogList1[i]
|
|
.productCount):0
|
|
this.carList.get(id).stockLogList.get(purchaseDetails[
|
|
0].stockLogList1[i].attributeList).productNum = purchaseDetails[
|
|
0].stockLogList1[i].stockCount
|
|
} else {
|
|
this.carList.get(id).stockLogList.set(purchaseDetails[
|
|
0].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
|
|
}
|
|
}
|
|
|
|
if(purchaseDetails[j].stockLogList1[i].productCount > 0){
|
|
this.carList.get(id).productCount += Number(
|
|
purchaseDetails[j].stockLogList1[i].productCount)
|
|
}else{
|
|
this.carList.get(id).returnCount += Math.abs(purchaseDetails[j].stockLogList1[i].productCount)
|
|
}
|
|
if (this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}')) {
|
|
if (this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}').productCount == 1 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&&
|
|
purchaseDetails[j].stockLogList1.length > 0) {
|
|
this.carList.get(id).stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
this.carList.get(id).productCount-=1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
this.carList.get(id).price = Number(this.carList.get(id).productCount) *
|
|
this.carList.get(id).discountAmount
|
|
})
|
|
this.$nextTick(() => {
|
|
this.getAmountAndWho()
|
|
this.oneGoodsId = ''
|
|
})
|
|
} else {
|
|
this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
|
|
} else {
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "抱歉:小助手对" + this.getMsg + "的部分商品未识别,请检查识别信息是否正确",
|
|
success: function(res) {}
|
|
})
|
|
}
|
|
}).catch((res) => {
|
|
this.tui.toast(res)
|
|
})
|
|
}
|
|
},
|
|
//编辑挂单信息
|
|
async setOneDetailOld(e) {
|
|
this.voiceType = 'new'
|
|
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.indexOf('名称') == -1 &&convertedStr.indexOf('单价') == -1 &&convertedStr.indexOf('批发价') == -1){
|
|
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, '数量:')
|
|
}
|
|
if (convertedStr.indexOf('卖') != -1) {
|
|
convertedStr = convertedStr.replace(/卖/g, '数量:')
|
|
}
|
|
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.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;
|
|
if (convertedStr.indexOf('色') == -1 && convertedStr
|
|
.indexOf('码') == -1) {
|
|
if (!convertedStr.startsWith("货号")) {
|
|
convertedStr = "货号" + convertedStr;
|
|
}
|
|
try {
|
|
const regex = /货号.*?(?=货号|$)/g;
|
|
convertedStr = convertedStr.match(regex);
|
|
for (let i = 0; i < convertedStr.length; 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.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.wholesalePrice1) {
|
|
voiceData.wholesalePrice1 = this.replaceCharAfterNumber(voiceData.wholesalePrice1, '块',
|
|
'.')
|
|
if (voiceData.wholesalePrice1.indexOf('元') != -1) {
|
|
this.voiceData.wholesalePrice1 = this.voiceData.wholesalePrice1.replace(/元/g, '')
|
|
}
|
|
voiceData.wholesalePrice = voiceData.wholesalePrice1.replace(/[^0-9.]/g, "");
|
|
}
|
|
if(this.voiceGetOneData == true){
|
|
this.tui.request('/app/product/getShareList', "post", {
|
|
categoryId: "",
|
|
pageNum: 1,
|
|
pageSize: '1000',
|
|
searchStr: voiceData.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++) {
|
|
res.result.records[i].stockLogList1 = []
|
|
if (voiceData.wholesalePrice) {
|
|
res.result.records[i].wholesalePrice = voiceData.wholesalePrice
|
|
res.result.records[i].unitPrice = voiceData.wholesalePrice
|
|
res.result.records[i].discountAmount = voiceData.wholesalePrice
|
|
|
|
}
|
|
if(voiceData.productCount){
|
|
res.result.records[i].productCount = Number(voiceData.productCount[0])
|
|
}
|
|
let data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
productCount: voiceData.productCount != undefined ? Number(voiceData.productCount[0]):1,
|
|
stockCount: res.result.records[i].defaultStockCount
|
|
}
|
|
|
|
res.result.records[i].stockLogList1.push(data)
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
this.moreData.push(res.result.records)
|
|
this.oneData = voiceData
|
|
})
|
|
|
|
} else {
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.close();
|
|
let data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
productCount: voiceData.productCount != undefined ? Number(voiceData.productCount[0]):1,
|
|
stockCount: res.result.records[0].defaultStockCount
|
|
}
|
|
|
|
setTimeout(ress => {
|
|
res.result.records[0].productId = res.result.records[0].id
|
|
res.result.records[0].stockLogList1 = []
|
|
res.result.records[0].stockLogList1.push(data)
|
|
if (voiceData.wholesalePrice) {
|
|
res.result.records[0].wholesalePrice =
|
|
voiceData.wholesalePrice
|
|
}
|
|
let purchaseDetails = res.result.records
|
|
|
|
let id = this.oneGoodsId
|
|
if (purchaseDetails.length > 0) {
|
|
this.carList.get(id)
|
|
.customerCategoryList =
|
|
purchaseDetails[0]
|
|
.customerCategoryRule != null ?JSON.parse(purchaseDetails[0]
|
|
.customerCategoryRule):null
|
|
|
|
|
|
if (this.carList.get(id).productSn != '') {
|
|
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)
|
|
}
|
|
}
|
|
if (this.carList.get(id)
|
|
.stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
.productCount == 0 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&&
|
|
purchaseDetails[0]
|
|
.stockLogList1.length > 0) {
|
|
this.carList.get(id)
|
|
.stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
}
|
|
this.carList.get(id).price = Number(this
|
|
.carList.get(id).productCount) *
|
|
this.carList.get(id)
|
|
.wholesalePrice
|
|
|
|
this.$forceUpdate()
|
|
} else {
|
|
|
|
let isTrue = false
|
|
|
|
let specMap =
|
|
new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList.forEach(
|
|
function(value,
|
|
key) {
|
|
if (key !=
|
|
value
|
|
.id) {
|
|
specMap
|
|
.set(
|
|
value
|
|
.productId?value
|
|
.productId: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
|
|
]
|
|
)
|
|
}
|
|
}
|
|
if (purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount <
|
|
0) {
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.returnCount +=
|
|
Math
|
|
.abs(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount
|
|
)
|
|
} else {
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.productCount +=
|
|
Number(purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount)
|
|
}
|
|
|
|
}
|
|
}
|
|
this.carList.get(id)
|
|
.price = Number(this
|
|
.carList.get(id)
|
|
.productCount) *
|
|
this.carList.get(
|
|
id)
|
|
.wholesalePrice
|
|
if (this.carList.get(
|
|
id)
|
|
.stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
.productCount ==
|
|
0 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&&
|
|
purchaseDetails[0]
|
|
.stockLogList1
|
|
.length > 0) {
|
|
this.carList.get(
|
|
id)
|
|
.stockLogList
|
|
.delete(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
}
|
|
})
|
|
}
|
|
this.$forceUpdate()
|
|
this.$nextTick(() => {
|
|
this.getAmountAndWho()
|
|
this.oneGoodsId = ''
|
|
})
|
|
} else {
|
|
this.tui.toast(
|
|
"抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
}, 500)
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
this.tui.toast('录入新商品,请点击顶部“新增商品”添加')
|
|
|
|
}
|
|
setTimeout(res => {
|
|
if (this.moreData.length > 0) {
|
|
this.$refs.popup.close()
|
|
this.$refs.oneDataPopup.open()
|
|
this.showPopup(0)
|
|
}
|
|
}, 300)
|
|
|
|
}
|
|
})
|
|
}else{
|
|
this.tui.request('/app/product/getByProductSn', "post", {
|
|
productSn: voiceData.productSn
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.result != '') {
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
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
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
|
|
}
|
|
|
|
setTimeout(ress => {
|
|
res.result[0].productId = res.result[0].id
|
|
res.result[0].stockLogList1 = []
|
|
res.result[0].stockLogList1.push(data)
|
|
if (voiceData.wholesalePrice) {
|
|
res.result[0].wholesalePrice =
|
|
voiceData.wholesalePrice
|
|
}
|
|
let purchaseDetails = res.result
|
|
|
|
let id = this.oneGoodsId
|
|
if (purchaseDetails.length > 0) {
|
|
this.carList.get(id)
|
|
.customerCategoryList =
|
|
purchaseDetails[0]
|
|
.customerCategoryRule != null ?JSON.parse(purchaseDetails[0]
|
|
.customerCategoryRule):null
|
|
|
|
if (this.carList.get(id).productSn != '') {
|
|
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)
|
|
}
|
|
}
|
|
if (this.carList.get(id)
|
|
.stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
.productCount == 0 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&&
|
|
purchaseDetails[0]
|
|
.stockLogList1.length > 0) {
|
|
this.carList.get(id)
|
|
.stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
}
|
|
this.carList.get(id).price = Number(this
|
|
.carList.get(id).productCount) *
|
|
this.carList.get(id)
|
|
.wholesalePrice
|
|
this.$forceUpdate()
|
|
} else {
|
|
|
|
let isTrue = false
|
|
let specMap =
|
|
new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList.forEach(
|
|
function(value,
|
|
key) {
|
|
if (key !=
|
|
value
|
|
.id) {
|
|
specMap
|
|
.set(
|
|
value
|
|
.productId?value
|
|
.productId: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
|
|
]
|
|
)
|
|
}
|
|
}
|
|
if (purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount <
|
|
0) {
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.returnCount +=
|
|
Math
|
|
.abs(
|
|
purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount
|
|
)
|
|
} else {
|
|
this.carList
|
|
.get(
|
|
id)
|
|
.productCount +=
|
|
Number(purchaseDetails[j]
|
|
.stockLogList1[i]
|
|
.productCount)
|
|
}
|
|
|
|
}
|
|
}
|
|
this.carList.get(id)
|
|
.price = Number(this
|
|
.carList.get(id)
|
|
.productCount) *
|
|
this.carList.get(
|
|
id)
|
|
.wholesalePrice
|
|
if (this.carList.get(
|
|
id)
|
|
.stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
.productCount ==
|
|
0 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&&
|
|
purchaseDetails[0]
|
|
.stockLogList1
|
|
.length > 0) {
|
|
this.carList.get(
|
|
id)
|
|
.stockLogList
|
|
.delete(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
}
|
|
})
|
|
}
|
|
this.$forceUpdate()
|
|
this.$nextTick(() => {
|
|
this.getAmountAndWho()
|
|
this.oneGoodsId = ''
|
|
})
|
|
} else {
|
|
this.tui.toast(
|
|
"抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
}, 500)
|
|
} 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.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.wholesalePrice1) {
|
|
voiceData.wholesalePrice1 = this.replaceCharAfterNumber(voiceData
|
|
.wholesalePrice1, '块', '.')
|
|
if (voiceData.wholesalePrice1.indexOf('元') != -1) {
|
|
voiceData.wholesalePrice1 = voiceData.wholesalePrice1.replace(/元/g, '')
|
|
}
|
|
voiceData.wholesalePrice = voiceData.wholesalePrice1.replace(
|
|
/[^0-9.]/g, "");
|
|
}
|
|
let data = {
|
|
id: voiceData.productSn,
|
|
productCount: Number(voiceData.productCount) || 0,
|
|
productName: voiceData.productName,
|
|
productSn: voiceData.productSn,
|
|
customerCategoryList:null,
|
|
categoryId: this.fenleiList.categoryId,
|
|
categoryName: this.fenleiList.categoryName,
|
|
unitPrice: voiceData.wholesalePrice || 0,
|
|
discountAmount: voiceData.wholesalePrice || 0,
|
|
wholesalePrice: voiceData.wholesalePrice || 0,
|
|
stockLogList1: [{
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
productCount: Number(voiceData.productCount) || 1,
|
|
stockCount: null
|
|
}]
|
|
}
|
|
let purchaseDetails = []
|
|
purchaseDetails.push(data)
|
|
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++) {
|
|
|
|
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 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&&
|
|
purchaseDetails[0].stockLogList1.length > 0) {
|
|
this.carList.get(id).stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
this.carList.get(id).price = Number(this.carList.get(id)
|
|
.productCount) * this.carList.get(id).wholesalePrice
|
|
this.$forceUpdate()
|
|
|
|
} else {
|
|
let isTrue = false
|
|
|
|
let specMap = new Map() //新的临时存放值那个更改过的值的map
|
|
this.$nextTick(() => {
|
|
this.carList.forEach(function(value, key) {
|
|
if (key != value.id) {
|
|
specMap.set(value.productId?value.productId: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).price = Number(this.carList.get(id)
|
|
.productCount) * this.carList.get(id)
|
|
.wholesalePrice
|
|
if (this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}').productCount ==
|
|
0 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&& purchaseDetails[0].stockLogList1.length >
|
|
0) {
|
|
this.carList.get(id).stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
}
|
|
})
|
|
}
|
|
this.$forceUpdate()
|
|
this.$nextTick(() => {
|
|
this.getAmountAndWho()
|
|
this.oneGoodsId = ''
|
|
})
|
|
} else {
|
|
this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
}
|
|
|
|
} 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, '件,')
|
|
}
|
|
if (this.getMsg.startsWith("货号")) {
|
|
this.getMsg = this.getMsg.replace(/货号/g, '')
|
|
}
|
|
this.tui.request("/app/sale/buyAi", "POST", {
|
|
aiMsg: "请返回以下规格"+this.getMsg,
|
|
productId: this.oneGoodsId
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.close()
|
|
this.aiNotRecognition = res.result.aiNotRecognition
|
|
// if (this.isInventory == true) {
|
|
let newData = []
|
|
|
|
for (let i = 0; i < res.result.data.length; i++) {
|
|
let newList = []
|
|
|
|
// res.result.data[i].productCount = 0
|
|
if (res.result.data[i].stockLogList1.length > 0) {
|
|
for (let m = 0; m < res.result.data[i].stockLogList1.length; m++) {
|
|
// if (res.result.data[i].stockLogList1[m].stockCount != null) {
|
|
newList.push(res.result.data[i].stockLogList1[m])
|
|
// }
|
|
}
|
|
} else {
|
|
let data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
name: '均色 | 均码',
|
|
productCount: 1,
|
|
productNum: null
|
|
}
|
|
newList.push(data)
|
|
}
|
|
|
|
|
|
res.result.data[i].stockLogList1 = newList
|
|
if (newList.length > 0) {
|
|
newData.push(res.result.data[i])
|
|
}
|
|
|
|
}
|
|
// } else {
|
|
// this.carList1 = res.result.data
|
|
// }
|
|
|
|
if (res.result.aiNotRecognition != '') {
|
|
this.$refs.AiNoPopup.open()
|
|
}
|
|
this.$nextTick(() => {
|
|
this.AiHandleDataNew(newData)
|
|
})
|
|
} else {
|
|
this.tui.toast("抱歉:小助手对" + this.getMsg + "的部分商品未识别,请检查识别信息是否正确")
|
|
}
|
|
}).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, '件,')
|
|
}
|
|
if (this.getMsg.startsWith("货号")) {
|
|
this.getMsg = this.getMsg.replace(/货号/g, '')
|
|
}
|
|
this.tui.request("/app/sale/buyAi", "POST", {
|
|
aiMsg: "请返回以下规格"+this.getMsg,
|
|
productId: this.oneGoodsId
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.close()
|
|
this.aiNotRecognition = res.result.aiNotRecognition
|
|
// if (this.isInventory == true) {
|
|
let newData = []
|
|
|
|
for (let i = 0; i < res.result.data.length; i++) {
|
|
let newList = []
|
|
// res.result.data[i].productCount = 0
|
|
if (res.result.data[i].stockLogList1.length > 0) {
|
|
for (let m = 0; m < res.result.data[i].stockLogList1.length; m++) {
|
|
// if (res.result.data[i].stockLogList1[m].stockCount != null) {
|
|
res.result.data[i].stockLogList1[m].productNum = res.result.data[i].stockLogList1[m].stockCount
|
|
newList.push(res.result.data[i].stockLogList1[m])
|
|
// }
|
|
}
|
|
} else {
|
|
let data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
name: '均色 | 均码',
|
|
productCount: 1,
|
|
productNum: null
|
|
}
|
|
newList.push(data)
|
|
}
|
|
|
|
|
|
res.result.data[i].stockLogList1 = newList
|
|
if (newList.length > 0) {
|
|
newData.push(res.result.data[i])
|
|
}
|
|
|
|
}
|
|
// } else {
|
|
// this.carList1 = res.result.data
|
|
// }
|
|
|
|
if (res.result.aiNotRecognition != '') {
|
|
this.$refs.AiNoPopup.open()
|
|
}
|
|
this.$nextTick(() => {
|
|
this.AiHandleDataNew(newData)
|
|
})
|
|
} else {
|
|
this.tui.toast("抱歉:小助手对" + this.getMsg + "的部分商品未识别,请检查识别信息是否正确")
|
|
}
|
|
}).catch((res) => {
|
|
this.tui.toast(res)
|
|
})
|
|
}
|
|
},
|
|
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) => {})
|
|
uni.hideLoading()
|
|
},
|
|
//扫一扫功能
|
|
scanCodeAdd() {
|
|
let that = this;
|
|
uni.setStorageSync('saoma', '1')
|
|
uni.scanCode({
|
|
success: (res) => {
|
|
if (res.scanType == "QR_CODE") { //二维码1
|
|
if(res.result.split(',').length > 2){
|
|
that.attrBuilt = decodeURIComponent(res.result.split(',')[2].split('-')[0])+'-'+decodeURIComponent(res.result.split(',')[2].split('-')[1])
|
|
}
|
|
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(that.attrBuilt != null && that.attrBuilt != '' && that.attrBuilt != '-'){
|
|
setTimeout(res => {
|
|
that.scanCodeAdd()
|
|
}, 1100)
|
|
}
|
|
} else {
|
|
setTimeout(res => {
|
|
that.tui.toast('您的店铺中暂无该商品!')
|
|
}, 1000)
|
|
|
|
}
|
|
} else {
|
|
that.tui.request("/app/product/getByBarcode", "POST", {
|
|
customerId:this.khName.id,
|
|
barcode: res.result
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
if (res1.result == '') {
|
|
// setTimeout(res => {
|
|
that.tui.toast('您的店铺中暂无该商品!')
|
|
// }, 1000)
|
|
} else {
|
|
that.productId = res1.result[0].id
|
|
that.toggle('bottom', res1.result[0].id);
|
|
if (item.saleDetailDTOList) {
|
|
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
|
|
that.carList.push(item.saleDetailDTOList[i])
|
|
}
|
|
}
|
|
}
|
|
|
|
} else {
|
|
that.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {
|
|
that.tui.toast(res)
|
|
})
|
|
}
|
|
uni.vibrateLong({
|
|
success: function () {
|
|
|
|
},
|
|
fail: function () {
|
|
|
|
}
|
|
})
|
|
},
|
|
fail: (res) => {
|
|
uni.showToast({
|
|
title: '扫描失败',
|
|
icon: 'none'
|
|
})
|
|
}
|
|
})
|
|
},
|
|
//编辑每一个的单价
|
|
clickCollapse(e, id) {
|
|
this.changePriceStatus()
|
|
this.newProductId =''
|
|
this.carList.get(id).discountAmount = Number(e)
|
|
this.carList.get(id).unitPrice = Number(e)
|
|
this.carList.get(id).returnPrice = this.carList.get(id).discountAmount
|
|
this.carList.get(id).price = Number(this.carList.get(id).productCount) * this.carList.get(id).discountAmount
|
|
this.getAllPrice()
|
|
},
|
|
voiceGetOne() {
|
|
this.voiceGetOneData = !this.voiceGetOneData
|
|
},
|
|
// clickGetOne(oneData) {
|
|
// this.$refs.oneDataPopup.close()
|
|
// this.getOneData(oneData)
|
|
// },
|
|
//判断语音是不是只包含数字、字符或英文(针对只说货号的情况)
|
|
isValidString(str) {
|
|
var regex = /^[A-Za-z0-9_\-]+$/;
|
|
return regex.test(str);
|
|
},
|
|
async getOneData(oneData, type) {
|
|
this.tui.request('/app/product/getShareList', "post", {
|
|
customerId:this.khName.id,
|
|
categoryId: "",
|
|
pageNum: 1,
|
|
pageSize: '1000',
|
|
searchStr: oneData.productSn
|
|
}, false, false).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.result.records != '' && 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
|
|
|
|
}
|
|
if(oneData.productCount){
|
|
res.result.records[i].productCount = Number(oneData.productCount[0])
|
|
}
|
|
|
|
}
|
|
this.$nextTick(() => {
|
|
this.moreData.push(res.result.records)
|
|
this.oneData = oneData
|
|
})
|
|
|
|
} else {
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.close();
|
|
let data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
productCount: oneData.productCount != undefined ? Number(oneData.productCount[0]):1,
|
|
stockCount: res.result.records[0].defaultStockCount
|
|
}
|
|
|
|
setTimeout(ress => {
|
|
res.result.records[0].productId = res.result.records[0]
|
|
.id
|
|
res.result.records[0].stockLogList1 = []
|
|
res.result.records[0].stockLogList1.push(data)
|
|
if (oneData.wholesalePrice) {
|
|
res.result.records[0].wholesalePrice = oneData
|
|
.wholesalePrice
|
|
res.result.records[0].unitPrice = oneData
|
|
.wholesalePrice
|
|
res.result.records[0].discountAmount = oneData
|
|
.wholesalePrice
|
|
}
|
|
let purchaseDetails = res.result.records
|
|
|
|
let id = this.oneGoodsId
|
|
if (purchaseDetails.length > 0) {
|
|
this.carList1 = purchaseDetails
|
|
// this.$nextTick(() => {
|
|
this.AiHandleData()
|
|
// })
|
|
|
|
} else {
|
|
this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
}, 300)
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
this.tui.toast(oneData.productSn+'为新商品,请点击顶部“新增商品”添加')
|
|
|
|
}
|
|
setTimeout(res => {
|
|
if (type == true && this.moreData.length > 0) {
|
|
this.$refs.popup.close()
|
|
this.$refs.oneDataPopup.open()
|
|
this.showPopup(0)
|
|
}
|
|
}, 300)
|
|
|
|
}
|
|
})
|
|
|
|
},
|
|
showPopup(index) {
|
|
this.currentPopupIndex = index;
|
|
this.showTan = true;
|
|
},
|
|
clickGetOne(item) {
|
|
this.changePriceStatus()
|
|
let id = this.oneGoodsId
|
|
if(this.oneGoodsId){
|
|
let purchaseDetails = item
|
|
this.carList.get(id)
|
|
.buyCount =purchaseDetails.buyCount
|
|
if (this.carList.get(id).productSn != '') {
|
|
for (let i = 0; i < purchaseDetails
|
|
.stockLogList1.length; i++) {
|
|
if (this.carList.get(id)
|
|
.productName == '') {
|
|
this.carList.get(id)
|
|
.productName =
|
|
purchaseDetails
|
|
.productName
|
|
}
|
|
if (this.carList.get(id).attrId ==
|
|
'') {
|
|
this.carList.get(id).attrId =
|
|
purchaseDetails.attrId
|
|
}
|
|
if (this.carList.get(id)
|
|
.purchasePrice == '' || this
|
|
.carList.get(id)
|
|
.purchasePrice == null) {
|
|
if (item.purchasePrice) {
|
|
this.carList.get(id)
|
|
.purchasePrice =
|
|
item.purchasePrice
|
|
} else {
|
|
this.carList.get(id)
|
|
.purchasePrice =
|
|
purchaseDetails
|
|
.purchasePrice
|
|
}
|
|
|
|
}
|
|
if (this.carList.get(id)
|
|
.productPicture == '') {
|
|
this.carList.get(id)
|
|
.productPicture =
|
|
purchaseDetails
|
|
.productPicture
|
|
}
|
|
this.carList.get(id)
|
|
.customerCategoryRule =
|
|
(purchaseDetails
|
|
.customerCategoryRule != null && purchaseDetails
|
|
.customerCategoryRule != '' )?
|
|
JSON.parse(purchaseDetails
|
|
.customerCategoryRule):''
|
|
purchaseDetails.stockLogList1[i]
|
|
.name = this.sliceMsg(
|
|
purchaseDetails
|
|
.stockLogList1[i]
|
|
.attributeList)
|
|
if (this.carList.get(id)
|
|
.stockLogList.size == 0) {
|
|
this.carList.get(id)
|
|
.stockLogList.set(
|
|
purchaseDetails
|
|
.stockLogList1[i]
|
|
.attributeList,
|
|
purchaseDetails
|
|
.stockLogList1[i])
|
|
} else {
|
|
if (this.carList.get(id)
|
|
.stockLogList.has(
|
|
purchaseDetails
|
|
.stockLogList1[i]
|
|
.attributeList) == true
|
|
) {
|
|
this.carList.get(id)
|
|
.stockLogList.get(
|
|
purchaseDetails
|
|
.stockLogList1[i]
|
|
.attributeList)
|
|
.productCount +=
|
|
Number(purchaseDetails
|
|
.stockLogList1[i]
|
|
.productCount)
|
|
} else {
|
|
this.carList.get(id)
|
|
.stockLogList.set(
|
|
purchaseDetails
|
|
.stockLogList1[i]
|
|
.attributeList,
|
|
purchaseDetails
|
|
.stockLogList1[i])
|
|
}
|
|
}
|
|
this.carList.get(id)
|
|
.productCount +=
|
|
Number(purchaseDetails
|
|
.stockLogList1[i]
|
|
.productCount)
|
|
}
|
|
this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
.productNum = purchaseDetails.defaultStockCount
|
|
if (this.carList.get(id).stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}')
|
|
.productCount == 0 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&& purchaseDetails.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
|
|
this.carList.get(id).price = Number(this
|
|
.carList
|
|
.get(id).productCount) * this
|
|
.carList
|
|
.get(id).discountAmount
|
|
} else {
|
|
|
|
let isTrue = false
|
|
this.carList.forEach(function(value, key) {
|
|
if (value.productSn ==
|
|
purchaseDetails
|
|
.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
|
|
.productName
|
|
}
|
|
if (this.carList.get(id)
|
|
.attrId == '') {
|
|
this.carList.get(id)
|
|
.attrId =
|
|
purchaseDetails.attrId
|
|
}
|
|
if (purchaseDetails.productId) {
|
|
this.carList.get(id).unitPrice =
|
|
purchaseDetails.wholesalePrice
|
|
this.carList.get(id).discountAmount =
|
|
purchaseDetails.wholesalePrice
|
|
this.carList.get(id).attrId =
|
|
purchaseDetails.attrId
|
|
this.carList.get(id).wholesalePrice =
|
|
purchaseDetails.wholesalePrice
|
|
this.carList.get(id).lsPrice =
|
|
purchaseDetails.lsPrice
|
|
}
|
|
if(this.khName.categoryId != null && this.khName.categoryId != ''){
|
|
if(purchaseDetails.customerCategoryRule != null){
|
|
let rule = JSON.parse(purchaseDetails.customerCategoryRule)
|
|
for(let i=0;i<rule.length;i++){
|
|
if(this.khName.categoryId == rule[i].categoryId){
|
|
if(rule[i].categoryPrice != ''){
|
|
if(this.carList.get(id).unitPrice == this.carList.get(id).wholesalePrice){
|
|
this.carList.get(id).discountAmount = rule[i].categoryPrice
|
|
this.carList.get(id).unitPrice = rule[i].categoryPrice
|
|
}
|
|
if(this.carList.get(id).returnPrice == this.carList.get(id).wholesalePrice){
|
|
this.carList.get(id).returnPrice = rule[i].categoryPrice
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
this.carList.get(id).discountAmount = purchaseDetails.wholesalePrice
|
|
}
|
|
|
|
}else{
|
|
this.carList.get(id).discountAmount = purchaseDetails.wholesalePrice
|
|
}
|
|
this.carList.get(id)
|
|
.customerCategoryList =
|
|
(purchaseDetails
|
|
.customerCategoryRule != null && purchaseDetails
|
|
.customerCategoryRule != '') ?
|
|
JSON.parse(purchaseDetails
|
|
.customerCategoryRule) : ''
|
|
if (isTrue == false && this
|
|
.carList.get(id)
|
|
.productSn == '') {
|
|
this.carList.get(id)
|
|
.productSn =
|
|
purchaseDetails
|
|
.productSn
|
|
}
|
|
if (isTrue == false) {
|
|
if (purchaseDetails
|
|
.id) {
|
|
this.carList.get(id)
|
|
.id =
|
|
purchaseDetails
|
|
.id
|
|
this.carList.get(id)
|
|
.productId =
|
|
purchaseDetails
|
|
.id
|
|
this.carList.get(id)
|
|
.isNew = false
|
|
id = purchaseDetails
|
|
.id
|
|
|
|
} else if (purchaseDetails.productSn ==
|
|
'' || purchaseDetails.productSn ==
|
|
null) {
|
|
this.carList.get(id)
|
|
.id =
|
|
purchaseDetails
|
|
.productName
|
|
id = purchaseDetails
|
|
.productName
|
|
} else if (purchaseDetails.productSn ==
|
|
'货号') {
|
|
this.carList.get(id)
|
|
.productSn =
|
|
purchaseDetails
|
|
.productName
|
|
this.carList.get(id)
|
|
.id =
|
|
purchaseDetails
|
|
.productName
|
|
id = purchaseDetails
|
|
.productName
|
|
} else if (purchaseDetails.productSn) {
|
|
this.carList.get(id)
|
|
.id =
|
|
purchaseDetails
|
|
.productSn
|
|
id = purchaseDetails
|
|
.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
|
|
.purchasePrice
|
|
} else {
|
|
this.carList.get(id)
|
|
.purchasePrice =
|
|
purchaseDetails
|
|
.purchasePrice
|
|
}
|
|
|
|
}
|
|
this.carList.get(id).customerCategoryList =
|
|
(purchaseDetails.customerCategoryRule != null && purchaseDetails.customerCategoryRule != '') ? JSON.parse(purchaseDetails
|
|
.customerCategoryRule) : ''
|
|
if (this.carList.get(id).productPicture ==
|
|
'') {
|
|
this.carList.get(id).productPicture =
|
|
purchaseDetails.productPicture
|
|
}
|
|
|
|
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 i = 0; i <
|
|
purchaseDetails
|
|
.stockLogList1
|
|
.length; i++) {
|
|
|
|
purchaseDetails
|
|
.stockLogList1[i]
|
|
.name = this
|
|
.sliceMsg(
|
|
purchaseDetails
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList)
|
|
if (this.carList.get(
|
|
id)
|
|
.stockLogList
|
|
.size == 0) {
|
|
this.carList.get(
|
|
id)
|
|
.stockLogList
|
|
.set(
|
|
purchaseDetails
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList,
|
|
purchaseDetails
|
|
.stockLogList1[
|
|
i])
|
|
this.carList.get(id).stockLogList.get(
|
|
purchaseDetails.stockLogList1[i].attributeList).productNum =
|
|
purchaseDetails.stockLogList1[i].stockCount
|
|
} else {
|
|
|
|
|
|
if (this.carList
|
|
.get(id)
|
|
.stockLogList
|
|
.has(
|
|
purchaseDetails
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList
|
|
) == true
|
|
) {
|
|
this.carList.get(id).stockLogList.get(
|
|
purchaseDetails.stockLogList1[i].attributeList).productNum =
|
|
purchaseDetails.stockLogList1[i].stockCount
|
|
this.carList
|
|
.get(id)
|
|
.stockLogList
|
|
.get(
|
|
purchaseDetails
|
|
.stockLogList1[
|
|
i]
|
|
.attributeList
|
|
)
|
|
.productCount +=
|
|
Number(
|
|
purchaseDetails
|
|
.stockLogList1[
|
|
i]
|
|
.productCount
|
|
)
|
|
} else {
|
|
this.carList.get(id).stockLogList.set(purchaseDetails.stockLogList1[i]
|
|
.attributeList,purchaseDetails.stockLogList1[i])
|
|
}
|
|
}
|
|
this.carList.get(id)
|
|
.productCount +=
|
|
Number(
|
|
purchaseDetails
|
|
.stockLogList1[
|
|
i]
|
|
.productCount)
|
|
}
|
|
|
|
this.carList.get(id).price1 =
|
|
Number(this.carList.get(id)
|
|
.productCount) * this
|
|
.carList.get(id)
|
|
.purchasePrice
|
|
this.carList.get(id).price =
|
|
Number(this.carList.get(id)
|
|
.productCount) * this
|
|
.carList.get(id)
|
|
.discountAmount
|
|
if (this.carList.get(id)
|
|
.stockLogList.get(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
).productCount == 0 && this.carList.get(
|
|
id)
|
|
.stockLogList.size> 1&&
|
|
purchaseDetails
|
|
.stockLogList1.length > 0
|
|
) {
|
|
this.carList.get(id)
|
|
.stockLogList.delete(
|
|
'{"颜色":"均色","尺码":"均码"}'
|
|
)
|
|
}
|
|
})
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
this.getAllPrice()
|
|
this.moreData = []
|
|
this.showTan = false;
|
|
this.oneGoodsId = ''
|
|
})
|
|
}else{
|
|
// 如果还有下一个弹出层,则显示下一个
|
|
if (this.currentPopupIndex + 1 < this.moreData.length) {
|
|
this.showTan = false; // 先关闭当前弹出层
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
let data = {
|
|
attributeList: '{"颜色":"均色","尺码":"均码"}',
|
|
productCount: Number(item.productCount) || 0,
|
|
stockCount: item.defaultStockCount
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
item.productId = item.id
|
|
item.stockLogList1 = []
|
|
item.stockLogList1.push(data)
|
|
let purchaseDetails = item
|
|
|
|
let id = this.oneGoodsId
|
|
if (purchaseDetails) {
|
|
this.carList1.push(purchaseDetails)
|
|
this.$nextTick(() => {
|
|
this.AiHandleData()
|
|
})
|
|
|
|
} 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,
|
|
stockCount: item.defaultStockCount
|
|
}
|
|
|
|
|
|
this.$nextTick(() => {
|
|
item.productId = item.id
|
|
item.stockLogList1 = []
|
|
item.stockLogList1.push(data)
|
|
let purchaseDetails = item
|
|
|
|
let id = this.oneGoodsId
|
|
if (purchaseDetails) {
|
|
this.moreData = []
|
|
this.carList1.push(purchaseDetails)
|
|
this.$nextTick(() => {
|
|
this.AiHandleData()
|
|
})
|
|
|
|
} else {
|
|
this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
|
|
}
|
|
})
|
|
|
|
}
|
|
}
|
|
|
|
},
|
|
//弹出商品规格选择
|
|
toggle(type, id,name) {
|
|
this.type = type
|
|
if (type == 'bottom') {
|
|
this.allChangeNum = 0
|
|
this.getById(id,'',true);
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
} else if (type == 'typePopup') {
|
|
this.productId = id
|
|
this.getGategoryList()
|
|
this.$refs.typePopup.open()
|
|
} else if (type == 'oneGoods') {
|
|
this.carList.get(id).stockLogList.get(name).isShowBtn = false
|
|
this.voiceType = 'new'
|
|
this.oneGoodsId = id
|
|
this.initRecord();
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.open('center')
|
|
} else if (type == 'oneGoodsOld') {
|
|
this.carList.get(id).stockLogList.get(name).isShowBtn = false
|
|
this.voiceType = 'old'
|
|
this.oneGoodsId = id
|
|
this.initRecord();
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.open('center')
|
|
} else if (type == 'addGateDialog') {
|
|
this.$refs.addGateDialog.open("bottom")
|
|
}else {
|
|
this.oneGoodsId = ''
|
|
this.initRecord();
|
|
this.voiceText = ''
|
|
this.voiceText1 = ''
|
|
this.$refs.popup.open(type)
|
|
}
|
|
},
|
|
showBtn(id){
|
|
|
|
},
|
|
getName(e, id) {
|
|
this.carList.get(id).productName = e.detail.value
|
|
},
|
|
sninput(e, id) {
|
|
this.newProductId = e.detail.value
|
|
this.carList.get(id).productSn = e.detail.value
|
|
this.$forceUpdate()
|
|
},
|
|
//货号是否重复
|
|
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.productId ? value.productId : value.id, value)
|
|
}
|
|
} else {
|
|
specMap.set(key, value)
|
|
}
|
|
})
|
|
this.carList = specMap
|
|
// }
|
|
})
|
|
|
|
}
|
|
},
|
|
getOneId(id) {
|
|
this.oneGoodsId = id
|
|
this.$refs.SNDialog.open('center')
|
|
},
|
|
async generateSn(value) {
|
|
let that = this;
|
|
|
|
await this.tui.request("/app/productSn/getNewProductSn", "POST", {
|
|
snPre: value
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
that.tui.request('/app/product/getByProductSn', "post", {
|
|
productSn: res1.result
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.result != '') {
|
|
that.generateSn(value)
|
|
} else {
|
|
that.carList.get(that.oneGoodsId).productSn = res1.result
|
|
that.$forceUpdate()
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
that.tui.toast(res1.message)
|
|
}
|
|
}).catch((res) => {})
|
|
|
|
this.$refs.SNDialog.close()
|
|
setTimeout(res=>{
|
|
// this.oneGoodsId = ''
|
|
this.numRule = ''
|
|
this.prefixRule = ''
|
|
},2000)
|
|
},
|
|
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 = []
|
|
}
|
|
},
|
|
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()
|
|
}
|
|
});
|
|
|
|
}
|
|
})
|
|
|
|
}
|
|
})
|
|
},
|
|
lunbochange(e) {
|
|
this.current = e.detail.current
|
|
},
|
|
getZhuBigImage(path) {
|
|
let paths = []
|
|
paths.push(path)
|
|
uni.previewImage({
|
|
urls: paths
|
|
});
|
|
},
|
|
pictureAdd(id, huan,name) {
|
|
let that = this
|
|
this.carList.get(id).stockLogList.get(name).isShowBtn = false
|
|
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)
|
|
}
|
|
},
|
|
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)
|
|
},
|
|
//获取分类列表
|
|
getGategoryList() {
|
|
this.tui.request("/app/productCategory/list", "get", {
|
|
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
this.indexList = res.result;
|
|
this.categoryText = ""
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
//整体选择是批发价还是零售价
|
|
async priceChange(e, index) {
|
|
|
|
uni.showLoading({
|
|
title: '加载中...',
|
|
mask: true
|
|
})
|
|
let that = this;
|
|
if(this.priceCurrent == index && (this.priceCurrent == '0' || this.priceCurrent == '1')){
|
|
this.priceCurrent = '2'
|
|
this.priceType = ''
|
|
}else{
|
|
this.priceType = e
|
|
that.priceCurrent = index
|
|
}
|
|
if(this.khName.categoryId != null && this.khName.categoryId != '' && this.priceCurrent == '2'){
|
|
this.carList.forEach(function(value, key) {
|
|
if(value.isChangePrice == undefined){
|
|
value.isChangePrice = false
|
|
}
|
|
if(value.isChangeReturnPrice == undefined){
|
|
value.isChangeReturnPrice = false
|
|
}
|
|
if(value.customerCategoryList != null){
|
|
let ischeckCustom = false
|
|
let truePrice = 0
|
|
let ischeckCustomPrice = false
|
|
for(let i=0;i<value.customerCategoryList.length;i++){
|
|
if(value.unitPrice == value.customerCategoryList[i].categoryPrice){
|
|
ischeckCustom = true
|
|
}
|
|
if(that.khName.categoryId == value.customerCategoryList[i].categoryId && value.customerCategoryList[i].categoryPrice != ''){
|
|
truePrice = value.customerCategoryList[i].categoryPrice
|
|
ischeckCustomPrice = true
|
|
}
|
|
}
|
|
if(ischeckCustomPrice && (value.unitPrice == value.wholesalePrice || value.unitPrice == value.lsprice || ischeckCustom) && !value.isChangePrice){
|
|
value.unitPrice = truePrice
|
|
value.discountAmount = truePrice
|
|
}
|
|
if(ischeckCustomPrice && (value.returnPrice == value.wholesalePrice || value.unitPrice == value.lsprice || ischeckCustom) && !value.isChangeReturnPrice){
|
|
value.returnPrice = truePrice
|
|
}
|
|
}else{
|
|
if(!value.isChangeReturnPrice){
|
|
value.returnPrice = value.wholesalePrice
|
|
}
|
|
if(!value.isChangePrice){
|
|
value.discountAmount = value.wholesalePrice
|
|
value.unitPrice = value.wholesalePrice
|
|
}else{
|
|
value.discountAmount = value.unitPrice
|
|
}
|
|
|
|
}
|
|
})
|
|
|
|
}else{
|
|
await this.carList.forEach(function(value, key) {
|
|
that.index = value.productId || value.id
|
|
if(value.isChangePrice == undefined){
|
|
value.isChangePrice = false
|
|
}
|
|
if(value.isChangePrice == undefined){
|
|
value.isChangeReturnPrice = false
|
|
}
|
|
if (value.isNew != true) {
|
|
if (e == '0' && !value.isChangePrice) { //零售
|
|
value.discountAmount = value.lsprice
|
|
value.unitPrice = value.lsprice
|
|
} else if(e == '1' && !value.isChangePrice){ //批发
|
|
value.discountAmount = value.wholesalePrice
|
|
value.unitPrice = value.wholesalePrice
|
|
}
|
|
if (e == '0' && !value.isChangeReturnPrice) { //零售
|
|
value.returnPrice = value.lsprice
|
|
} else if(e == '1' && !value.isChangeReturnPrice){ //批发
|
|
value.returnPrice = value.wholesalePrice
|
|
}
|
|
}
|
|
})
|
|
}
|
|
await this.getAmountAndWho()
|
|
await setTimeout(res => {
|
|
uni.hideLoading();
|
|
this.$forceUpdate()
|
|
}, 500)
|
|
|
|
|
|
},
|
|
//商品上选择是零售价还是批发价
|
|
checkPay(price, returnPrice) {
|
|
|
|
if (price == undefined || price == null) {
|
|
this.tui.toast("暂无拿货记录")
|
|
return
|
|
}
|
|
let that = this;
|
|
let num = this.carList.get(this.index)
|
|
|
|
if (returnPrice != '') {
|
|
num.isChangeReturnPrice = true
|
|
num.returnPrice = returnPrice
|
|
}
|
|
if(price != ''){
|
|
num.isChangePrice = true
|
|
num.discountAmount = price
|
|
num.unitPrice = price;
|
|
num.price = price * Number(num.productCount);
|
|
}
|
|
|
|
this.$refs.inputDialog.close()
|
|
this.$refs.historyPopup.close()
|
|
// num.discountAmount = num.unitPrice * num.discount / 10
|
|
num.disNoAmount = num.discountAmount
|
|
num.price = num.unitPrice * num.discount / 10 * Number(num.productCount)
|
|
that.relPrice = that.shouldPay
|
|
that.priceOk = this.checkRealPay(that.shouldPay)
|
|
// this.getAllPrice()
|
|
this.getAmountAndWho()
|
|
this.customPrice = ''
|
|
this.returnPrice = ''
|
|
},
|
|
//整体选择时使用批发价、零售价,选择整体折扣的方法
|
|
getAmountAndWho(isSaoMa) {
|
|
this.changePriceStatus()
|
|
let that = this;
|
|
let price = 0
|
|
this.carList.forEach(function(value, key) {
|
|
if (value.disNoAmount > 0) {
|
|
price = value.disNoAmount
|
|
} else {
|
|
if (that.priceType == '') {
|
|
price = value.discountAmount>0?value.discountAmount: value.wholesalePrice
|
|
} else if (that.priceType == 0) { //零售
|
|
price = value.lsprice
|
|
} else if (that.priceType == 1) { //批发
|
|
price = value.wholesalePrice
|
|
}
|
|
|
|
}
|
|
// if (value.isNew != true) {
|
|
// value.unitPrice = price;
|
|
// }
|
|
if(that.discountType !=''){
|
|
if(!uni.getStorageSync('hangOrder')){
|
|
if (that.discountType == 1) { //整体折扣
|
|
value.discountAmount = value.unitPrice * (that.discountNum / 10)
|
|
value.discountAmount = Number(value.discountAmount.toFixed(2))
|
|
value.price = value.discountAmount * Number(value.productCount)
|
|
value.price = Number(value.price.toFixed(2))
|
|
}
|
|
if (that.discountType == 0) { //单品折扣
|
|
value.discountAmount = value.unitPrice * (value.discount / 10)
|
|
value.discountAmount = Number(value.discountAmount.toFixed(2))
|
|
value.price = (value.unitPrice * (value.discount / 10)) * Number(value.productCount)
|
|
value.price = Number(value.price.toFixed(2))
|
|
|
|
}
|
|
}else{
|
|
value.price = value.discountAmount * Number(value.productCount)
|
|
value.price = Number(value.price.toFixed(2))
|
|
}
|
|
|
|
}else{
|
|
if((that.shopId == '1848276507420659713' || that.shopId == '1818888277105709056') && isSaoMa){
|
|
value.price = (value.discountAmount * (value.discount / 10)) * Number(value.productCount)
|
|
value.price = Number(value.price.toFixed(2))
|
|
}else{
|
|
value.price = (value.unitPrice * (value.discount / 10)) * Number(value.productCount)
|
|
value.price = Number(value.price.toFixed(2))
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
this.$forceUpdate()
|
|
this.getAllPrice();
|
|
// if (this.relPrice == '' || this.relPrice == 0) {
|
|
// that.noPay = that.shouldPay
|
|
// } else if (this.relPrice != '' && this.priceOk != '') {
|
|
// that.noPay = this.relPrice - this.priceOk
|
|
// }
|
|
},
|
|
AiAddSpec(value, current,id,name) {
|
|
this.carList.get(id).stockLogList.get(name).isShowBtn = false
|
|
this.getById(value, current,false);
|
|
},
|
|
AiAddReturnSpec(value,id,name) {
|
|
this.carList.get(id).stockLogList.get(name).isShowBtn = false
|
|
this.getByReturnId(value);
|
|
},
|
|
//通过商品id查询商品详细信息
|
|
async getById(id, current,isSaoMa) {
|
|
let that = this;
|
|
that.goodsDetail = id;
|
|
//判断isNew,新商品直接调店铺颜色库
|
|
if(that.attrBuilt == '' || !isSaoMa){
|
|
if (current == 1) {
|
|
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
|
|
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.stockLogList1.length == 1){
|
|
if(value.stockLogList1[0].attributeList == '{"颜色":"均色","尺码":"均码"}' && value.stockLogList1[0].productCount == 1){
|
|
value.stockLogList1[0].productCount = 0
|
|
}
|
|
}
|
|
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
|
|
}
|
|
} else {
|
|
this.pageOldTemList = []
|
|
await this.tui.request("/app/product/getById/" + id+'?customerId='+this.khName.id, "POST", {
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.result.delFlag == 0) {
|
|
that.tui.toast("请将商品上架后再操作!")
|
|
return
|
|
}
|
|
that.goodsDetail = res.result;
|
|
that.goodsDetail.unitPrice = that.goodsDetail.wholesalePrice
|
|
that.temporaryList = []
|
|
this.pageOldTemList = []
|
|
if (that.carList.size > 0) {
|
|
that.carList.forEach(function(value, key) {
|
|
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)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
that.zNum = 0
|
|
that.colorData = []
|
|
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 == 1){
|
|
that.carList.get(id).stockLogList1[0].productCount = 0
|
|
}
|
|
}
|
|
}
|
|
|
|
that.$nextTick(() => {
|
|
that.carList.forEach(function(value, key) {
|
|
if (value.productId == id) {
|
|
for(let i = 0;i<value.stockLogList1.length;i++){
|
|
let name = value.stockLogList1[i].name
|
|
if(name != null && name!=''){
|
|
that.colorData.push(name.split(" | ")[0])
|
|
}
|
|
}
|
|
|
|
that.zNum = Number(value.productCount)
|
|
that.temporaryList = value.stockLogList1
|
|
that.pageOldTemList = value.stockLogList1
|
|
that.oldTemList = value.stockLogList1
|
|
}
|
|
value.stockLogList1 = []
|
|
})
|
|
})
|
|
}
|
|
that.$nextTick(() => {
|
|
this.tui.request(
|
|
"/app/productAttribute/selectAttributeAndValueByCategoryId",
|
|
"POST", {
|
|
categoryId: this.goodsDetail.attrId
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
this.goodsList = []
|
|
this.pecsList = res1.result.stock
|
|
if (typeof(res1.result.attributeAndValue) ==
|
|
'string') {
|
|
let newObj = JSON.parse(res1.result
|
|
.attributeAndValue)
|
|
let newArr = []
|
|
let dataArr = []
|
|
for (let val in newObj) {
|
|
let valueObj = [];
|
|
if(that.colorData.length > 0){
|
|
for (var i = 0; i < newObj[val].length; i++) {
|
|
let isColorChecked = false
|
|
for (var k = 0; k < that.colorData.length; k++) {
|
|
if(that.colorData[k] == newObj[val][i]){
|
|
isColorChecked = true
|
|
}else{
|
|
isColorChecked = false
|
|
}
|
|
}
|
|
valueObj.push({
|
|
value: newObj[val][i],
|
|
isChecked: isColorChecked
|
|
})
|
|
this.dataObj.set(newObj[val][i], val)
|
|
}
|
|
}else{
|
|
for (var i = 0; i < newObj[val].length; i++) {
|
|
valueObj.push({
|
|
value: newObj[val][i],
|
|
isChecked: false
|
|
})
|
|
this.dataObj.set(newObj[val][i], val)
|
|
}
|
|
}
|
|
newArr.push({
|
|
name: val,
|
|
value: valueObj
|
|
})
|
|
}
|
|
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: []
|
|
}
|
|
this.goodsList.push(specs1)
|
|
oldCheck = false
|
|
oldValue = []
|
|
}
|
|
|
|
if(that.goodsDetail.attributeList.length > 0){
|
|
for (var i = 0; i < that.goodsDetail.attributeList.length; i++) {
|
|
for (var j = 0; j < that.goodsDetail.attributeList[i].value.length; j++) {
|
|
|
|
if(that.goodsDetail.attributeList[i].value[j].isChecked == true){
|
|
|
|
that.goodsDetail.attributeList[i].isChecked = false
|
|
that.goodsDetail.attributeList[i].value[j].isChecked = false
|
|
this.attrNameChange(i, that.goodsDetail.attributeList[i].value[j].value, j)
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
this.tui.toast('失败了')
|
|
}
|
|
this.getKCList(res1.result.stock)
|
|
} else {
|
|
this.tui.toast(res1.message)
|
|
}
|
|
}).catch((res) => {})
|
|
})
|
|
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
}
|
|
}else{
|
|
let attr = '{"颜色":"'+that.attrBuilt.split('-')[0]+'","尺码":"'+that.attrBuilt.split('-')[1]+'"}'
|
|
this.pageOldTemList = []
|
|
await this.tui.request("/app/product/getById/" + id+'?customerId='+this.khName.id, "POST", {
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.result.delFlag == 0) {
|
|
that.tui.toast("请将商品上架后再操作!")
|
|
return
|
|
}
|
|
that.goodsDetail = res.result;
|
|
that.goodsDetail.unitPrice = that.goodsDetail.wholesalePrice
|
|
that.temporaryList = []
|
|
this.pageOldTemList = []
|
|
if (that.carList.size > 0) {
|
|
that.carList.forEach(function(value, key) {
|
|
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)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
that.zNum = 0
|
|
that.colorData = []
|
|
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 == 1){
|
|
that.carList.get(id).stockLogList1[0].productCount = 0
|
|
}
|
|
}
|
|
}
|
|
|
|
that.$nextTick(() => {
|
|
that.carList.forEach(function(value, key) {
|
|
if (value.productId == id) {
|
|
for(let i = 0;i<value.stockLogList1.length;i++){
|
|
let name = value.stockLogList1[i].name
|
|
if(name != null && name!=''){
|
|
that.colorData.push(name.split(" | ")[0])
|
|
}
|
|
}
|
|
|
|
that.zNum = Number(value.productCount)
|
|
that.temporaryList = value.stockLogList1
|
|
that.pageOldTemList = value.stockLogList1
|
|
that.oldTemList = value.stockLogList1
|
|
}
|
|
value.stockLogList1 = []
|
|
})
|
|
})
|
|
}
|
|
that.$nextTick(() => {
|
|
this.tui.request(
|
|
"/app/productAttribute/selectAttributeAndValueByCategoryId",
|
|
"POST", {
|
|
categoryId: this.goodsDetail.attrId
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
this.goodsList = []
|
|
this.pecsList = res1.result.stock
|
|
if (typeof(res1.result.attributeAndValue) ==
|
|
'string') {
|
|
let newObj = JSON.parse(res1.result
|
|
.attributeAndValue)
|
|
let newArr = []
|
|
let dataArr = []
|
|
for (let val in newObj) {
|
|
let valueObj = [];
|
|
if(that.colorData.length > 0){
|
|
for (var i = 0; i < newObj[val].length; i++) {
|
|
let isColorChecked = false
|
|
for (var k = 0; k < that.colorData.length; k++) {
|
|
if(that.colorData[k] == newObj[val][i]){
|
|
isColorChecked = true
|
|
}else{
|
|
isColorChecked = false
|
|
}
|
|
}
|
|
valueObj.push({
|
|
value: newObj[val][i],
|
|
isChecked: isColorChecked
|
|
})
|
|
this.dataObj.set(newObj[val][i], val)
|
|
}
|
|
}else{
|
|
for (var i = 0; i < newObj[val].length; i++) {
|
|
valueObj.push({
|
|
value: newObj[val][i],
|
|
isChecked: false
|
|
})
|
|
this.dataObj.set(newObj[val][i], val)
|
|
}
|
|
}
|
|
newArr.push({
|
|
name: val,
|
|
value: valueObj
|
|
})
|
|
}
|
|
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: []
|
|
}
|
|
this.goodsList.push(specs1)
|
|
oldCheck = false
|
|
oldValue = []
|
|
}
|
|
|
|
if(that.goodsDetail.attributeList.length > 0){
|
|
for (var i = 0; i < that.goodsDetail.attributeList.length; i++) {
|
|
for (var j = 0; j < that.goodsDetail.attributeList[i].value.length; j++) {
|
|
|
|
if(that.goodsDetail.attributeList[i].value[j].isChecked == true){
|
|
|
|
that.goodsDetail.attributeList[i].isChecked = false
|
|
that.goodsDetail.attributeList[i].value[j].isChecked = false
|
|
this.attrNameChange(i, that.goodsDetail.attributeList[i].value[j].value, j)
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
this.tui.toast('失败了')
|
|
}
|
|
//this.getKCList(res1.result.stock)
|
|
that.$nextTick(() => {
|
|
let productcount1 = 1
|
|
if(that.saomaotype == '1'){
|
|
productcount1 = -1
|
|
}
|
|
let stockcount = null
|
|
if(this.pecsList.length == 1){
|
|
attr = this.pecsList[0].attributeList
|
|
stockcount = this.pecsList[0].stockCount
|
|
}else{
|
|
for(let a = 0; a < this.pecsList.length; a++){
|
|
if(this.pecsList[a].attributeList == attr){
|
|
stockcount = this.pecsList[a].stockCount
|
|
}
|
|
}
|
|
}
|
|
if(that.carList.size > 0 && that.carList.has(id)){
|
|
if(that.carList.get(id).stockLogList.has(attr)){
|
|
let oldProductCount = that.carList.get(id).stockLogList.get(attr).productCount
|
|
if(oldProductCount != undefined){
|
|
productcount1 = productcount1 + Number(oldProductCount)
|
|
}
|
|
}
|
|
}
|
|
|
|
if(stockcount == null){
|
|
this.getKCList(res1.result.stock)
|
|
}else{
|
|
that.attributeList = {
|
|
attributeList: attr,
|
|
productCount: productcount1,
|
|
productNum: stockcount,
|
|
name: that.attrBuilt.split('-')[0] + ' | ' +that.attrBuilt.split('-')[1],
|
|
price: this.purchasePrice
|
|
}
|
|
that.temporaryList = []
|
|
that.temporaryList.push(that.attributeList);
|
|
that.temporaryCheck(true)
|
|
}
|
|
}).catch((res) => {})
|
|
|
|
} else {
|
|
this.tui.toast(res1.message)
|
|
}
|
|
}).catch((res) => {})
|
|
})
|
|
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
}
|
|
|
|
},
|
|
//通过商品id查询商品详细信息
|
|
async getByReturnId(id) {
|
|
let that = this;
|
|
this.pageOldTemReturnList = []
|
|
await 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
|
|
}
|
|
that.goodsReturnDetail = res.result;
|
|
that.temporaryReturnList = []
|
|
this.pageOldTemReturnList = []
|
|
if (that.carList.size > 0) {
|
|
that.carList.forEach(function(value, key) {
|
|
value.returnList.forEach(function(values, keys) {
|
|
if (value.returnList1.length == 0) {
|
|
let obj = {
|
|
productCount: Number(values.productCount),
|
|
name: values.name,
|
|
attributeList: keys,
|
|
productNum: values.productNum
|
|
}
|
|
value.returnList1.push(obj)
|
|
} else {
|
|
for (var i = 0; i < value.returnList1
|
|
.length; i++) {
|
|
if (value.returnList1[i].attributeList !=
|
|
keys) {
|
|
if (value.returnList1.length == (i +
|
|
1)) {
|
|
let obj = {
|
|
productCount: Number(values
|
|
.productCount),
|
|
name: values.name,
|
|
attributeList: keys,
|
|
productNum: values.productNum
|
|
}
|
|
value.returnList1.push(obj)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
that.zReturnNum = 0
|
|
that.$nextTick(() => {
|
|
that.carList.forEach(function(value, key) {
|
|
if (value.productId == id) {
|
|
that.zReturnNum = Number(value.returnCount)
|
|
that.temporaryReturnList = value.returnList1
|
|
that.pageOldTemReturnList = value.returnList1
|
|
that.oldTemReturnList = value.returnList1
|
|
}
|
|
value.returnList1 = []
|
|
})
|
|
})
|
|
}
|
|
that.$nextTick(() => {
|
|
this.tui.request(
|
|
"/app/productAttribute/selectAttributeAndValueByCategoryId",
|
|
"POST", {
|
|
categoryId: this.goodsReturnDetail.attrId
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
this.goodsReturnList = []
|
|
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
|
|
})
|
|
this.dataObj.set(newObj[val][i], val)
|
|
}
|
|
newArr.push({
|
|
name: val,
|
|
value: valueObj
|
|
})
|
|
}
|
|
this.goodsReturnDetail.attributeList = newArr;
|
|
for (var i = 0; i < this.goodsReturnDetail.attributeList
|
|
.length; i++) {
|
|
let oldCheck = false
|
|
let oldValue = []
|
|
for (var m = 0; m < this.goodsReturnDetail
|
|
.attributeList[i].value
|
|
.length; m++) {
|
|
if (this.goodsReturnDetail.attributeList[i]
|
|
.value[m].isChecked ==
|
|
true) {
|
|
oldCheck = true
|
|
oldValue.push(this.goodsReturnDetail
|
|
.attributeList[i].value[
|
|
m].value)
|
|
}
|
|
}
|
|
let specs1 = {
|
|
specs: []
|
|
}
|
|
this.goodsReturnList.push(specs1)
|
|
oldCheck = false
|
|
oldValue = []
|
|
}
|
|
if (this.temporaryReturnList == '') {
|
|
this.attrReturnNameChange(0, that.goodsReturnDetail
|
|
.attributeList[0].value[0].value, 0)
|
|
}
|
|
} else {
|
|
this.tui.toast('失败了')
|
|
}
|
|
this.getKCReturnList(res1.result.stock)
|
|
} else {
|
|
this.tui.toast(res1.message)
|
|
}
|
|
}).catch((res) => {})
|
|
})
|
|
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
//库存商品详情
|
|
getKCList(list) {
|
|
this.yanseList = new Map()
|
|
this.chimaList = new Map()
|
|
this.$refs.shopPopup.open('bottom')
|
|
this.pecsList = list
|
|
for (let i = 0; i < list.length; i++) {
|
|
let attributeList = JSON.parse(list[i].attributeList)
|
|
Object.keys(attributeList).forEach(key => {
|
|
if (key == '颜色') {
|
|
if (this.yanseList.has(attributeList[key]) != true) {
|
|
this.yanseList.set(attributeList[key], attributeList[key])
|
|
}
|
|
|
|
} else {
|
|
if (this.chimaList.has(attributeList[key]) != true) {
|
|
this.chimaList.set(attributeList[key], attributeList[key])
|
|
}
|
|
}
|
|
})
|
|
}
|
|
for (let i = 0; i < this.goodsDetail.attributeList[0].value.length; i++) { //颜色
|
|
if (this.yanseList.has(this.goodsDetail.attributeList[0].value[i].value) == true) {
|
|
this.goodsDetail.attributeList[0].value[i].isKucun = true
|
|
}
|
|
}
|
|
for (let i = 0; i < this.goodsDetail.attributeList[1].value.length; i++) { //尺码
|
|
if (this.chimaList.has(this.goodsDetail.attributeList[1].value[i].value) == true) {
|
|
this.goodsDetail.attributeList[1].value[i].isKucun = true
|
|
}
|
|
}
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 200)
|
|
},
|
|
//库存商品详情
|
|
getKCReturnList(list) {
|
|
this.yanseList = new Map()
|
|
this.chimaList = new Map()
|
|
this.$refs.returnDialog.open('bottom')
|
|
this.pecsList = list
|
|
|
|
for (let i = 0; i < list.length; i++) {
|
|
let attributeList = JSON.parse(list[i].attributeList)
|
|
Object.keys(attributeList).forEach(key => {
|
|
if (key == '颜色') {
|
|
if (this.yanseList.has(attributeList[key]) != true) {
|
|
this.yanseList.set(attributeList[key], attributeList[key])
|
|
}
|
|
|
|
} else {
|
|
if (this.chimaList.has(attributeList[key]) != true) {
|
|
this.chimaList.set(attributeList[key], attributeList[key])
|
|
}
|
|
}
|
|
})
|
|
}
|
|
for (let i = 0; i < this.goodsReturnDetail.attributeList[0].value.length; i++) { //颜色
|
|
if (this.yanseList.has(this.goodsReturnDetail.attributeList[0].value[i].value) == true) {
|
|
this.goodsReturnDetail.attributeList[0].value[i].isKucun = true
|
|
}
|
|
}
|
|
for (let i = 0; i < this.goodsReturnDetail.attributeList[1].value.length; i++) { //尺码
|
|
if (this.chimaList.has(this.goodsReturnDetail.attributeList[1].value[i].value) == true) {
|
|
this.goodsReturnDetail.attributeList[1].value[i].isKucun = true
|
|
}
|
|
}
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 200)
|
|
},
|
|
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++) {
|
|
if (this.temporaryList[i].productCount > 0) {
|
|
this.zNum += Number(this.temporaryList[i].productCount)
|
|
}
|
|
}
|
|
},
|
|
temporaryReturnChange(val, item) {
|
|
if (item != '' && item != undefined) {
|
|
for (var m = 0; m < this.pageOldTemReturnList.length; m++) {
|
|
if (item.attributeList == this.pageOldTemReturnList[m].attributeList) {
|
|
this.pageOldTemReturnList[m].productCount = Number(item.productCount)
|
|
break;
|
|
}
|
|
}
|
|
for (var j = 0; j < this.oldTemReturnList.length; j++) {
|
|
if (item.attributeList == this.oldTemReturnList[j].attributeList) {
|
|
this.oldTemReturnList[j].productCount = Number(item.productCount)
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
this.zReturnNum = 0
|
|
for (var i = 0; i < this.temporaryReturnList.length; i++) {
|
|
if (this.temporaryReturnList[i].productCount > 0) {
|
|
this.zReturnNum += Number(this.temporaryReturnList[i].productCount)
|
|
}
|
|
}
|
|
},
|
|
handleBlur(e) {
|
|
this.categoryText = e.detail.value
|
|
},
|
|
noChangeCustomPopup(e){
|
|
if(e.show == false){
|
|
this.checkCanBuy = []
|
|
}
|
|
},
|
|
dialogClose() {
|
|
this.$refs.specDialog.close()
|
|
this.categoryText = ''
|
|
},
|
|
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.$forceUpdate()
|
|
this.dialogClose()
|
|
},
|
|
//折扣种类选择
|
|
discountChange(e) {
|
|
let that = this;
|
|
that.shouldPay = 0
|
|
this.discountType = e.detail.value;
|
|
this.carList.forEach(function(value, key) {
|
|
value.price = Number(value.productCount) * value.unitPrice //总价
|
|
value.discount = 10 //折扣
|
|
value.discountAmount = value.unitPrice
|
|
that.shouldPay += value.price
|
|
})
|
|
this.price = this.shouldPay
|
|
this.relPrice = this.shouldPay
|
|
this.priceOk = this.checkRealPay(this.shouldPay)
|
|
// if(this.priceOk != ''){
|
|
// this.priceOk = this.relPrice
|
|
// }
|
|
|
|
|
|
this.discountNum = 10
|
|
for (let i = 0; i < this.items.length; i++) {
|
|
if (this.items[i].value === e.detail.value) {
|
|
this.discountCurrent = i;
|
|
break;
|
|
}
|
|
}
|
|
setTimeout(res=>{
|
|
this.getAmountAndWho()
|
|
},500)
|
|
// this.getAllPrice()
|
|
|
|
},
|
|
changeRemark(e) {
|
|
this.remark = e.detail.value
|
|
},
|
|
changePbAddress(e) {
|
|
this.pbAddress = e.detail.value
|
|
},
|
|
//整体折扣数字框改变
|
|
change(e) {
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
if (this.linshiPrice == e.target.value) {
|
|
this.relPrice = e.target.value
|
|
} else {
|
|
if (e.detail.value > 10) {
|
|
this.discountNum = 10
|
|
} else if (e.detail.value < 0) {
|
|
this.discountNum = 0
|
|
} else if (e.target.value == '') {
|
|
this.discountNum = this.linshiPrice
|
|
} else {
|
|
this.discountNum = e.target.value
|
|
}
|
|
}
|
|
// this.getAllPrice()
|
|
this.getAmountAndWho()
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 200)
|
|
},
|
|
//再次计算一遍销售金额 和 退货金额
|
|
reloadPrices(){
|
|
let that = this
|
|
if(that.isChangeShouldPay == false){
|
|
that.shouldPay = 0
|
|
}
|
|
if(that.isChangeReturnPay == false){
|
|
that.returnPay = 0
|
|
}
|
|
this.returnTotalAmount = 0
|
|
this.totalAmount = 0
|
|
this.carList.forEach(function(value, key) {
|
|
let buyCount = 0
|
|
let returnCount = 0
|
|
value.stockLogList.forEach(function(value1, key1) {
|
|
if(value1.productCount > 0){
|
|
buyCount += Number(value1.productCount)
|
|
that.totalAmount += Number(value1.productCount)
|
|
}
|
|
if(value1.productCount < 0){
|
|
returnCount += Number(Math.abs(value1.productCount))
|
|
that.returnTotalAmount += Number(Math.abs(value1.productCount))
|
|
}
|
|
})
|
|
if(value.returnList != undefined){
|
|
value.returnList.forEach(function(value1, key1) {
|
|
returnCount += Number(Math.abs(value1.productCount))
|
|
that.returnTotalAmount += Number(Math.abs(value1.productCount))
|
|
})
|
|
}
|
|
value.returnCount = returnCount
|
|
value.productCount = buyCount
|
|
value.price = Number((Number(value.productCount) * value.discountAmount).toFixed(2))
|
|
if(that.isChangeShouldPay == false){
|
|
that.shouldPay += Number((buyCount * Number(value.discountAmount)))
|
|
}
|
|
if(that.isChangeReturnPay == false){
|
|
that.returnPay += Number((Math.abs(returnCount) * Number(value.returnPrice)))
|
|
}
|
|
})
|
|
if(that.isChangeShouldPay == false){
|
|
that.shouldPay = Number(that.shouldPay.toFixed(2))
|
|
}
|
|
if(that.isChangeReturnPay == false){
|
|
that.returnPay = Number(that.returnPay.toFixed(2))
|
|
}
|
|
},
|
|
xiaoshouChange(e) {
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
if (this.linshiPrice == e.target.value) {
|
|
this.shouldPay = e.target.value
|
|
this.isChangeShouldPay = false
|
|
} else {
|
|
if (e.target.value == '') {
|
|
this.shouldPay = this.linshiPrice
|
|
this.isChangeShouldPay = false
|
|
} else {
|
|
this.isChangeShouldPay = true //如果billCountPrice为false,则开单和挂单的时候不再重新计算价格
|
|
this.shouldPay = e.target.value
|
|
}
|
|
}
|
|
this.getAllPrice(this.shouldPay)
|
|
// this.getAmountAndWho()
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 200)
|
|
},
|
|
tuihuoChange(e) {
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
if (this.linshiPrice == e.target.value) {
|
|
this.returnPay = e.target.value
|
|
this.isChangeReturnPay = false
|
|
} else {
|
|
if (e.target.value == '') {
|
|
this.returnPay = this.linshiPrice
|
|
this.isChangeReturnPay = false
|
|
} else {
|
|
this.isChangeReturnPay = true //如果billCountPrice为false,则开单和挂单的时候不再重新计算价格
|
|
this.returnPay = e.target.value
|
|
}
|
|
}
|
|
this.getAllPrice(this.returnPay)
|
|
// this.getAmountAndWho()
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 200)
|
|
},
|
|
//点击发货方式按钮
|
|
radioChange(e) {
|
|
this.gysName = ''
|
|
this.wlName = ''
|
|
this.kdyName = ''
|
|
this.lbgName = ''
|
|
this.radioType = e.detail.value;
|
|
for (let i = 0; i < this.logisticsType.length; i++) {
|
|
if (this.logisticsType[i].value === e.detail.value) {
|
|
this.lunbocurrent = i;
|
|
break;
|
|
}
|
|
}
|
|
},
|
|
//发货方式选择
|
|
goPopleList(popleType) {
|
|
if (popleType == 'kdyName' && this.wlName == '') {
|
|
uni.showToast({
|
|
title: "先选择快递公司",
|
|
icon: 'error'
|
|
})
|
|
return
|
|
}
|
|
if(this.khName != ''){
|
|
this.oldCustomId = this.khName.id
|
|
}
|
|
if ((popleType == 'wlName' || popleType == 'fcName') && this.khName == '') {
|
|
uni.showToast({
|
|
title: "先选择客户",
|
|
icon: 'error'
|
|
})
|
|
return
|
|
}
|
|
if (popleType == 'khName') {
|
|
uni.setStorageSync('kaidanBack', true)
|
|
}
|
|
let companyType = this.radioType == 1 ? this.wlName.id : ''
|
|
uni.navigateTo({
|
|
url: '/package1/index/peopleList?popleType=' + popleType + '&companyType=' + companyType +
|
|
'&khName=' + JSON.stringify(this.khName)
|
|
})
|
|
},
|
|
clickClose() {
|
|
this.evalue = []
|
|
this.oldTemList = []
|
|
this.allChangeNum = 0
|
|
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
|
|
}
|
|
}
|
|
},
|
|
//弹窗选择规格后,点击退货弹窗中选好了按钮
|
|
temporaryReturnCheck() {
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
|
|
this.evalue = []
|
|
let that = this,
|
|
carList1 = [],
|
|
newList = []
|
|
for (let i = 0; i < this.temporaryReturnList.length; i++) {
|
|
if (this.temporaryReturnList[i].productCount != 0) {
|
|
newList.push(this.temporaryReturnList[i])
|
|
}
|
|
}
|
|
this.$nextTick(() => {
|
|
let data = {
|
|
id: this.goodsReturnDetail.id,
|
|
price: this.zPrice,
|
|
num: this.zReturnNum,
|
|
isNew: this.goodsReturnDetail.isNew,
|
|
unitPrice: this.goodsReturnDetail.unitPrice,
|
|
categoryId: this.goodsReturnDetail.categoryId,
|
|
productName: this.goodsReturnDetail.productName,
|
|
productSn: this.goodsReturnDetail.productSn,
|
|
productPicture: this.goodsReturnDetail.productPicture,
|
|
supplierName: this.goodsReturnDetail.supplierName,
|
|
saleDetailQueryDTO: newList,
|
|
wholesalePrice: this.goodsReturnDetail.wholesalePrice,
|
|
lsprice: this.goodsReturnDetail.price
|
|
}
|
|
carList1.push(data)
|
|
this.temporaryReturnList = []
|
|
this.oldTemReturnList = []
|
|
this.purchasePrice = ''
|
|
this.zPrice = ''
|
|
this.zReturnNum = ''
|
|
for (let i = 0; i < this.goodsReturnDetail.attributeList.length; i++) {
|
|
this.goodsReturnDetail.attributeList[i].isChecked = false;
|
|
for (let m = 0; m < this.goodsReturnDetail.attributeList[i].value.length; m++) {
|
|
this.goodsReturnDetail.attributeList[i].value[m].isChecked = false
|
|
}
|
|
}
|
|
if (this.carList.size == 0) { //当前页没有数据
|
|
for (let i = 0; i < carList1.length; i++) {
|
|
let obj = {
|
|
attrId: carList1[i].attrId,
|
|
purchasePrice: carList1[i].price, //采购价
|
|
price: 0, //总价
|
|
buyCount:carList1[i].buyCount,
|
|
discount: 10, //折扣
|
|
unitPrice: carList1[i].unitPrice || 0, //单价
|
|
customerCategoryRule:JSON.parse(carList1[i].customerCategoryRule),
|
|
categoryId: carList1[i].categoryId,
|
|
discountAmount: carList1[i].isNew ? (carList1[i].unitPrice || 0) : (carList1[i]
|
|
.wholesalePrice || 0), //折后价
|
|
returnPrice: carList1[i].wholesalePrice || 0,
|
|
returnCount: 0,
|
|
disNoAmount: 0, //折前价,用于计算整体折扣
|
|
wholesalePrice: carList1[i].wholesalePrice, //批发价
|
|
lsprice: carList1[i].lsprice, //零售价
|
|
productCount: 0, //总数量
|
|
productId: carList1[i].id,
|
|
productName: carList1[i].productName,
|
|
productPicture: carList1[i].productPicture,
|
|
productSn: carList1[i].productSn,
|
|
stockLogList: new Map(),
|
|
returnList: new Map(),
|
|
stockLogList1: [],
|
|
supplierName: carList1[i].supplierName //供应商
|
|
}
|
|
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
|
|
}
|
|
obj.returnList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
|
|
if (carList1[i].saleDetailQueryDTO[m].productCount > 0) {
|
|
obj.productCount += Number(carList1[i].saleDetailQueryDTO[m].productCount)
|
|
} else {
|
|
obj.returnCount += Math.abs(carList1[i].saleDetailQueryDTO[m].productCount)
|
|
}
|
|
}
|
|
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).returnList = new Map()
|
|
}
|
|
if (this.carList.has(carList1[i].id) == true) { //商品相同
|
|
this.carList.get(carList1[i].id).returnCount = 0
|
|
this.carList.get(carList1[i].id).returnList.forEach(function(value, key) {
|
|
if(value.productCount < 0){
|
|
that.carList.get(carList1[i].id).returnCount += Math.abs(value.productCount)
|
|
}
|
|
|
|
})
|
|
this.carList.get(carList1[i].id).stockLogList.forEach(function(value, key) {
|
|
if(value.productCount < 0){
|
|
that.carList.get(carList1[i].id).returnCount += Math.abs(value.productCount)
|
|
}
|
|
})
|
|
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
|
|
|
|
if (this.carList.get(carList1[i].id).returnList.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
|
|
}
|
|
|
|
this.carList.get(carList1[i].id).returnList.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
|
|
}
|
|
this.carList.get(carList1[i].id).returnList.set(carList1[i]
|
|
.saleDetailQueryDTO[
|
|
m].attributeList, data1)
|
|
}
|
|
if (carList1[i].saleDetailQueryDTO[m].productCount > 0) {
|
|
this.carList.get(carList1[i].id).productCount += Number(carList1[i]
|
|
.saleDetailQueryDTO[m].productCount)
|
|
} else {
|
|
this.carList.get(carList1[i].id).returnCount += Math.abs(carList1[i]
|
|
.saleDetailQueryDTO[m].productCount)
|
|
}
|
|
that.carList.get(carList1[i].id).returnPay = Number(that.carList.get(carList1[i].id)
|
|
.returnCount) *
|
|
that.carList.get(carList1[i].id).unitPrice
|
|
}
|
|
} else { //商品不同
|
|
let obj = {
|
|
attrId: carList1[i].attrId,
|
|
purchasePrice: carList1[i].price, //采购价
|
|
price: 0,
|
|
discount: 10,
|
|
buyCount:carList1[i].buyCount,
|
|
customerCategoryRule:JSON.parse(carList1[i].customerCategoryRule),
|
|
discountAmount: carList1[i].isNew ? (carList1[i].unitPrice || 0) : (
|
|
carList1[i].wholesalePrice || 0),
|
|
returnPrice: carList1[i].wholesalePrice || 0,
|
|
returnCount: 0,
|
|
disNoAmount: 0, //折前价,用于计算整体折扣
|
|
unitPrice: carList1[i].unitPrice, //单价
|
|
categoryId: carList1[i].categoryId,
|
|
wholesalePrice: carList1[i].wholesalePrice, //批发价
|
|
lsprice: carList1[i].lsprice, //零售价
|
|
productCount: 0,
|
|
productId: carList1[i].id,
|
|
productName: carList1[i].productName,
|
|
productPicture: carList1[i].productPicture,
|
|
stockLogList: new Map(),
|
|
returnList: new Map(),
|
|
stockLogList1: [],
|
|
productSn: carList1[i].productSn,
|
|
supplierName: carList1[i].supplierName
|
|
}
|
|
|
|
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
|
|
}
|
|
obj.returnList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
|
|
if (carList1[i].saleDetailQueryDTO[m].productCount > 0) {
|
|
obj.productCount += Number(carList1[i].saleDetailQueryDTO[m].productCount)
|
|
} else {
|
|
obj.returnCount += Math.abs(carList1[i].saleDetailQueryDTO[m].productCount)
|
|
}
|
|
|
|
}
|
|
this.carList.set(carList1[i].id, obj)
|
|
}
|
|
}
|
|
carList1 = []
|
|
}
|
|
this.carList.forEach(function(value, key) {
|
|
if (value.isNew != true) {
|
|
/* if(that.priceType == ''){
|
|
if(value.returnPrice =='' || value.returnPrice ==null || value.returnPrice ==0){
|
|
value.returnPrice = value.wholesalePrice
|
|
}
|
|
|
|
}else if (that.priceType == 0) { //零售
|
|
value.returnPrice = value.lsprice
|
|
} else if (that.priceType == 1) { //批发
|
|
value.returnPrice = value.wholesalePrice
|
|
} */
|
|
if(value.isChangePrice == undefined){
|
|
value.isChangePrice = false
|
|
}
|
|
if(value.isChangeReturnPrice == undefined){
|
|
value.isChangeReturnPrice = false
|
|
}
|
|
if (that.priceType == '') {
|
|
if(value.returnPrice =='' || value.returnPrice ==null || value.returnPrice ==0){
|
|
value.returnPrice = !value.isChangeReturnPrice ? value.returnPrice : value.wholesalePrice
|
|
}
|
|
value.unitPrice = value.discountAmount > 0 ? value.discountAmount : value.wholesalePrice
|
|
} else if (that.priceType == 0) { //零售
|
|
value.unitPrice = !value.isChangePrice ? value.lsprice : value.unitPrice
|
|
value.discountAmount = !value.isChangePrice ? value.lsprice : value.unitPrice
|
|
value.returnPrice = !value.isChangeReturnPrice ? value.lsprice : value.unitPrice
|
|
} else if (that.priceType == 1) { //批发
|
|
value.unitPrice = !value.isChangePrice ? value.wholesalePrice : value.unitPrice
|
|
value.discountAmount = !value.isChangePrice ? value.wholesalePrice : value.unitPrice
|
|
value.returnPrice = !value.isChangeReturnPrice ? value.wholesalePrice : value.unitPrice
|
|
}
|
|
}
|
|
|
|
})
|
|
this.getAmountAndWho();
|
|
this.$refs.returnDialog.close()
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 500)
|
|
})
|
|
},
|
|
//弹窗选择规格后,点击弹窗中选好了按钮
|
|
temporaryCheck(isSaoMa) {
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
|
|
this.evalue = []
|
|
let that = this,
|
|
carList1 = [],
|
|
newList = []
|
|
for (let i = 0; i < this.temporaryList.length; i++) {
|
|
if (this.temporaryList[i].productCount != 0) {
|
|
newList.push(this.temporaryList[i])
|
|
}
|
|
}
|
|
this.$nextTick(() => {
|
|
let data = {
|
|
attrId:this.goodsDetail.attrId,
|
|
id: this.goodsDetail.id,
|
|
price: this.zPrice,
|
|
num: this.zNum,
|
|
buyCount:this.goodsDetail.buyCount,
|
|
customerCategoryList:this.goodsDetail.customerCategoryRule != null?JSON.parse(this.goodsDetail.customerCategoryRule):"",
|
|
isNew: this.goodsDetail.isNew,
|
|
unitPrice: this.goodsDetail.unitPrice,
|
|
categoryId: this.goodsDetail.categoryId,
|
|
productName: this.goodsDetail.productName,
|
|
productSn: this.goodsDetail.productSn,
|
|
productPicture: this.goodsDetail.productPicture,
|
|
supplierName: this.goodsDetail.supplierName,
|
|
saleDetailQueryDTO: newList,
|
|
wholesalePrice: this.goodsDetail.wholesalePrice,
|
|
lsprice: this.goodsDetail.price
|
|
}
|
|
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 = {
|
|
attrId:carList1[i].attrId,
|
|
purchasePrice: carList1[i].price, //采购价
|
|
price: 0, //总价
|
|
discount: 10, //折扣
|
|
buyCount:carList1[i].buyCount,
|
|
customerCategoryList:carList1[i].customerCategoryList,
|
|
unitPrice: carList1[i].unitPrice || 0, //单价
|
|
categoryId: carList1[i].categoryId,
|
|
discountAmount: ((this.shopId == '1848276507420659713' || this.shopId == '1818888277105709056') && isSaoMa) ? carList1[i].lsprice : carList1[i].isNew ? (carList1[i].unitPrice || 0) : (carList1[i]
|
|
.wholesalePrice || 0), //折后价
|
|
returnPrice: carList1[i].isNew ? (carList1[i].unitPrice || 0) : (carList1[i]
|
|
.wholesalePrice || 0),
|
|
returnCount: 0,
|
|
disNoAmount: 0, //折前价,用于计算整体折扣
|
|
wholesalePrice: carList1[i].wholesalePrice, //批发价
|
|
lsprice: carList1[i].lsprice, //零售价
|
|
productCount: 0, //总数量
|
|
productId: carList1[i].id,
|
|
productName: carList1[i].productName,
|
|
productPicture: carList1[i].productPicture,
|
|
productSn: carList1[i].productSn,
|
|
stockLogList: new Map(),
|
|
returnList: new Map(),
|
|
stockLogList1: [],
|
|
supplierName: carList1[i].supplierName //供应商
|
|
}
|
|
if(this.khName.categoryId != null && this.khName.categoryId != ''){
|
|
if(obj.customerCategoryList != null){
|
|
for(let i=0;i<obj.customerCategoryList.length;i++){
|
|
if(this.khName.categoryId == obj.customerCategoryList[i].categoryId){
|
|
if(obj.customerCategoryList[i].categoryPrice != ''){
|
|
if(obj.unitPrice == obj.wholesalePrice){
|
|
obj.discountAmount = obj.customerCategoryList[i].categoryPrice
|
|
obj.unitPrice = obj.customerCategoryList[i].categoryPrice
|
|
}
|
|
|
|
if(obj.returnPrice == obj.wholesalePrice){
|
|
obj.returnPrice = obj.customerCategoryList[i].categoryPrice
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
obj.discountAmount = obj.unitPrice
|
|
}
|
|
|
|
}else{
|
|
if((this.shopId == '1848276507420659713' || this.shopId == '1818888277105709056') && isSaoMa){
|
|
|
|
}else{
|
|
obj.discountAmount = obj.unitPrice
|
|
}
|
|
}
|
|
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
|
|
}
|
|
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
|
|
if (carList1[i].saleDetailQueryDTO[m].productCount > 0) {
|
|
obj.productCount += Number(carList1[i].saleDetailQueryDTO[m].productCount)
|
|
} else {
|
|
obj.returnCount += Math.abs(carList1[i].saleDetailQueryDTO[m].productCount)
|
|
}
|
|
}
|
|
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 && !isSaoMa) {
|
|
this.carList.get(carList1[i].id).stockLogList = new Map()
|
|
}
|
|
if (this.carList.has(carList1[i].id) == true) { //商品相同
|
|
if(!isSaoMa){
|
|
this.carList.get(carList1[i].id).productCount = 0
|
|
this.carList.get(carList1[i].id).returnCount = 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
|
|
}
|
|
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
|
|
}
|
|
this.carList.get(carList1[i].id).stockLogList.set(carList1[i]
|
|
.saleDetailQueryDTO[
|
|
m].attributeList, data1)
|
|
}
|
|
if (carList1[i].saleDetailQueryDTO[m].productCount > 0) {
|
|
if(isSaoMa){
|
|
if(this.saomaotype == '1'){
|
|
this.carList.get(carList1[i].id).productCount --
|
|
}else{
|
|
this.carList.get(carList1[i].id).productCount ++
|
|
}
|
|
}else{
|
|
this.carList.get(carList1[i].id).productCount += Number(carList1[i].saleDetailQueryDTO[m].productCount)
|
|
}
|
|
|
|
} else {
|
|
if(isSaoMa){
|
|
if(this.saomaotype == '1'){
|
|
this.carList.get(carList1[i].id).returnCount --
|
|
}else{
|
|
this.carList.get(carList1[i].id).returnCount ++
|
|
}
|
|
}else{
|
|
this.carList.get(carList1[i].id).returnCount += Math.abs(carList1[i]
|
|
.saleDetailQueryDTO[m].productCount)
|
|
}
|
|
}
|
|
if((this.shopId == '1848276507420659713' || this.shopId == '1818888277105709056') && isSaoMa){
|
|
|
|
}else{
|
|
that.carList.get(carList1[i].id).price = Number(that.carList.get(carList1[i].id)
|
|
.productCount) *
|
|
that.carList.get(carList1[i].id).unitPrice
|
|
}
|
|
|
|
}
|
|
if(that.carList.get(carList1[i].id).returnList.size > 0){
|
|
that.carList.get(carList1[i].id).returnList.forEach(function(value, key) {
|
|
that.carList.get(carList1[i].id).returnCount += Math.abs(value.productCount)
|
|
})
|
|
}
|
|
} else { //商品不同
|
|
let obj = {
|
|
attrId:carList1[i].attrId,
|
|
purchasePrice: carList1[i].price, //采购价
|
|
price: 0,
|
|
discount: 10,
|
|
buyCount:carList1[i].buyCount,
|
|
customerCategoryList:carList1[i].customerCategoryList,
|
|
discountAmount: ((this.shopId == '1848276507420659713' || this.shopId == '1818888277105709056') && isSaoMa) ? carList1[i].lsprice : carList1[i].isNew ? (carList1[i].unitPrice || 0) : (carList1[i]
|
|
.wholesalePrice || 0), //折后价
|
|
returnPrice: carList1[i].isNew ? (carList1[i].unitPrice || 0) : (carList1[
|
|
i].wholesalePrice || 0),
|
|
returnCount: 0,
|
|
disNoAmount: 0, //折前价,用于计算整体折扣
|
|
unitPrice: carList1[i].unitPrice, //单价
|
|
categoryId: carList1[i].categoryId,
|
|
wholesalePrice: carList1[i].wholesalePrice, //批发价
|
|
lsprice: carList1[i].lsprice, //零售价
|
|
productCount: 0,
|
|
productId: carList1[i].id,
|
|
productName: carList1[i].productName,
|
|
productPicture: carList1[i].productPicture,
|
|
stockLogList: new Map(),
|
|
returnList: new Map(),
|
|
stockLogList1: [],
|
|
productSn: carList1[i].productSn,
|
|
supplierName: carList1[i].supplierName
|
|
}
|
|
if(this.khName.categoryId != null && this.khName.categoryId != ''){
|
|
if(obj.customerCategoryList != null){
|
|
for(let i=0;i<obj.customerCategoryList.length;i++){
|
|
if(this.khName.categoryId == obj.customerCategoryList[i].categoryId){
|
|
if(obj.customerCategoryList[i].categoryPrice != ''){
|
|
if(obj.unitPrice == obj.wholesalePrice){
|
|
obj.discountAmount = obj.customerCategoryList[i].categoryPrice
|
|
obj.unitPrice = obj.customerCategoryList[i].categoryPrice
|
|
}
|
|
|
|
if(obj.returnPrice == obj.wholesalePrice){
|
|
obj.returnPrice = obj.customerCategoryList[i].categoryPrice
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
obj.discountAmount = obj.unitPrice
|
|
}
|
|
|
|
}else{
|
|
if((this.shopId == '1848276507420659713' || this.shopId == '1818888277105709056') && isSaoMa){
|
|
|
|
}else{
|
|
obj.discountAmount = obj.unitPrice
|
|
}
|
|
}
|
|
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
|
|
}
|
|
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
|
|
if (carList1[i].saleDetailQueryDTO[m].productCount > 0) {
|
|
obj.productCount += Number(carList1[i].saleDetailQueryDTO[m].productCount)
|
|
} else {
|
|
obj.returnCount += Math.abs(carList1[i].saleDetailQueryDTO[m].productCount)
|
|
}
|
|
|
|
}
|
|
this.carList.set(carList1[i].id, obj)
|
|
}
|
|
}
|
|
carList1 = []
|
|
}
|
|
this.carList.forEach(function(value, key) {
|
|
if (value.isNew != true) {
|
|
/* if(that.priceType == ''){
|
|
|
|
}else{
|
|
if (that.priceType == 0) { //零售
|
|
value.unitPrice = value.lsprice
|
|
} else if (that.priceType == 1) { //批发
|
|
value.unitPrice = value.wholesalePrice
|
|
} */
|
|
if(value.isChangePrice == undefined){
|
|
value.isChangePrice = false
|
|
}
|
|
if(value.isChangeReturnPrice == undefined){
|
|
value.isChangeReturnPrice = false
|
|
}
|
|
if (that.priceType == '') {
|
|
if(value.returnPrice =='' || value.returnPrice ==null || value.returnPrice ==0){
|
|
value.returnPrice = !value.isChangeReturnPrice ? value.returnPrice : value.wholesalePrice
|
|
}
|
|
value.unitPrice = value.discountAmount > 0 ? value.discountAmount : value.wholesalePrice
|
|
} else if (that.priceType == 0) { //零售
|
|
value.unitPrice = !value.isChangePrice ? value.lsprice : value.unitPrice
|
|
value.discountAmount = !value.isChangePrice ? value.lsprice : value.unitPrice
|
|
value.returnPrice = !value.isChangeReturnPrice ? value.lsprice : value.unitPrice
|
|
} else if (that.priceType == 1) { //批发1
|
|
value.unitPrice = !value.isChangePrice ? value.wholesalePrice : value.unitPrice
|
|
value.discountAmount = !value.isChangePrice ? value.wholesalePrice : value.unitPrice
|
|
value.returnPrice = !value.isChangeReturnPrice ? value.wholesalePrice : value.unitPrice
|
|
}
|
|
if(that.discountType == ''){
|
|
|
|
}else{
|
|
if (that.discountType == 1) { //整体折扣
|
|
value.price = value.unitPrice * 10000 * Number(value.productCount) * that
|
|
.discountNum / 10 / 10000
|
|
}
|
|
}
|
|
}
|
|
|
|
})
|
|
// this.getAllPrice()
|
|
this.getAmountAndWho(isSaoMa);
|
|
this.noPay = this.shouldPay
|
|
this.$refs.shopPopup.close()
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 500)
|
|
})
|
|
},
|
|
//是否平台取货
|
|
checkBoxChange(e) {
|
|
this.radioType1 = e
|
|
},
|
|
//点击加号手动添加商品
|
|
goodsAdd() {
|
|
let arr = []
|
|
let that = this
|
|
this.carList.forEach(function(value, key) {
|
|
let data = {
|
|
attrId:value.attrId,
|
|
buyCount:value.buyCount,
|
|
categoryId:value.categoryId,
|
|
customerCategoryRule:[],
|
|
id:value.productId || value.id,
|
|
lsprice:value.lsprice,
|
|
num:value.productCount,
|
|
price:value.price,
|
|
productName:value.productName,
|
|
productPicture:value.productPicture,
|
|
productSn:value.productSn,
|
|
purchasePrice:value.purchasePrice,
|
|
returnPrice:value.returnPrice,
|
|
saleDetailQueryDTO:[],
|
|
saleDetailQueryDTO1:[],
|
|
supplierName:value.supplierName,
|
|
unitPrice:value.unitPrice,
|
|
wholesalePrice:value.wholesalePrice,
|
|
returnList:value.returnList,
|
|
returnCount:value.returnCount,
|
|
disNoAmount:value.disNoAmount,
|
|
discountAmount:value.discountAmount,
|
|
isChangePrice:value.isChangePrice,
|
|
isChangeReturnPrice:value.isChangeReturnPrice,
|
|
discount:value.discount,
|
|
returnlist1:[],
|
|
stockLogList1:[]
|
|
}
|
|
if(data.productPicture != null && data.productPicture != undefined){
|
|
if(data.productPicture.indexOf('?time') != -1){
|
|
data.productPicture = data.productPicture.slice(0,data.productPicture.indexOf('?time'))
|
|
}
|
|
}
|
|
|
|
value.stockLogList.forEach(function(value1, key1) {
|
|
let data1 = {
|
|
attributeList:key1,
|
|
name:value1.name,
|
|
price:"",
|
|
productCount:value1.productCount,
|
|
productNum:value1.productNum,
|
|
}
|
|
data.saleDetailQueryDTO.push(data1)
|
|
})
|
|
data.returnList.forEach(function(value1, key1) {
|
|
let hasAttr = false
|
|
for(let i = 0;i<data.saleDetailQueryDTO.length;i++){
|
|
if(key1 == data.saleDetailQueryDTO[i].attributeList){
|
|
hasAttr = true
|
|
}
|
|
}
|
|
if(hasAttr == false){
|
|
let data1 = {
|
|
attributeList:key1,
|
|
name:value1.name,
|
|
price:"",
|
|
productCount:value1.productCount,
|
|
productNum:value1.productNum,
|
|
}
|
|
data.saleDetailQueryDTO.push(data1)
|
|
}
|
|
})
|
|
data.returnList = encodeURIComponent(JSON.stringify(Array.from(data.returnList.entries())))
|
|
arr.push(data)
|
|
})
|
|
uni.navigateTo({
|
|
url: '/package1/billing/changeGoods1?khId='+this.khName.categoryId+ '&customerId='+this.khName.id+ '&customerName='+this.khName.name + '&arr=' + JSON.stringify(arr)
|
|
})
|
|
},
|
|
//关闭弹出层
|
|
close() {
|
|
this.$refs.popup.close()
|
|
},
|
|
onInput(e) {
|
|
this.textareaValue = e.detail.value;
|
|
// 调整滚动条位置到最底部
|
|
this.$nextTick(() => {
|
|
const textarea = this.$refs.textareaRef;
|
|
textarea.scrollTop = textarea.scrollHeight;
|
|
});
|
|
},
|
|
//按住语音识别,开始
|
|
kaishi() {
|
|
// manager.stop()
|
|
if (this.isVoice == false) {
|
|
this.recordState = true
|
|
uni.vibrateShort();
|
|
manager.start({
|
|
duration: 60000,
|
|
lang: "zh_CN"
|
|
});
|
|
}
|
|
|
|
},
|
|
//松开语音识别,结束
|
|
jieshu() {
|
|
// uni.showLoading({
|
|
// title: '识别中...',
|
|
// mask:true
|
|
// })
|
|
manager.stop((res) => {
|
|
// 检查录音文件大小,如果太小可能是无效录音
|
|
if (res.tempFilePath && res.duration > 1000) {
|
|
|
|
} else {
|
|
|
|
return
|
|
}
|
|
})
|
|
this.recordState = false
|
|
},
|
|
replaceCharAfterNumber(str, charToFind, charToReplace) {
|
|
// 正则表达式匹配字符前是否有数字,并且该字符与charToFind相同
|
|
const regex = new RegExp(`\\d${charToFind}`, 'g');
|
|
// 使用replace方法进行替换
|
|
return str.replace(regex, (match) => {
|
|
// 将匹配到的字符中的指定字符替换为charToReplace
|
|
return match.replace(charToFind, charToReplace);
|
|
});
|
|
},
|
|
removeSpacesAndCommas(str) {
|
|
// 正则表达式匹配所有空格和逗号
|
|
const regex = /[ ,,]/g; // 注意这里的空格和全角空格(全角逗号也包括在内)
|
|
|
|
// 使用replace()方法替换匹配到的空格和逗号为空字符串
|
|
return str.replace(regex, '');
|
|
},
|
|
//语音识别功能初始化
|
|
initRecord() {
|
|
let that = this;
|
|
// 识别结束事件
|
|
manager.onStop = (res) => {
|
|
//去掉嗯啊等
|
|
let convertedStr = this.spliceMsg(this.convertChineseToArabic(res.result));
|
|
//正则处理“2十9”这种情况
|
|
convertedStr = this.convertStringCorrectly(convertedStr)
|
|
//去掉所有空格和中英文逗号
|
|
convertedStr = this.removeSpacesAndCommas(convertedStr)
|
|
//去掉所有标点符号
|
|
convertedStr = this.removePunctuationAndSpaces(convertedStr)
|
|
if (convertedStr.indexOf('点') != -1) {
|
|
convertedStr = that.replaceCharAfterNumber(convertedStr, '点', '.')
|
|
}
|
|
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, '货号:')
|
|
}
|
|
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(',') == 0) {
|
|
convertedStr = convertedStr.substr(1)
|
|
}
|
|
convertedStr = convertedStr.replace(/[沟勾钩]/g, 'J');
|
|
if (that.voiceText == '' || that.voiceText == null) {
|
|
that.voiceText = convertedStr
|
|
that.voiceText1 = convertedStr
|
|
} else {
|
|
that.voiceText += '\n' + convertedStr
|
|
that.voiceText1 = convertedStr + '\n' + that.voiceText1
|
|
}
|
|
// uni.hideLoading()
|
|
}
|
|
|
|
// 识别错误事件
|
|
manager.onError = (res) => {
|
|
|
|
if (res.retcode == '-30011') {
|
|
that.isVoice = true
|
|
manager = null
|
|
manager = plugin.getRecordRecognitionManager()
|
|
}
|
|
if (res.retcode == '-30003') {
|
|
that.isVoice = false
|
|
}
|
|
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'
|
|
})
|
|
}
|
|
}
|
|
},
|
|
async showPrice1(type) {
|
|
let that = this;
|
|
this.sellObj = ""
|
|
if (this.khName == '') {
|
|
this.tui.toast('请选择客户!')
|
|
return false
|
|
}
|
|
if (this.khName.id == '' || this.khName.id == null || this.khName.id == undefined || this.khName.name == '' || this.khName.name == null || this.khName.name == undefined) {
|
|
this.tui.toast('请选择客户!')
|
|
return false
|
|
}
|
|
|
|
if (this.xsyId == '') {
|
|
this.tui.toast('请选择销售员!')
|
|
return false
|
|
}
|
|
if (this.carList.size == 0) {
|
|
this.tui.toast('请添加商品!')
|
|
return false
|
|
}
|
|
if (this.radioType != '') {
|
|
if (this.radioType == 0 || this.radioType == 1 || this.radioType == 4 || this.radioType == 5) {
|
|
if (this.wlName == '') {
|
|
this.tui.toast('请选择配送公司!')
|
|
return false
|
|
}
|
|
} else if (this.radioType == 3) {
|
|
if (this.pbAddress == '') {
|
|
this.tui.toast('请输入拼包地址!')
|
|
return false
|
|
}
|
|
}
|
|
} else {
|
|
this.tui.toast('请选择发货方式!')
|
|
return false
|
|
}
|
|
await this.getAllPriceAngin()
|
|
let obj = {
|
|
orderByWorker: this.lbgName.workerId || this.kdyName.workerId,
|
|
oldSaleId: this.saleId || '',
|
|
sale: {
|
|
// relPrice:,
|
|
status: type == 'hang' ? '7' : '',
|
|
alreadyEarn: this.priceOk, //已付金额
|
|
realAmount: this.relPrice, //实收金额
|
|
noEarn: this.relPrice - this.priceOk, //欠款
|
|
totalAmount: this.shouldPay, //总金额
|
|
debtDeductionAmount: this.qiankuandikou,
|
|
saleDeductionAmount: this.xiaoshoudikou,
|
|
balanceDeductionAmount: this.yuedikou,
|
|
area: this.khName.area,
|
|
city: this.khName.city,
|
|
province: this.khName.province,
|
|
payStatus: 1,
|
|
payType: this.payType,
|
|
receiveAddress: this.khName.address || this.khName.receiveAddress,
|
|
userId: this.khName.id,
|
|
userName: this.khName.name,
|
|
transportType: this.radioType1 == 1 ? 2 : this.radioType, //this.radioType
|
|
modeOfService: this.radioType1,
|
|
discount: this.discountNum,
|
|
createBy: this.xsyId,
|
|
createByName: this.createByName,
|
|
remark: this.remark,
|
|
otherExpense: this.otherExpense == '' ? 0 : this.otherExpense, //其他费用
|
|
shareAddress: this.pbAddress,
|
|
transCompany: this.wlName.shippingMethodId || this.wlName.id,
|
|
companyName: this.wlName.shippingMethod || this.wlName.companyName,
|
|
companyPhone: this.wlName.mobile
|
|
},
|
|
saleDetailList: [],
|
|
saleReturnDTO: {
|
|
returnSale: {},
|
|
returnSaleDetailList: []
|
|
}
|
|
}
|
|
var today = new Date();
|
|
var year = today.getFullYear();
|
|
var month = today.getMonth() + 1;
|
|
var day = today.getDate();
|
|
var formattedMonth = (month < 10 ? '0' : '') + month;
|
|
var formattedDay = (day < 10 ? '0' : '') + day;
|
|
|
|
let dayTime = year + '-' + formattedMonth + '-' + formattedDay
|
|
if(dayTime != this.single){
|
|
obj.sale.createTime = this.single + ' 00:00:00'
|
|
}
|
|
let purchaseDetails = [];
|
|
let returnList = [];
|
|
let ZreturnCount = 0
|
|
this.zeroArr = []
|
|
let arr = []
|
|
await this.carList.forEach(function(value, key) {
|
|
arr+=1
|
|
if (value.productSn == "" || value.productSn == null) {
|
|
that.tui.toast('第'+arr.length+'款商品货号不能为空')
|
|
throw Error('1')
|
|
}
|
|
if(value.discountAmount == 0){
|
|
that.zeroArr.push(value.productSn)
|
|
}
|
|
let returnGoods = []
|
|
let goodsList = []
|
|
value.purchasePrice = value.isNew ? '' : value.purchasePrice
|
|
value.stockLogList.forEach(function(values, keys) {
|
|
if (values.productCount == 0) {
|
|
that.tui.toast(value.productSn + '的规格值不能为0')
|
|
throw Error('1')
|
|
}
|
|
if (values.productCount < 0) {
|
|
let obj1 = {
|
|
productCount: Math.abs(values.productCount),
|
|
attributeList: keys
|
|
}
|
|
returnGoods.push(obj1)
|
|
} else {
|
|
let obj1 = {
|
|
productCount: Number(values.productCount),
|
|
attributeList: keys
|
|
}
|
|
goodsList.push(obj1)
|
|
}
|
|
|
|
})
|
|
if(value.returnList.size > 0){
|
|
value.returnList.forEach(function(res, reskey) {
|
|
if(res.productCount < 0){
|
|
let obj1 = {
|
|
productCount: Math.abs(res.productCount),
|
|
attributeList: reskey
|
|
}
|
|
returnGoods.push(obj1)
|
|
}else{
|
|
let obj1 = {
|
|
productCount: Number(res.productCount),
|
|
attributeList: reskey
|
|
}
|
|
goodsList.push(obj1)
|
|
}
|
|
|
|
})
|
|
}
|
|
|
|
that.$nextTick(() => {
|
|
if (returnGoods.length > 0) {
|
|
let data = {
|
|
attrId:value.attrId,
|
|
categoryId: value.categoryId || this.categoryList.categoryId,
|
|
disNoAmount: value.disNoAmount,
|
|
discount: value.discount,
|
|
discountAmount: value.returnPrice,
|
|
lsprice: value.lsprice ? value.lsprice : 0,
|
|
price: value.price,
|
|
productCount: Number(value.productCount),
|
|
productId: value.isNew ? '' : value.productId,
|
|
productName: value.productName,
|
|
productPicture: value.productPicture,
|
|
productSn: value.productSn,
|
|
purchasePrice: value.purchasePrice,
|
|
returnCount: value.returnCount,
|
|
returnPrice: value.returnPrice,
|
|
stockLogList: value.stockLogList,
|
|
stockLogList1: returnGoods,
|
|
supplierName: value.supplierName,
|
|
unitPrice: value.unitPrice,
|
|
wholesalePrice: value.wholesalePrice
|
|
}
|
|
ZreturnCount += value.returnPrice * value.returnCount
|
|
returnList.push(data)
|
|
}
|
|
if (goodsList.length > 0) {
|
|
let data = {
|
|
attrId:value.attrId,
|
|
categoryId: value.categoryId,
|
|
disNoAmount: value.disNoAmount,
|
|
discount: value.discount,
|
|
discountAmount: value.discountAmount,
|
|
price: value.lsprice ? value.lsprice : 0,
|
|
productCount: Number(value.productCount),
|
|
productId: value.isNew ? '' : value.productId,
|
|
productName: value.productName,
|
|
productPicture: value.productPicture,
|
|
productPictures: value.productPictures,
|
|
productSn: value.productSn,
|
|
purchasePrice: value.purchasePrice,
|
|
returnCount: value.returnCount,
|
|
returnPrice: value.returnPrice,
|
|
stockLogList: value.stockLogList,
|
|
stockLogList1: goodsList,
|
|
supplierName: value.supplierName,
|
|
unitPrice: value.unitPrice,
|
|
wholesalePrice: value.isNew ? value.discountAmount : value
|
|
.wholesalePrice
|
|
}
|
|
purchaseDetails.push(data)
|
|
}
|
|
})
|
|
})
|
|
await that.$nextTick(() => {
|
|
setTimeout(res => {
|
|
obj.saleDetailList = purchaseDetails;
|
|
if (returnList != '') {
|
|
obj.saleReturnDTO.returnSale = {
|
|
alreadyEarn: this.priceOk, //已付金额
|
|
realAmount: this.relPrice, //实收金额
|
|
noEarn: this.relPrice - this.priceOk, //欠款
|
|
totalAmount: (this.returnPay!='' && this.returnPay != ZreturnCount) ? this.returnPay : ZreturnCount, //总金额
|
|
debtDeductionAmount: this.qiankuandikou,
|
|
saleDeductionAmount: this.xiaoshoudikou,
|
|
balanceDeductionAmount: this.yuedikou,
|
|
area: this.khName.area,
|
|
city: this.khName.city,
|
|
province: this.khName.province,
|
|
payStatus: 1,
|
|
payType: this.payType,
|
|
receiveAddress: this.khName.address || this.khName.receiveAddress,
|
|
userId: this.khName.id,
|
|
userName: this.khName.name,
|
|
transportType: 2,
|
|
modeOfService: this.radioType1,
|
|
discount: this.discountNum,
|
|
createBy: this.xsyId,
|
|
createByName: this.createByName,
|
|
remark: this.remark,
|
|
otherExpense: this.otherExpense == '' ? 0 : this
|
|
.otherExpense, //其他费用
|
|
shareAddress: this.pbAddress,
|
|
transCompany: this.wlName.shippingMethodId || this.wlName.id,
|
|
companyName: this.wlName.shippingMethod || this.wlName.companyName,
|
|
companyPhone: this.wlName.mobile
|
|
}
|
|
obj.saleReturnDTO.returnSaleDetailList = returnList;
|
|
} else {
|
|
obj.saleReturnDTO = null
|
|
}
|
|
}, 500)
|
|
})
|
|
this.sellObj = obj
|
|
//零元开单弹窗点击了确认
|
|
if(type=='zeroNo'){
|
|
this.zeroArr = []
|
|
}
|
|
if (type != 'hang') {
|
|
if(this.zeroArr.length > 0){
|
|
this.$refs.zeroDialog.open()
|
|
}else{
|
|
this.$refs.zeroDialog.close()
|
|
this.$refs.showPopup.open()
|
|
}
|
|
}
|
|
},
|
|
async hangOrderFn() {
|
|
|
|
if(this.isKaiDan)return
|
|
this.isKaiDan = true
|
|
let that = this;
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
// this.getAllPrice()
|
|
await this.getAllPriceAngin()
|
|
let hang = await this.showPrice1("hang")
|
|
if(hang == false){
|
|
this.isKaiDan = false
|
|
return
|
|
}
|
|
await setTimeout(res=>{
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "挂单后可从首页挂单中查看,是否继续?",
|
|
success: function(res) {
|
|
|
|
if (res.confirm) {
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
that.sellObj.sale.saleId = that.sellObj.oldSaleId
|
|
that.tui.request('/app/sale/temporarySaveSale', "post", that.sellObj, false, false)
|
|
.then((res) => {
|
|
if (res.code == 200) {
|
|
that.isKaiDan = false
|
|
uni.showToast({
|
|
title: "挂单成功",
|
|
icon: 'none'
|
|
})
|
|
setTimeout(res1 => {
|
|
that.clearAll1()
|
|
// uni.switchTab({
|
|
// url: '/pages/index/index'
|
|
// });
|
|
}, 1000)
|
|
} else {
|
|
that.tui.toast(res.message)
|
|
}
|
|
})
|
|
}
|
|
setTimeout(res2 => {
|
|
uni.hideLoading();
|
|
}, 500)
|
|
setTimeout(res1=>{
|
|
that.isKaiDan = false
|
|
},3000)
|
|
}
|
|
})
|
|
},600)
|
|
},
|
|
//点击底部开单按钮
|
|
async goSell() {
|
|
if(this.isKaiDan)return
|
|
this.isKaiDan = true
|
|
let that = this;
|
|
this.$refs.showPopup.close()
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
|
|
if(this.khName == ''){
|
|
setTimeout(res=>{
|
|
that.tui.toast('请选择客户后再开单')
|
|
},1000)
|
|
return
|
|
}
|
|
if (this.khName.id == '' || this.khName.id == null || this.khName.id == undefined || this.khName.name == '' || this.khName.name == null || this.khName.name == undefined) {
|
|
this.tui.toast('请选择客户!')
|
|
}else{
|
|
let url = ''
|
|
if (this.saleId != '') {
|
|
url = '/app/sale/shareToBuyNew'
|
|
} else {
|
|
url = '/app/sale/buyNew'
|
|
}
|
|
setTimeout(res1=>{
|
|
this.tui.request(url, "post", this.sellObj, false, false).then((res) => {
|
|
if (res.code == 200) {
|
|
uni.showToast({
|
|
title: "开单成功",
|
|
icon: 'none'
|
|
})
|
|
this.$refs.showPopup.close()
|
|
that.clearAll1()
|
|
uni.redirectTo({
|
|
url: '/package3/index/orderDetailTable'
|
|
})
|
|
that.isKaiDan = false
|
|
that.saomaotype = ''
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
})
|
|
},500)
|
|
}
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
that.isKaiDan = false
|
|
}, 1000)
|
|
},
|
|
//编辑每一个的单价
|
|
clickPrice(index,name) {
|
|
this.carList.get(index).stockLogList.get(name).isShowBtn = false
|
|
this.index = index
|
|
this.wholesalePrice = this.carList.get(this.index).wholesalePrice
|
|
this.lsprice = this.carList.get(this.index).lsprice
|
|
this.$refs.inputDialog.open()
|
|
},
|
|
//输入商品自定义退货金额
|
|
changeReturnPay(e) {
|
|
this.returnPrice = e.detail.value
|
|
},
|
|
//输入商品自定义金额
|
|
changePay(e) {
|
|
this.customPrice = e.detail.value
|
|
},
|
|
//更改单品折扣
|
|
changeDis(e, id) {
|
|
this.changePriceStatus()
|
|
let that = this;
|
|
let carlist = this.carList.get(id)
|
|
if (this.linshiPrice == e.target.value) {
|
|
carlist.discount = e.target.value
|
|
} else {
|
|
if (e.detail.value > 10) {
|
|
carlist.discount = 10;
|
|
} else if (e.detail.value < 0) {
|
|
carlist.discount = 0;
|
|
} else if (e.detail.value == '') {
|
|
carlist.discount = this.linshiPrice
|
|
} else {
|
|
carlist.discount = e.detail.value;
|
|
}
|
|
}
|
|
|
|
carlist.discountAmount = carlist.unitPrice * carlist.discount / 10
|
|
carlist.discountAmount = Number(carlist.discountAmount.toFixed(2))
|
|
carlist.price = carlist.unitPrice * (carlist.discount / 10) * Number(carlist.productCount)
|
|
carlist.price = Number(carlist.price.toFixed(2))
|
|
this.getAllPrice()
|
|
},
|
|
//选商品的时候能删除规格
|
|
delCarData(index) {
|
|
this.temporaryList.splice(index, 1);
|
|
this.temporaryChange()
|
|
},
|
|
//选商品的时候能删除规格
|
|
delReturnCarData(index) {
|
|
this.temporaryReturnList.splice(index, 1);
|
|
this.temporaryReturnChange()
|
|
},
|
|
//删除整条商品
|
|
delShop(id) {
|
|
var that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定删除此条商品吗?",
|
|
success: function(res) {
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
if (res.confirm) {
|
|
if (that.carList.has(id) == true) {
|
|
that.carList.delete(id)
|
|
}
|
|
that.$forceUpdate()
|
|
// that.getAllPrice()
|
|
that.getAmountAndWho()
|
|
}
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 500)
|
|
}
|
|
})
|
|
|
|
},
|
|
//删除商品下的某一个规格
|
|
delShopSpec(id, name) {
|
|
var that = this;
|
|
this.carList.get(id).stockLogList.get(name).isShowBtn = false
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定删除此条规格吗?",
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
if (that.carList.get(id).stockLogList.get(name).productCount > 0) {
|
|
that.carList.get(id).productCount -= Number(that.carList.get(id).stockLogList.get(
|
|
name).productCount);
|
|
} else {
|
|
that.carList.get(id).returnCount -= Math.abs(that.carList.get(id).stockLogList
|
|
.get(name).productCount);
|
|
}
|
|
that.carList.get(id).stockLogList.delete(name);
|
|
that.carList.get(id).price = Number(that.carList.get(id).productCount) * that.carList.get(
|
|
id).unitPrice
|
|
|
|
if (that.carList.get(id).stockLogList.size == 0 && that.carList.get(id).returnList.size == 0) {
|
|
that.carList.delete(id)
|
|
}
|
|
// that.getAllPrice()
|
|
that.getAmountAndWho()
|
|
}
|
|
that.$forceUpdate()
|
|
}
|
|
})
|
|
|
|
},
|
|
//删除商品下的某一个规格
|
|
delShopReturnSpec(id, name) {
|
|
var that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定删除此条规格吗?",
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
|
|
that.carList.get(id).returnCount -= Math.abs(that.carList.get(id).returnList
|
|
.get(name).productCount);
|
|
that.carList.get(id).returnList.delete(name);
|
|
that.carList.get(id).returtnPay = Number(that.carList.get(id).productCount) * that.carList.get(
|
|
id).returnPrice
|
|
if (that.carList.get(id).stockLogList.size == 0 && that.carList.get(id).returnList.size == 0) {
|
|
that.carList.delete(id)
|
|
}
|
|
that.getAmountAndWho()
|
|
}
|
|
that.$forceUpdate()
|
|
}
|
|
})
|
|
|
|
},
|
|
getCountMethod() {
|
|
let that = this;
|
|
if (that.tanyue && that.tanxiaoshou) {
|
|
if (that.zhiqianqiankuan > 0) {
|
|
if (parseFloat(that.returnPay) == 0) {
|
|
this.methodText = '实收金额(' + that.relPrice + ')=' + that.shouldPay
|
|
} else {
|
|
if (parseFloat(that.returnPay) >= parseFloat(that.zhiqianqiankuan)) {
|
|
this.methodText = '实收金额(' + that.relPrice + ')=' + that.shouldPay + '-' + that.returnPay +
|
|
'+' + that.zhiqianqiankuan
|
|
} else if (parseFloat(that.returnPay) < parseFloat(that.zhiqianqiankuan)) {
|
|
this.methodText = '实收金额(' + that.relPrice + ')=' + that.shouldPay
|
|
}
|
|
}
|
|
} else if (parseFloat(that.zhiqianqiankuan) < 0) {
|
|
if (that.shouldPay > Math.abs(that.zhiqianqiankuan)) {
|
|
this.methodText = '实收金额(' + that.relPrice + ')=' + that.shouldPay + '+' + Math.abs(that
|
|
.zhiqianqiankuan)
|
|
} else if (that.shouldPay <= Math.abs(that.zhiqianqiankuan)) {
|
|
this.methodText = '实收金额=0'
|
|
}
|
|
if (that.returnPay != 0) {
|
|
this.methodText = '客户有余额,余额抵扣了销售,实收金额(' + that.relPrice + ')=' + this.relPrice
|
|
}
|
|
} else if (parseFloat(that.zhiqianqiankuan) == 0) {
|
|
if (parseFloat(that.returnPay) > 0) {
|
|
this.methodText = '实收金额(' + that.relPrice + ')=' + that.shouldPay + '-' + that.returnPay
|
|
if (parseFloat(that.returnPay) >= parseFloat(that.zhiqianqiankuan)) {
|
|
this.methodText = '实收金额(' + that.relPrice + ')=' + that.shouldPay + '-' + that.returnPay +
|
|
'+' + that.zhiqianqiankuan
|
|
} else if (parseFloat(that.returnPay) < parseFloat(that.zhiqianqiankuan)) {
|
|
this.methodText = '实收金额(' + that.relPrice + ')=' + this.shouldPay
|
|
}
|
|
} else if (parseFloat(that.returnPay) == 0) {
|
|
this.methodText = '实收金额(' + that.relPrice + ')=' + this.shouldPay
|
|
}
|
|
}
|
|
}
|
|
this.$forceUpdate()
|
|
this.methodMask = !this.methodMask
|
|
setTimeout(res => {
|
|
this.methodMask = !this.methodMask
|
|
}, 2000)
|
|
},
|
|
//计算总金额和总数量
|
|
async getAllPrice(price, type) {
|
|
let that = this
|
|
let productIds = ''
|
|
this.carList.forEach(function(value, key) {
|
|
productIds += key + ','
|
|
})
|
|
await this.reloadPrices()
|
|
this.$nextTick(() => {
|
|
if(this.oldCustomId != this.khName.id && this.khName.name != '散客'){
|
|
this.tui.request("/app/sale/buyCount", "POST", {
|
|
customerId: this.khName.id,
|
|
productIds: productIds
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if(res.result.length == 0){
|
|
this.carList.forEach(function(value, key) {
|
|
value.buyCount = ''
|
|
})
|
|
}else{
|
|
this.carList.forEach(function(value, key) {
|
|
let hasProduct = false
|
|
for(let i = 0; i < res.result.length;i++){
|
|
if(key == res.result[i].productId){
|
|
that.carList.get(res.result[i].productId).buyCount = res.result[i].buyCount
|
|
hasProduct = true
|
|
}
|
|
}
|
|
if(hasProduct == false){
|
|
value.buyCount = ''
|
|
}
|
|
})
|
|
}
|
|
this.$forceUpdate()
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
}
|
|
if((this.shopId == '1838094297858183168' || this.shopId == '1811579958284390400' || this.shopId == '1818888277105709056') && this.khName.name != '散客' && productIds != ''){
|
|
|
|
this.tui.request("/app/product/getByUserIdAndProductIds", "POST", {
|
|
userId: this.khName.id,
|
|
productIds: productIds
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
if(res1.result != null && res1.result.length > 0){
|
|
for(let i = 0; i < res1.result.length;i++){
|
|
if(!this.carList.get(res1.result[i].productId).isChangePrice){
|
|
this.carList.get(res1.result[i].productId).discountAmount = res1.result[i].discountAmount
|
|
this.carList.get(res1.result[i].productId).price = Number(Number(res1.result[i].discountAmount * this.carList.get(res1.result[i].productId).productCount).toFixed(2))
|
|
}
|
|
if(!this.carList.get(res1.result[i].productId).isChangeReturnPrice){
|
|
this.carList.get(res1.result[i].productId).returnPrice = res1.result[i].discountAmount
|
|
}
|
|
}
|
|
this.$nextTick(() => {
|
|
this.reloadPrices()
|
|
if (type == 'tanyue') {
|
|
this.tanyue = !this.tanyue
|
|
} else if (type == 'tanxiaoshou') {
|
|
this.tanxiaoshou = !this.tanxiaoshou
|
|
}
|
|
|
|
that.qiankuandikou = 0
|
|
that.xiaoshoudikou = 0
|
|
that.leijiqiankuan = 0
|
|
that.yuedikou = 0
|
|
|
|
/**
|
|
* that.shouldPay 销售金额
|
|
* that.returnPay 退货金额
|
|
* that.zhiqianqiankuan 之前欠款
|
|
* that.qiankuandikou 欠款抵扣
|
|
* that.xiaoshoudikou 销售抵扣
|
|
* that.yuedikou 余额抵扣
|
|
* that.leijiqiankuan 累计欠款
|
|
* that.relPrice 实收金额
|
|
* that.priceOk 已收金额
|
|
*/
|
|
this.$nextTick(() => {
|
|
if (that.tanyue && that.tanxiaoshou) {
|
|
if (that.zhiqianqiankuan > 0) {
|
|
if (parseFloat(that.returnPay) == 0) {
|
|
that.relPrice = that.shouldPay
|
|
that.qiankuandikou = 0
|
|
that.xiaoshoudikou = 0
|
|
} else {
|
|
if (parseFloat(that.returnPay) >= parseFloat(that.zhiqianqiankuan)) {
|
|
that.qiankuandikou = that.zhiqianqiankuan
|
|
if (parseFloat(that.shouldPay) > parseFloat(that.returnPay) - that
|
|
.zhiqianqiankuan) {
|
|
that.xiaoshoudikou = that.returnPay - that.zhiqianqiankuan
|
|
} else if (that.shouldPay <= that.returnPay - that.zhiqianqiankuan) {
|
|
that.xiaoshoudikou = that.shouldPay
|
|
}
|
|
that.relPrice = Number((that.shouldPay - (that.returnPay - that.zhiqianqiankuan)).toFixed(2))
|
|
} else if (parseFloat(that.returnPay) < parseFloat(that.zhiqianqiankuan)) {
|
|
that.qiankuandikou = that.returnPay
|
|
that.relPrice = that.shouldPay
|
|
that.xiaoshoudikou = 0
|
|
|
|
}
|
|
}
|
|
} else if (parseFloat(that.zhiqianqiankuan) < 0) {
|
|
if (that.shouldPay > Math.abs(that.zhiqianqiankuan)) {
|
|
that.yuedikou = Math.abs(that.zhiqianqiankuan)
|
|
this.relPrice = Number((this.shouldPay - Math.abs(that.zhiqianqiankuan)).toFixed(2))
|
|
} else if (that.shouldPay <= Math.abs(that.zhiqianqiankuan)) {
|
|
that.yuedikou = that.shouldPay
|
|
this.relPrice = 0
|
|
}
|
|
if (that.returnPay != 0) {
|
|
this.relPrice = Number((this.relPrice - that.returnPay).toFixed(2))
|
|
}
|
|
} else if (parseFloat(that.zhiqianqiankuan) == 0) {
|
|
if (parseFloat(that.returnPay) > 0) {
|
|
this.relPrice = Number((that.shouldPay - that.returnPay).toFixed(2))
|
|
if (parseFloat(that.returnPay) >= parseFloat(that.zhiqianqiankuan)) {
|
|
that.qiankuandikou = that.zhiqianqiankuan
|
|
if (parseFloat(that.shouldPay) > parseFloat(that.returnPay) - that
|
|
.zhiqianqiankuan) {
|
|
that.xiaoshoudikou = that.returnPay - that.zhiqianqiankuan
|
|
} else if (that.shouldPay <= that.returnPay - that.zhiqianqiankuan) {
|
|
that.xiaoshoudikou = that.shouldPay
|
|
}
|
|
this.relPrice = Number((that.shouldPay - (that.returnPay - that.zhiqianqiankuan)).toFixed(2))
|
|
} else if (parseFloat(that.returnPay) < parseFloat(that.zhiqianqiankuan)) {
|
|
that.qiankuandikou = that.returnPay
|
|
this.relPrice = this.shouldPay
|
|
that.xiaoshoudikou = 0
|
|
|
|
}
|
|
} else if (parseFloat(that.returnPay) == 0) {
|
|
this.relPrice = that.shouldPay
|
|
that.qiankuandikou = 0
|
|
that.xiaoshoudikou = 0
|
|
}
|
|
}
|
|
}
|
|
|
|
this.priceOk = this.checkRealPay(this.relPrice)
|
|
that.noPay = this.relPrice - (this.priceOk == '' ? 0 : this.priceOk)
|
|
that.noPay = Number(that.noPay.toFixed(2))
|
|
this.leijiqiankuan = Number((Number(this.zhiqianqiankuan) - Number(this.qiankuandikou) + Number(this
|
|
.yuedikou) + Number(this.noPay)).toFixed(2))
|
|
this.$forceUpdate()
|
|
})
|
|
})
|
|
this.$forceUpdate()
|
|
}
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
}
|
|
this.$nextTick(() => {
|
|
if (type == 'tanyue') {
|
|
this.tanyue = !this.tanyue
|
|
} else if (type == 'tanxiaoshou') {
|
|
this.tanxiaoshou = !this.tanxiaoshou
|
|
}
|
|
|
|
that.qiankuandikou = 0
|
|
that.xiaoshoudikou = 0
|
|
that.leijiqiankuan = 0
|
|
that.yuedikou = 0
|
|
|
|
this.$nextTick(() => {
|
|
if (that.tanyue && that.tanxiaoshou) {
|
|
if (that.zhiqianqiankuan > 0) {
|
|
if (parseFloat(that.returnPay) == 0) {
|
|
that.relPrice = that.shouldPay
|
|
that.qiankuandikou = 0
|
|
that.xiaoshoudikou = 0
|
|
} else {
|
|
if (parseFloat(that.returnPay) >= parseFloat(that.zhiqianqiankuan)) {
|
|
that.qiankuandikou = that.zhiqianqiankuan
|
|
if (parseFloat(that.shouldPay) > parseFloat(that.returnPay) - that
|
|
.zhiqianqiankuan) {
|
|
that.xiaoshoudikou = that.returnPay - that.zhiqianqiankuan
|
|
} else if (that.shouldPay <= that.returnPay - that.zhiqianqiankuan) {
|
|
that.xiaoshoudikou = that.shouldPay
|
|
}
|
|
that.relPrice = Number((that.shouldPay - (that.returnPay - that.zhiqianqiankuan)).toFixed(2))
|
|
} else if (parseFloat(that.returnPay) < parseFloat(that.zhiqianqiankuan)) {
|
|
that.qiankuandikou = that.returnPay
|
|
that.relPrice = that.shouldPay
|
|
that.xiaoshoudikou = 0
|
|
|
|
}
|
|
}
|
|
} else if (parseFloat(that.zhiqianqiankuan) < 0) {
|
|
if (that.shouldPay > Math.abs(that.zhiqianqiankuan)) {
|
|
that.yuedikou = Math.abs(that.zhiqianqiankuan)
|
|
this.relPrice = Number((this.shouldPay - Math.abs(that.zhiqianqiankuan)).toFixed(2))
|
|
} else if (that.shouldPay <= Math.abs(that.zhiqianqiankuan)) {
|
|
that.yuedikou = that.shouldPay
|
|
this.relPrice = 0
|
|
}
|
|
if (that.returnPay != 0) {
|
|
this.relPrice = Number((this.relPrice - that.returnPay).toFixed(2))
|
|
}
|
|
} else if (parseFloat(that.zhiqianqiankuan) == 0) {
|
|
if (parseFloat(that.returnPay) > 0) {
|
|
this.relPrice = Number((that.shouldPay - that.returnPay).toFixed(2))
|
|
if (parseFloat(that.returnPay) >= parseFloat(that.zhiqianqiankuan)) {
|
|
that.qiankuandikou = that.zhiqianqiankuan
|
|
if (parseFloat(that.shouldPay) > parseFloat(that.returnPay) - that
|
|
.zhiqianqiankuan) {
|
|
that.xiaoshoudikou = that.returnPay - that.zhiqianqiankuan
|
|
} else if (that.shouldPay <= that.returnPay - that.zhiqianqiankuan) {
|
|
that.xiaoshoudikou = that.shouldPay
|
|
}
|
|
this.relPrice = Number((that.shouldPay - (that.returnPay - that.zhiqianqiankuan)).toFixed(2))
|
|
} else if (parseFloat(that.returnPay) < parseFloat(that.zhiqianqiankuan)) {
|
|
that.qiankuandikou = that.returnPay
|
|
this.relPrice = this.shouldPay
|
|
that.xiaoshoudikou = 0
|
|
|
|
}
|
|
} else if (parseFloat(that.returnPay) == 0) {
|
|
this.relPrice = that.shouldPay
|
|
that.qiankuandikou = 0
|
|
that.xiaoshoudikou = 0
|
|
}
|
|
}
|
|
}
|
|
|
|
this.priceOk = this.checkRealPay(this.relPrice)
|
|
that.noPay = this.relPrice - (this.priceOk == '' ? 0 : this.priceOk)
|
|
that.noPay = Number(that.noPay.toFixed(2))
|
|
this.leijiqiankuan = Number((Number(this.zhiqianqiankuan) - Number(this.qiankuandikou) + Number(this
|
|
.yuedikou) + Number(this.noPay)).toFixed(2))
|
|
this.$forceUpdate()
|
|
})
|
|
})
|
|
})
|
|
},
|
|
async getAllPriceAngin() {
|
|
let that = this
|
|
await that.reloadPrices()
|
|
this.$nextTick(() => {
|
|
setTimeout(res => {
|
|
that.qiankuandikou = 0
|
|
that.xiaoshoudikou = 0
|
|
that.leijiqiankuan = 0
|
|
that.yuedikou = 0
|
|
this.$nextTick(() => {
|
|
if (that.tanyue && that.tanxiaoshou) {
|
|
if (that.zhiqianqiankuan > 0) {
|
|
if (parseFloat(that.returnPay) == 0) {
|
|
if(that.isChangeRelPrice == false){
|
|
that.relPrice = that.shouldPay
|
|
}
|
|
that.qiankuandikou = 0
|
|
that.xiaoshoudikou = 0
|
|
} else {
|
|
if (parseFloat(that.returnPay) >= parseFloat(that.zhiqianqiankuan)) {
|
|
that.qiankuandikou = that.zhiqianqiankuan
|
|
if (parseFloat(that.shouldPay) > parseFloat(that.returnPay) - that
|
|
.zhiqianqiankuan) {
|
|
that.xiaoshoudikou = that.returnPay - that.zhiqianqiankuan
|
|
} else if (that.shouldPay <= that.returnPay - that.zhiqianqiankuan) {
|
|
that.xiaoshoudikou = that.shouldPay
|
|
}
|
|
if(that.isChangeRelPrice == false){
|
|
that.relPrice = Number((that.shouldPay - (that.returnPay - that.zhiqianqiankuan)).toFixed(2))
|
|
}
|
|
} else if (parseFloat(that.returnPay) < parseFloat(that.zhiqianqiankuan)) {
|
|
that.qiankuandikou = that.returnPay
|
|
if(that.isChangeRelPrice == false){
|
|
that.relPrice = that.shouldPay
|
|
}
|
|
that.xiaoshoudikou = 0
|
|
|
|
}
|
|
}
|
|
} else if (parseFloat(that.zhiqianqiankuan) < 0) {
|
|
if (that.shouldPay > Math.abs(that.zhiqianqiankuan)) {
|
|
that.yuedikou = Math.abs(that.zhiqianqiankuan)
|
|
if(that.isChangeRelPrice == false){
|
|
this.relPrice = Number((this.shouldPay - Math.abs(that.zhiqianqiankuan)).toFixed(2))
|
|
}
|
|
} else if (that.shouldPay <= Math.abs(that.zhiqianqiankuan)) {
|
|
that.yuedikou = that.shouldPay
|
|
if(that.isChangeRelPrice == false){
|
|
this.relPrice = 0
|
|
}
|
|
}
|
|
if (that.returnPay != 0) {
|
|
if(that.isChangeRelPrice == false){
|
|
this.relPrice = Number((this.relPrice - that.returnPay).toFixed(2))
|
|
}
|
|
}
|
|
} else if (parseFloat(that.zhiqianqiankuan) == 0) {
|
|
if (parseFloat(that.returnPay) > 0) {
|
|
if(that.isChangeRelPrice == false){
|
|
this.relPrice = Number((that.shouldPay - that.returnPay).toFixed(2))
|
|
}
|
|
if (parseFloat(that.returnPay) >= parseFloat(that.zhiqianqiankuan)) {
|
|
that.qiankuandikou = that.zhiqianqiankuan
|
|
if (parseFloat(that.shouldPay) > parseFloat(that.returnPay) - that
|
|
.zhiqianqiankuan) {
|
|
that.xiaoshoudikou = that.returnPay - that.zhiqianqiankuan
|
|
} else if (that.shouldPay <= that.returnPay - that.zhiqianqiankuan) {
|
|
that.xiaoshoudikou = that.shouldPay
|
|
}
|
|
if(that.isChangeRelPrice == false){
|
|
this.relPrice = Number((that.shouldPay - (that.returnPay - that.zhiqianqiankuan)).toFixed(2))
|
|
}
|
|
} else if (parseFloat(that.returnPay) < parseFloat(that.zhiqianqiankuan)) {
|
|
that.qiankuandikou = that.returnPay
|
|
if(that.isChangeRelPrice == false){
|
|
this.relPrice = this.shouldPay
|
|
}
|
|
that.xiaoshoudikou = 0
|
|
|
|
}
|
|
} else if (parseFloat(that.returnPay) == 0) {
|
|
if(that.isChangeRelPrice == false){
|
|
this.relPrice = that.shouldPay
|
|
}
|
|
that.qiankuandikou = 0
|
|
that.xiaoshoudikou = 0
|
|
}
|
|
}
|
|
}
|
|
that.priceOk = this.checkRealPay(this.relPrice)
|
|
that.noPay = this.relPrice - (this.priceOk == '' ? 0 : this.priceOk)
|
|
that.noPay = Number(that.noPay.toFixed(2))
|
|
this.leijiqiankuan = Number((Number(this.zhiqianqiankuan) - Number(this.qiankuandikou) + Number(this
|
|
.yuedikou) + Number(this.noPay)).toFixed(2))
|
|
this.$forceUpdate()
|
|
})
|
|
}, 200)
|
|
})
|
|
},
|
|
noReturn() {
|
|
this.priceOk = 0
|
|
this.noPay = this.relPrice - (this.priceOk == '' ? 0 : this.priceOk)
|
|
this.noPay = Number(this.noPay.toFixed(2))
|
|
this.leijiqiankuan = Number((Number(this.zhiqianqiankuan) - Number(this.qiankuandikou) + Number(this
|
|
.yuedikou) + Number(this.noPay)).toFixed(2))
|
|
},
|
|
getkhName(name) {
|
|
if(name =='散客'){
|
|
this.tui.request("/app/customer/list", "post", {
|
|
notBuyDays: "",
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
searchStr: "散客",
|
|
sort: "",
|
|
}, false, false).then((res) => {
|
|
if (res.code == 200) {
|
|
this.khData = res.result.records[0]
|
|
this.khName = {
|
|
id: res.result.records[0].id,
|
|
name: res.result.records[0].name,
|
|
noEarn: res.result.records[0].noEarn,
|
|
categoryId: res.result.records[0].categoryId
|
|
}
|
|
this.zhiqianqiankuan = res.result.records[0].noEarn
|
|
} else {
|
|
this.khName = {}
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {
|
|
this.khName = {}
|
|
})
|
|
}else{
|
|
this.tui.request("/app/debt/selectByUserId", "post", {
|
|
shopId:uni.getStorageSync('shopId'),
|
|
userId:name
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
this.khData = res.result
|
|
this.khName = {
|
|
id: res.result.userId,
|
|
name: this.khName.name,
|
|
noEarn: res.result.amountOwed,
|
|
categoryId: res.result.categoryId
|
|
}
|
|
this.zhiqianqiankuan = res.result.amountOwed
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
},
|
|
clearAll1() {
|
|
let that = this;
|
|
that.carList.clear()
|
|
that.remark = ''
|
|
that.index = ''
|
|
that.priceCurrent = ''
|
|
that.priceType = ""
|
|
that.lunbocurrent = 4
|
|
that.radioType = '2'
|
|
that.discountType = ''
|
|
that.pbAddress = ''
|
|
that.leijiqiankuan = 0
|
|
that.qiankuandikou = 0
|
|
that.returnPay = 0
|
|
that.yuedikou = 0
|
|
that.xiaoshoudikou = 0
|
|
that.discountCurrent = '3'
|
|
that.temporaryList = []
|
|
that.purchasePrice = 0
|
|
that.zPrice = 0
|
|
that.zNum = 0
|
|
that.shouldPay = 0
|
|
this.getkhName('散客')
|
|
this.getMonth()
|
|
that.zhiqianqiankuan = that.khData.noEarn
|
|
that.gysName = []
|
|
that.wlName = []
|
|
that.kdyName = []
|
|
that.lbgName = []
|
|
that.relPrice = 0
|
|
that.priceOk = 0
|
|
that.noPay = 0
|
|
that.otherExpense = 0
|
|
that.totalAmount = 0
|
|
that.returnTotalAmount = 0
|
|
that.saleId = ''
|
|
that.$forceUpdate()
|
|
},
|
|
//清空全部数据
|
|
clearAll() {
|
|
// let pages = getCurrentPages()
|
|
// let curPages = pages[pages.length - 1]
|
|
// curPages.onLoad()
|
|
// curPages.onShow()
|
|
|
|
|
|
let that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定清空全部数据吗?",
|
|
success: function(res) {
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
if (res.confirm) {
|
|
that.carList.clear()
|
|
that.remark = ''
|
|
that.index = ''
|
|
that.pbAddress = ''
|
|
that.priceType = ''
|
|
that.radioType = '2'
|
|
that.lunbocurrent = 4
|
|
that.discountType = ''
|
|
that.discountCurrent = "3"
|
|
that.temporaryList = []
|
|
that.returnPay = 0
|
|
that.qiankuandikou = 0
|
|
that.yuedikou = 0
|
|
that.xiaoshoudikou = 0
|
|
that.leijiqiankuan = 0
|
|
that.purchasePrice = 0
|
|
that.zPrice = 0
|
|
that.zNum = 0
|
|
that.shouldPay = 0
|
|
that.getkhName('散客')
|
|
that.getMonth()
|
|
that.zhiqianqiankuan = that.khData.noEarn
|
|
that.gysName = []
|
|
that.wlName = []
|
|
that.kdyName = []
|
|
that.lbgName = []
|
|
that.relPrice = 0
|
|
that.priceOk = 0
|
|
that.noPay = 0
|
|
that.otherExpense = 0
|
|
that.totalAmount = 0
|
|
that.returnTotalAmount = 0
|
|
that.saleId = ''
|
|
that.priceCurrent = null
|
|
that.$forceUpdate()
|
|
|
|
}
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 500)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page,
|
|
.page1 {
|
|
overflow-y: scroll;
|
|
font-size: 21px;
|
|
}
|
|
|
|
.popup-pay-content {
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 30rpx;
|
|
width: 500rpx;
|
|
height: auto;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.content {
|
|
border-top: 1px solid #eee;
|
|
|
|
}
|
|
|
|
.content-box {
|
|
width: 100%;
|
|
height: auto;
|
|
background: #fff;
|
|
margin-bottom: 20rpx;
|
|
|
|
}
|
|
|
|
.popup-pay-title {
|
|
font-size: 21px;
|
|
font-weight: bold;
|
|
text-align: center;
|
|
position: relative;
|
|
}
|
|
|
|
.popup-pay-container {
|
|
margin-top: 20rpx;
|
|
height: 80rpx;
|
|
border-radius: 10px;
|
|
background: #088FEB;
|
|
line-height: 80rpx;
|
|
text-align: center;
|
|
border-bottom: 1px solid #eee;
|
|
border-top: 1px solid #eee;
|
|
color: #fff;
|
|
}
|
|
|
|
.content-list {
|
|
height: 40px;
|
|
border-radius: 10px;
|
|
border: 1px solid #eee;
|
|
padding: 0 5px;
|
|
display: inline-block;
|
|
margin-left: 10px;
|
|
}
|
|
|
|
.list-name {
|
|
line-height: 40px;
|
|
height: 40px;
|
|
display: inline-block;
|
|
float: left;
|
|
}
|
|
|
|
.list-val {
|
|
width: 120px;
|
|
height: 40px;
|
|
line-height: 40px;
|
|
display: inline-block;
|
|
}
|
|
|
|
.list-val input {
|
|
height: 40px;
|
|
padding-left: 10px;
|
|
}
|
|
|
|
.uni-data-select {
|
|
width: 80%;
|
|
text-align: center;
|
|
}
|
|
|
|
.uni-select {
|
|
border: none !important;
|
|
border-radius: 0 !important;
|
|
height: 40px !important;
|
|
padding-left: 0 !important;
|
|
}
|
|
|
|
.uni-select__input-placeholder {
|
|
color: #6a6a6a;
|
|
font-size: 21px !important;
|
|
width: 400rpx;
|
|
}
|
|
|
|
.uni-select__input-text {
|
|
font-size: 21px !important;
|
|
}
|
|
|
|
.uni-icons {
|
|
font-size: 31px !important;
|
|
}
|
|
|
|
.uni-date__x-input {
|
|
width: 140px !important;
|
|
height: 40px !important;
|
|
line-height: 40px !important;
|
|
font-size: 21px !important;
|
|
}
|
|
|
|
.uni-date-editor--x {
|
|
display: flex;
|
|
align-items: center;
|
|
position: relative;
|
|
height: 33px;
|
|
line-height: 33px;
|
|
border: 1px solid #eee;
|
|
}
|
|
|
|
.shop-box {
|
|
width: 95%;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.shop-name {
|
|
width: 100%;
|
|
height: 250rpx;
|
|
line-height: 80rpx;
|
|
border-top: 1px solid #eee;
|
|
border-bottom: 1px solid #eee;
|
|
font-size: 21px;
|
|
font-weight: bold;
|
|
display: flex;
|
|
}
|
|
|
|
.discount-num {
|
|
width: 60rpx;
|
|
}
|
|
|
|
.shop-productName {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding-left: 20rpx;
|
|
}
|
|
|
|
.shop-productName view {
|
|
height: 55rpx;
|
|
}
|
|
|
|
.checklist-group {
|
|
height: 80rpx !important;
|
|
}
|
|
|
|
.shop-collapse {
|
|
display: flex;
|
|
height: 80rpx;
|
|
font-size: 21px;
|
|
line-height: 80rpx;
|
|
}
|
|
|
|
.shop-collapse text {
|
|
width: 60%;
|
|
text-align: center;
|
|
border-right: 1px solid #eee;
|
|
}
|
|
|
|
.shop-collapse-item {
|
|
display: flex;
|
|
text-align: center;
|
|
background: #eee;
|
|
height: 80px;
|
|
|
|
.input {
|
|
border: 1px solid #eee;
|
|
background: #777;
|
|
color: #fff;
|
|
height: 40px;
|
|
line-height: 40px;
|
|
}
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
.uni-list-cell {
|
|
margin-right: 110rpx;
|
|
display: flex;
|
|
float: left;
|
|
}
|
|
|
|
.bottom-box {
|
|
width: 100%;
|
|
display: flex;
|
|
background: #fff;
|
|
border-top: 1px solid #eee;
|
|
// height: 10%;
|
|
position: fixed;
|
|
bottom: 0;
|
|
}
|
|
|
|
.bottom-left {
|
|
flex: 1;
|
|
height: 110rpx;
|
|
font-size: 21px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.notice {
|
|
width: 100%;
|
|
height: 56rpx;
|
|
}
|
|
|
|
.bottom-right {
|
|
width: 55%;
|
|
display: flex;
|
|
|
|
.bottom-btn {
|
|
margin: 0;
|
|
padding: 0;
|
|
width: 30%;
|
|
height: 70rpx;
|
|
text-align: center;
|
|
margin: 15rpx 0 0 2%;
|
|
color: #fff;
|
|
font-size: 21px;
|
|
border-radius: 5px;
|
|
}
|
|
|
|
.bottom-btn:first-child {
|
|
background: linear-gradient(90deg, #FF9797, #FFC1E0);
|
|
border-top-left-radius: 70rpx;
|
|
border-bottom-left-radius: 70rpx;
|
|
margin-left: 20rpx;
|
|
}
|
|
|
|
.bottom-btn:last-child {
|
|
background: linear-gradient(90deg, #60F3FF, #088FEB);
|
|
border-top-right-radius: 70rpx;
|
|
border-bottom-right-radius: 70rpx;
|
|
}
|
|
}
|
|
|
|
.bottom-left text {
|
|
display: inline-block;
|
|
padding-left: 20rpx;
|
|
padding-top: 10rpx;
|
|
}
|
|
|
|
.bottom-btn {
|
|
color: blue;
|
|
border-radius: 5px;
|
|
border: 1px solid #777;
|
|
display: inline-block;
|
|
padding: 5px 5px;
|
|
margin: 10px;
|
|
}
|
|
|
|
textarea {
|
|
height: 40px;
|
|
width: 300rpx;
|
|
overflow: hidden;
|
|
padding-left: 10px;
|
|
}
|
|
|
|
.shop-popup-content {
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 30rpx;
|
|
height: 600px;
|
|
background-color: #fff;
|
|
margin-bottom: 30rpx;
|
|
overflow: scroll;
|
|
}
|
|
|
|
.shop-popup-title {
|
|
display: flex;
|
|
height: 50px;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
.shop-popup-title-right {
|
|
width: 400rpx;
|
|
margin-left: 30rpx;
|
|
display:flex;
|
|
}
|
|
|
|
.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: 50px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.shop-title-name {
|
|
font-size: 21px;
|
|
width: 50%;
|
|
float: left;
|
|
height: 50px;
|
|
line-height: 50px;
|
|
}
|
|
|
|
.shop-attrs {
|
|
.suibian {
|
|
display: inline-block;
|
|
border: 1px solid #5fd9ee;
|
|
margin: 10px 20px;
|
|
margin-bottom: 0;
|
|
margin-left: 0;
|
|
background-color: #fff;
|
|
color: #5fd9ee;
|
|
padding: 0 10px;
|
|
min-width: 80px;
|
|
line-height: 40px;
|
|
height: 40px;
|
|
text-align: center;
|
|
border-radius: 10px;
|
|
}
|
|
|
|
.checkedText {
|
|
background-color: #5fd9ee;
|
|
color: #fff;
|
|
border-radius: 20rpx;
|
|
}
|
|
}
|
|
|
|
.shop-checkList {
|
|
display: flex;
|
|
height: 50px;
|
|
font-size: 21px;
|
|
line-height: 50px;
|
|
}
|
|
|
|
.shop-checkList-box {
|
|
height: 50px;
|
|
width: 60%;
|
|
}
|
|
|
|
.popup-content {
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 30rpx;
|
|
width: 500rpx;
|
|
height: 500rpx;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.popup-title {
|
|
font-size: 21px;
|
|
font-weight: bold;
|
|
text-align: center;
|
|
position: relative;
|
|
}
|
|
|
|
.popup-container {
|
|
margin-top: 20rpx;
|
|
margin-top: 20rpx;
|
|
font-size: 21px;
|
|
}
|
|
|
|
.popup-bottom {
|
|
height: 80rpx;
|
|
color: #fff;
|
|
line-height: 80rpx;
|
|
margin-top: 50rpx;
|
|
}
|
|
|
|
.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: 21px;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.box-right-num {
|
|
padding: 5rpx 0;
|
|
color: #777;
|
|
}
|
|
|
|
.box-right-price {
|
|
display: flex;
|
|
font-size: 21px;
|
|
}
|
|
|
|
.voice-price-box {
|
|
display: flex;
|
|
flex-direction: column;
|
|
margin-right: 20rpx;
|
|
}
|
|
|
|
.voice-price-box text:first-child {
|
|
color: #ffa200
|
|
}
|
|
|
|
.popup-btn {
|
|
text-align: center;
|
|
background: linear-gradient(90deg, #60F3FF, #088FEB);
|
|
}
|
|
|
|
.shop-popup-bottom {
|
|
width: 95%;
|
|
height: 60px;
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 2.5%;
|
|
display: flex;
|
|
z-index: 99;
|
|
background: #fff;
|
|
}
|
|
|
|
.shop-popup-bottom-left {
|
|
width: 77%;
|
|
line-height: 60px;
|
|
}
|
|
|
|
.shop-popup-bottom-right {
|
|
width: 20%;
|
|
line-height: 60px;
|
|
|
|
.bottom-btn {
|
|
width: 100%;
|
|
line-height: 50px;
|
|
height: 50px;
|
|
text-align: center;
|
|
color: #fff;
|
|
font-size: 21px;
|
|
margin: 0 auto;
|
|
background: linear-gradient(90deg, #60F3FF, #088FEB);
|
|
border-radius: 50px;
|
|
border:none;
|
|
padding:0;
|
|
}
|
|
}
|
|
|
|
.uni-numbox {
|
|
input {
|
|
padding-left: 0;
|
|
}
|
|
}
|
|
|
|
.noPic {
|
|
border-radius: 10px;
|
|
width: 140rpx;
|
|
height: 140rpx;
|
|
margin: 16rpx 0 0 30rpx;
|
|
text-align: center;
|
|
line-height: 140rpx;
|
|
color: #777;
|
|
background: #eee;
|
|
}
|
|
|
|
.list-val {
|
|
.uni-data-select {
|
|
text-align: left;
|
|
|
|
}
|
|
|
|
.uni-select__input-text {
|
|
padding-left: 120rpx;
|
|
}
|
|
|
|
.uni-select__selector {
|
|
position: absolute;
|
|
left: 0;
|
|
top: -240rpx
|
|
}
|
|
|
|
.uni-popper__arrow {
|
|
display: none;
|
|
}
|
|
|
|
.uni-select__selector-item text {
|
|
display: inline-block;
|
|
text-align: center;
|
|
}
|
|
}
|
|
|
|
.voice-popup-content {
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 20px;
|
|
width: 390rpx;
|
|
border-radius: 10px;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.voice-popup-title {
|
|
font-size: 21px;
|
|
font-weight: bold;
|
|
text-align: center;
|
|
position: relative;
|
|
}
|
|
|
|
.voice-popup-container {
|
|
|
|
}
|
|
|
|
.voice-popup-bottom {
|
|
display: flex;
|
|
height: 50px;
|
|
color: #fff;
|
|
line-height: 50px;
|
|
margin-top: 20rpx;
|
|
}
|
|
|
|
.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: -150px;
|
|
left: 39%;
|
|
width: 120px;
|
|
height: 120px;
|
|
background: #eee;
|
|
border-radius: 50%;
|
|
}
|
|
|
|
.type-popup {
|
|
width: 500rpx;
|
|
height: auto;
|
|
max-height: 900rpx;
|
|
overflow: scroll;
|
|
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: 70rpx;
|
|
margin: 0 auto;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
|
|
.content-fur {
|
|
padding-bottom: 25rpx;
|
|
}
|
|
|
|
.content-low {
|
|
width: auto;
|
|
border: 1px solid #eee;
|
|
display: inline-block;
|
|
min-width: 90rpx;
|
|
padding: 5rpx;
|
|
font-size: 21px;
|
|
text-align: center;
|
|
color: #777;
|
|
margin: 20rpx 0 0 20rpx;
|
|
}
|
|
|
|
.scroll-content {
|
|
height: 66%;
|
|
}
|
|
|
|
.kucun {
|
|
background: url(https://jewel-shop.oss-cn-beijing.aliyuncs.com/9428d632981647728829da336a1d24b3.png) no-repeat;
|
|
width: 50rpx;
|
|
height: 25rpx;
|
|
position: absolute;
|
|
top: -14rpx;
|
|
right: -15rpx;
|
|
background-size: 100%;
|
|
}
|
|
|
|
.zuni-numbox {
|
|
height: 50px;
|
|
display: flex;
|
|
flex-direction: row;
|
|
}
|
|
|
|
.zuni-numbox-btns {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 0 16rpx;
|
|
font-size: 21px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.zuni-numbox__value {
|
|
margin: 0 4rpx;
|
|
width: 40px;
|
|
text-align: center;
|
|
font-size: 21px;
|
|
line-height: 40px;
|
|
height: 40px;
|
|
border-left-width: 0;
|
|
border-right-width: 0;
|
|
}
|
|
|
|
|
|
.zuni-numbox--text {
|
|
line-height: 40rpx;
|
|
|
|
font-size: 21px;
|
|
font-weight: 300;
|
|
}
|
|
|
|
.zuni-numbox .zuni-numbox--disabled {
|
|
color: #c0c0c0 !important;
|
|
cursor: not-allowed;
|
|
}
|
|
.uni-select__selector-item{
|
|
font-size: 21px !important;
|
|
height: 40px;
|
|
line-height: 40px !important;
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
.new-logo {
|
|
background: red;
|
|
color: #fff;
|
|
width: 40px;
|
|
height: 40px;
|
|
line-height: 40px;
|
|
text-align: center;
|
|
}
|
|
|
|
.u-upload {
|
|
position: absolute;
|
|
top: 30rpx;
|
|
left: 30rpx;
|
|
opacity: 0;
|
|
width: 140rpx;
|
|
height: 140rpx;
|
|
}
|
|
|
|
.left-btn {
|
|
font-weight: 800;
|
|
font-size: 21px;
|
|
color: #fff;
|
|
background: #088FEB;
|
|
border-radius: 5px;
|
|
width: 140rpx;
|
|
height: 50rpx;
|
|
line-height: 50rpx;
|
|
text-align: center;
|
|
}
|
|
|
|
.one-goods {
|
|
margin-top: 20rpx;
|
|
width: 100%;
|
|
height: 50rpx;
|
|
background: #088FEB;
|
|
font-size: 21px;
|
|
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: 21px;
|
|
}
|
|
|
|
.sn-content-list {
|
|
width: 95%;
|
|
margin: 0 auto;
|
|
display: flex;
|
|
height: 80rpx;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
.sn-content-list:last-child {
|
|
border-bottom: none;
|
|
height: auto;
|
|
}
|
|
|
|
.sn-list-name {
|
|
width: 200rpx;
|
|
text-align: left;
|
|
line-height: 80rpx;
|
|
height: 80rpx;
|
|
padding-left: 20rpx;
|
|
}
|
|
|
|
.showImg-box {
|
|
width: 500px;
|
|
height: 550px;
|
|
}
|
|
|
|
.swiper-box {
|
|
height: 500px;
|
|
}
|
|
|
|
.swiper-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 500px;
|
|
color: #fff;
|
|
background-color: #cee1fd;
|
|
}
|
|
|
|
.lb-btn {
|
|
width: 100%;
|
|
height: 50px;
|
|
text-align: center;
|
|
line-height: 50px;
|
|
background: #088FEB;
|
|
color: #fff;
|
|
border-bottom-left-radius: 10px;
|
|
border-bottom-right-radius: 10px;
|
|
}
|
|
|
|
.sn-list-val {
|
|
width: 560rpx;
|
|
height: 80rpx;
|
|
line-height: 80rpx;
|
|
}
|
|
|
|
.sn-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;
|
|
}
|
|
.operate-btn{
|
|
padding: 0 5px;
|
|
color: #fff;
|
|
border-radius: 5px;
|
|
height: 34px;
|
|
line-height: 34px;
|
|
margin:3px 0 0 10px;
|
|
display: inline-block;
|
|
}
|
|
.uni-date-single--x {
|
|
background-color: #fff;
|
|
position: fixed !important;
|
|
top: 160px !important;
|
|
z-index: 999;
|
|
border: 1px solid #EBEEF5;
|
|
box-shadow: 0 5px 32px 0 rgba(0, 0, 0, 0.1);
|
|
border-radius: 4px;
|
|
}
|
|
.u-keyboard__button-wrapper__button{
|
|
width: 220px !important;
|
|
height: 60px !important;
|
|
}
|
|
.uni-select__input-box{
|
|
height: 50px !important;
|
|
}
|
|
.uni-calendar-item__weeks-box-text,.uni-calendar__weeks-day-text,.uni-calendar__header-text{
|
|
font-size: 21px !important;
|
|
}
|
|
.uni-calendar-item__weeks-box-item,.uni-calendar__header-btn-box {
|
|
width: 50px !important;
|
|
height: 50px !important;
|
|
}
|
|
.uni-calendar__weeks-day {
|
|
height: 50px !important;
|
|
}
|
|
</style>
|