diff --git a/pages/.DS_Store b/pages/.DS_Store
index d13ddaa..8be862a 100644
Binary files a/pages/.DS_Store and b/pages/.DS_Store differ
diff --git a/pages/billing/addUser.vue b/pages/billing/addUser.vue
index ea6d4e0..7c65e24 100644
--- a/pages/billing/addUser.vue
+++ b/pages/billing/addUser.vue
@@ -4,7 +4,7 @@
-
+
@@ -130,8 +130,9 @@
this.formData.city = data.city
this.formData.province = data.province
this.formData.id = data.id
- this.formData.consigneeMobile = data.consigneeMobile || data.phone
- this.formData.consigneeName = data.consigneeName || data.name
+ this.formData.consigneeMobile = data.consigneeMobile || data.phone || ""
+ console.log(this.formData.consigneeMobile)
+ this.formData.consigneeName = data.consigneeName || data.name || ""
}
},
@@ -164,6 +165,39 @@
this.showPrice = false
this.keyboardNum = ''
},
+ selectRepeat(e){
+ var that = this;
+ let url,data
+ if(this.popleType == 'khName'){
+ url = '/app/customer/findByUserName'
+ data = {
+ userName: e.detail.value,
+ }
+ }else if(this.popleType == 'gysName'){
+ url = '/app/supplier/getbySupplierName'
+ data = {
+ supplierName: e.detail.value
+ }
+ }
+ this.tui.request(url, "post", data, false, true).then((res) => {
+ if (res.code == 200) {
+ if(res.result.length > 0){
+ uni.showModal({
+ title: "提示",
+ content: "已经存在相同名称,是否继续添加?",
+ success: function(res) {
+ if (res.cancel) {
+ that.formData.consigneeName = ""
+ that.$forceUpdate()
+ }
+ }
+ })
+ }
+ } else {
+
+ }
+ })
+ },
del() {
this.delShow = true;
},
@@ -322,13 +356,24 @@
uni.showToast({
title: "添加成功",
icon: 'none'
- })
- let pages = getCurrentPages();
- let prevPage = pages[pages.length - 2];
- prevPage.$vm.popleType = 'khName'
- uni.navigateBack({
- delta: 1
- })
+ })
+ if(uni.getStorageSync('kaidanBack')){
+ uni.removeStorageSync('kaidanBack')
+ let pages = getCurrentPages();
+ let prevPage = pages[pages.length - 3];
+ res.result.noEarn = this.formData.noEarn == ''?'0': this.formData.noEarn
+ prevPage.$vm.khName = res.result
+ uni.navigateBack({
+ delta: 2
+ })
+ }else{
+ let pages = getCurrentPages();
+ let prevPage = pages[pages.length - 2];
+ prevPage.$vm.popleType = 'khName'
+ uni.navigateBack({
+ delta: 1
+ })
+ }
} else {
uni.showToast({
title: "添加失败",
@@ -339,7 +384,8 @@
}
} else {
- if (that.type == 'edit') {
+ if (that.type == 'edit') {
+ console.log('this.formData',this.formData)
that.tui.request("/app/supplier/edit", "post", this.formData, false,
true).then((res) => {
if (res.code == 200) {
@@ -362,14 +408,24 @@
uni.showToast({
title: "添加成功",
icon: 'none'
- })
- let pages =
- getCurrentPages();
- let prevPage = pages[pages.length - 2];
- prevPage.$vm.popleType = 'gysName'
- uni.navigateBack({
- delta: 1
- })
+ })
+ if(uni.getStorageSync('kaidanBack')){
+ uni.removeStorageSync('kaidanBack')
+ let pages = getCurrentPages();
+ let prevPage = pages[pages.length - 3];
+ res.result.noEarn = this.formData.noEarn == ''?'0':this.formData.noEarn
+ prevPage.$vm.khName = res.result
+ uni.navigateBack({
+ delta: 2
+ })
+ }else{
+ let pages = getCurrentPages();
+ let prevPage = pages[pages.length - 2];
+ prevPage.$vm.popleType = 'gysName'
+ uni.navigateBack({
+ delta: 1
+ })
+ }
} else {
uni.showToast({
title: "添加失败",
diff --git a/pages/billing/changeGoods1.vue b/pages/billing/changeGoods1.vue
index 7f2ed19..f2ecb81 100644
--- a/pages/billing/changeGoods1.vue
+++ b/pages/billing/changeGoods1.vue
@@ -1,7 +1,7 @@
-
@@ -15,21 +15,21 @@
-
+
暂无图片
- {{item.productSn}}
+ {{item.productSn}}({{item.productName == null ?'':item.productName}})
(已下架)
- {{item.productName}}
+ 供应商:{{item.supplierName== null?'':item.supplierName}}
-
+
{{item.wholesalePrice}}
批发价
@@ -49,18 +49,21 @@
-
+
暂无图片
- {{item.productName}}
- {{item.productSn}}
+
+ {{item.productSn}}
+ ({{item.productName == null ?'':item.productName}})
+
+ 供应商:{{item.supplierName}}
-
+
{{item.wholesalePrice}}
批发价
@@ -193,7 +196,19 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
@@ -541,7 +571,7 @@
暂无图片
- -
+
-
+
+ {{items.name}}
+
+
+ 新增{{items.name}}
+
+
+
+ {{itemTag.value}}
+
+
+
+
+ -
{{items.name}}
-
-
- 新增{{items.name}}
+
+
+ 新增{{items.name}}
-
{{itemTag.value}}
-
- -
-
- {{items.name}}
-
-
- 新增{{items.name}}
-
-
-
- {{itemTag.value}}
-
-
-
@@ -603,8 +636,8 @@
style="background: #f5f5f5;">
-
-
+
+
@@ -621,15 +654,19 @@
style="color:#777;font-size: 12px;">{{item.productNum==null?'无库存':item.productNum}}
-
-
- -
-
-
-
- +
-
+ @change="temporaryChange($event,item)" /> -->
+
+
+ -
+
+
+
+ +
+
@@ -677,12 +714,13 @@
-
- {{oneGoodsId != ''?'语音示例:货号0237,白色M码,数量10件,蓝色M码,数量10件,单价88,名称:裙子':'语音示例:货号02-37,白色M码,10件'}}
+
+ {{oneGoodsId != ''?'语音示例:货号0237,数量10件,单价88,名称:裙子':'语音示例:货号02-37,白色M码,数量10件'}}
-
+
销售金额
@@ -718,7 +757,8 @@
¥{{shouldPay}}
-
+
本次欠款
@@ -726,7 +766,8 @@
¥{{noPay}}
-
+
本次余额
@@ -736,7 +777,8 @@
-
+
应收金额
@@ -744,7 +786,8 @@
¥{{relPrice}}
-
+
已收金额
@@ -752,10 +795,11 @@
¥{{priceOk}}
-
-
+
+
-
+
退货金额:
¥{{returnPay}}
@@ -790,7 +834,8 @@
其他费用:
- ¥{{otherExpense == ''?'0':otherExpense}}
+ ¥{{otherExpense == ''?'0':otherExpense}}
-
-
-
-
+
+
+
+
@@ -877,59 +925,109 @@
-
-
-
-
-
-
- 确认修改
+
+
+
+
+
+ 确认修改
+
+
+
+
+
+
+
+
+
+
+
+
+ 实收金额计算方式
+
+ {{methodText}}
+
+
+ 貌似没有检测到您上次的语音录入信息,正在反复识别中...
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 更换图片
-
-
-
-
-
-
- 实收金额计算方式
-
- {{methodText}}
-
-
- 貌似没有检测到您上次的语音录入信息,正在反复识别中...
-
-
-
-
-
-
-
-
-
-
-
-
- 更换图片
-
@@ -944,28 +1042,32 @@
export default {
data() {
return {
- attrList: [],
- productPictures:[],
- showPrice:false,
- swiperDotIndex:0,
- showFu:false,
- attributeValue: [],
- prefixRule:'',
- numRule:'',
- evalue:[],
+ attrList: [],
+ productPictures: [],
+ oneData: {},
+ moreData: [],
+ voiceData: {},
+ showPrice: false,
+ swiperDotIndex: 0,
+ showFu: false,
+ attributeValue: [],
+ prefixRule: '',
+ numRule: '',
+ evalue: [],
lsprice: 0, //临时零售价
wholesalePrice: 0, // 临时显示批发价
price: 0, //总金额
relPrice: "", //实收金额
- otherExpense: "", // 其他费用
- keyboardNum:'',
- priceMore:false,
- sellObj:{},
+ otherExpense: "", // 其他费用
+ keyboardNum: '',
+ priceMore: false,
+ sellObj: {},
noPay: 0, //欠款
discountNum: 10, //整体折扣
priceCurrent: '',
- goodsDetail: [],
- childrenId:'',
+ voiceGetOneData: true,
+ goodsDetail: [],
+ childrenId: '',
noticeData: ['您每发出一个包,使用拉包工和物流公司送货时,我们将从中拿出XX元,捐入快拾帮帮公益基金中,帮助那些贫困儿童!我们的付出将让世界充满爱!'],
columns: [],
keyList: [],
@@ -1029,31 +1131,34 @@
}
],
discountType: '', //折扣类型
- discountCurrent: '',
- isVoice:false,
- current: 0,
- lunbocurrent:4,
+ discountCurrent: '',
+ isVoice: false,
+ showTan: false,
+ currentPopupIndex: 0,
+ current: 0,
+ lunbocurrent: 4,
voiceText: ' ',
+ voiceText1:' ',
discCurrent: '', //折扣
logisticsCurrent: '', //物流
- categoryList: '',
- fenleiList:{},
- payType:1,
- payTypeList:[{
- value: 1,
- text: "微信支付"
- },{
- value: 0,
- text: "现金支付"
- },{
- value: 2,
- text: "支付宝支付"
- },{
- value: 3,
- text: "银行卡转账"
- },{
- value: 4,
- text: "收款码支付"
+ categoryList: '',
+ fenleiList: {},
+ payType: 1,
+ payTypeList: [{
+ value: 1,
+ text: "微信支付"
+ }, {
+ value: 0,
+ text: "现金支付"
+ }, {
+ value: 2,
+ text: "支付宝支付"
+ }, {
+ value: 3,
+ text: "银行卡转账"
+ }, {
+ value: 4,
+ text: "收款码支付"
}],
radioType: "2", //发货方式按钮选择
khName: [], //客户
@@ -1063,105 +1168,116 @@
lbgName: [], //拉包工姓名
carList: new Map(), //添加商品页传回来的商品信息
xsyId: '',
- shouldPay: 0,
- 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:'',
+ shouldPay: 0,
+ 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: [],
+ carList1: [],
specifications: '',
isPlusAndMinus: false,
- radioType1: 0,
- linshiPrice:0,
- snName:'',
+ radioType1: 0,
+ linshiPrice: 0,
+ snName: '',
saleDetailList: [],
- clearMsg: '',
- snList:[],
+ clearMsg: '',
+ snList: [],
priceType: '',
multiple: 1,
productId: '',
productNum: 0,
historyList: {},
afterPrice: 0, //第二次选择商品的时候,先计算这个价格,实收金额= 已经存在的实收金额 + afterPrice
- pageOldTemList: [],
- indexList:[],
- categoryText:'',
+ pageOldTemList: [],
+ indexList: [],
+ categoryText: '',
oldTemList: [],
- goodsList: [],
- saleId:'',
+ goodsList: [],
+ saleId: '',
newTemList: [],
- pecsList: [],
- oneGoodsId:'',
+ pecsList: [],
+ oneGoodsId: '',
dataObj: new Map(),
allChangeNum: 0,
recordState: false,
+ textareaValue:'',
currentAnchor: '',
- temporaryNum: 0,
- keyboard:'',
- keyboardIndex:'',
+ temporaryNum: 0,
+ keyboard: '',
+ keyboardIndex: '',
aiNotRecognition: '',
getMsg: '',
- qrArr: [],
- defaultList:[{
- name:'颜色',
- value:[]
- },{
- name:'尺码',
- value:[]
+ qrArr: [],
+ defaultList: [{
+ name: '颜色',
+ value: []
+ }, {
+ name: '尺码',
+ value: []
}],
}
},
- onShow() {
- let isTrue = false
- this.xsyList();
- this.initRecord();
- this.analysisQrCode()
- this.getShopCategory()
- this.getSnList()
+ 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 = ''
- uni.removeStorageSync('hangOrder');
- }
- 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))
- }
- if(this.khName != ''){
- if(this.khName.noEarn != null && this.zhiqianqiankuan != this.khName.noEarn){
- isTrue = true
- }
- if(this.khName.noEarn == null){
- this.zhiqianqiankuan = 0
- }else{
- this.zhiqianqiankuan = this.khName.noEarn
- }
- }
+ let that = this;
+ if (uni.getStorageSync('hangOrder') == true) {
+ this.carList.clear()
+ this.remark = ''
+ this.xsyId = ''
+ this.khName = []
+ this.saleId = ''
+ uni.removeStorageSync('hangOrder');
+ }
+ 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))
+ }
+ if (this.khName != '') {
+ if (this.khName.noEarn != null && this.zhiqianqiankuan != this.khName.noEarn) {
+ isTrue = true
+ }
+ if (this.khName.noEarn == null) {
+ this.zhiqianqiankuan = 0
+ } else {
+ this.zhiqianqiankuan = this.khName.noEarn
+ }
+ }
this.$forceUpdate()
this.gysName = JSON.parse(JSON.stringify(this.gysName))
this.wlName = JSON.parse(JSON.stringify(this.wlName))
@@ -1173,9 +1289,9 @@
}, {
text: '自送',
value: 1
- }]
-
- if (uni.getStorageSync('carList1') != '') {
+ }]
+
+ if (uni.getStorageSync('carList1') != '') {
isTrue = true
this.carList.clear()
this.carList1 = JSON.parse(uni.getStorageSync('carList1'))
@@ -1184,9 +1300,9 @@
this.saleId = this.carList1[0].saleId
this.xsyId = this.carList1[0].xsyId
this.createByName = this.carList1[0].createByName
- } else {
- if(this.carList1 != ''){
- isTrue = true
+ } else {
+ if (this.carList1 != '') {
+ isTrue = true
}
this.carList1 = this.carList1
}
@@ -1209,179 +1325,271 @@
onLoad(option) {
this.getDefaultCategory()
},
- methods: {
- //店铺规格库
- 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{
- if(isysTrue){
- this.defaultList[1].value.push(this.specifiList[0].productAttributeValueVoList[m])
- }
- })
- }
- }else{
- for(let m=0;m{
- if(isTrue){
- this.defaultList[0].value.push(this.specifiList[0].productAttributeValueVoList[m])
- }
- })
-
- }
- }
- if(this.specifiList[1].attributeName == '尺码'){
- for(let m=0;m{
- if(isysTrue){
- this.defaultList[1].value.push(this.specifiList[1].productAttributeValueVoList[m])
- }
- })
- }
- }else{
- for(let m=0;m{
- 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 == 'danjishu'){
- this.numChange(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 == 'danjia'){
- this.clickCollapse(Number(this.keyboardNum),this.keyboardIndex)
- }else if(this.keyboard == 'priceOk'){
- this.changePrice(Number(this.keyboardNum))
- }else if(this.keyboard == 'relPrice'){
- 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;
- },
+ methods: {
+ //店铺规格库
+ 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 == 'danjishu') {
+ this.numChange(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 == 'danjia') {
+ this.clickCollapse(Number(this.keyboardNum), this.keyboardIndex)
+ } else if (this.keyboard == 'priceOk') {
+ this.changePrice(Number(this.keyboardNum))
+ } else if (this.keyboard == 'relPrice') {
+ 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 {
+ const match = str.match(regex);
+ if (match && match[1]) {
+ // 去除可能的前后空格
+ info[name] = match[1].trim();
+ }
+ });
+ console.log('info', info)
+ if (info.productCount && info.productCount.indexOf(',') != -1) {
+ info.productCount = info.productCount.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;
},
handleData(isTrue) {
let that = this;
@@ -1394,13 +1602,14 @@
discount: 10, //折扣
categoryId: this.carList1[i].categoryId,
unitPrice: this.carList1[i].unitPrice || 0, //单价
- discountAmount: this.carList1[i].wholesalePrice || 0, //折后价
- returnPrice:this.carList1[i].returnPrice?this.carList1[i].returnPrice:this.carList1[i].wholesalePrice || 0,
+ 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, //退货数量
+ productCount: 0, //总数量
+ returnCount: 0, //退货数量
productId: this.carList1[i].id,
productName: this.carList1[i].productName,
productPicture: this.carList1[i].productPicture,
@@ -1418,19 +1627,19 @@
.saleDetailQueryDTO[m].stockCount
}
- obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
- if(this.carList1[i].saleDetailQueryDTO[m].productCount < 0){ //退货数量
- obj.returnCount += Math.abs(this.carList1[i].saleDetailQueryDTO[m].productCount)
- }else{
- obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
+ obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
+ if (this.carList1[i].saleDetailQueryDTO[m].productCount < 0) { //退货数量
+ obj.returnCount += Math.abs(this.carList1[i].saleDetailQueryDTO[m].productCount)
+ } else {
+ obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
}
-
+
}
this.carList.set(this.carList1[i].id, obj)
} else { //当前页有数据
- if (this.carList.has(this.carList1[i].id) == true) { //商品相同
- if(this.carList.get(this.carList1[i].id).returnPrice != this.carList1[i].returnPrice){
- this.carList.get(this.carList1[i].id).returnPrice = this.carList1[i].returnPrice
+ if (this.carList.has(this.carList1[i].id) == true) { //商品相同
+ if (this.carList.get(this.carList1[i].id).returnPrice != this.carList1[i].returnPrice) {
+ this.carList.get(this.carList1[i].id).returnPrice = this.carList1[i].returnPrice
}
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
if (this.carList.get(this.carList1[i].id).stockLogList.has(this.carList1[i]
@@ -1474,13 +1683,15 @@
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i]
.saleDetailQueryDTO[
m].attributeList, data1)
- }
- if(this.carList1[i].saleDetailQueryDTO[m].productCount < 0){ //退货数量
- this.carList.get(this.carList1[i].id).returnCount += Math.abs(this.carList1[i].saleDetailQueryDTO[m].productCount)
- }else{
- this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
}
-
+ if (this.carList1[i].saleDetailQueryDTO[m].productCount < 0) { //退货数量
+ this.carList.get(this.carList1[i].id).returnCount += Math.abs(this.carList1[i]
+ .saleDetailQueryDTO[m].productCount)
+ } else {
+ this.carList.get(this.carList1[i].id).productCount += this.carList1[i]
+ .saleDetailQueryDTO[m].productCount
+ }
+
}
} else { //商品不同
let obj = {
@@ -1488,14 +1699,15 @@
price: 0,
discount: 10,
categoryId: this.carList1[i].categoryId,
- discountAmount: this.carList1[i].wholesalePrice || 0,
- returnPrice:this.carList1[i].returnPrice?this.carList1[i].returnPrice:this.carList1[i].wholesalePrice || 0,
+ 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,
+ productCount: 0,
+ returnCount: 0,
productId: this.carList1[i].id,
productName: this.carList1[i].productName,
productPicture: this.carList1[i].productPicture,
@@ -1517,11 +1729,11 @@
}
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
- 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)
- }else{
- obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
+ 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)
+ } else {
+ obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
}
}
this.carList.set(this.carList1[i].id, obj)
@@ -1530,7 +1742,7 @@
}
}
- uni.removeStorageSync('carList1')
+ uni.removeStorageSync('carList1')
uni.removeStorageSync('khName')
uni.removeStorageSync('saoma')
uni.removeStorageSync('clearMsg')
@@ -1548,11 +1760,11 @@
value.price = value.unitPrice * 10000 * value.productCount * that.discountNum / 10 / 10000
}
})
- // this.getAllPrice()
- if(isTrue){
- this.getAmountAndWho()
+ // this.getAllPrice()
+ if (isTrue) {
+ this.getAmountAndWho()
}
-
+
// this.noPay = this.shouldPay
if (this.xsyId == '') {
this.xsyId = uni.getStorageSync('id')
@@ -1570,6 +1782,7 @@
},
AiHandleData() {
let that = this;
+ console.log('carList1', this.carList1)
for (let i = 0; i < this.carList1.length; i++) {
if (this.carList1[i].stockLogList1) {
@@ -1578,24 +1791,25 @@
let obj = {
purchasePrice: this.carList1[i].purchasePrice, //采购价
price: 0, //总价
- discount: 10, //折扣
- isNew:this.carList1[i].isNew,
+ discount: 10, //折扣
+ isNew: this.carList1[i].isNew,
productId: this.carList1[i].productId,
- categoryId: this.carList1[i].categoryId,
- categoryName:this.carList1[i].isNew?'默认分类':this.carList1[i].categoryName,
+ 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, //折后价
+ 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,
- returnPrice:this.carList1[i].wholesalePrice || 0,
- 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 || [],
+ id: this.carList1[i].productId,
+ returnPrice: this.carList1[i].wholesalePrice || 0,
+ 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(),
stockLogList1: [],
@@ -1608,7 +1822,11 @@
productNum: this.carList1[i].stockLogList1[m].stockCount
}
obj.stockLogList.set(this.carList1[i].stockLogList1[m].attributeList, data1)
- obj.productCount += this.carList1[i].stockLogList1[m].productCount
+ if (this.carList1[i].stockLogList1[m].productCount < 0) { //退货数量
+ obj.returnCount += Math.abs(this.carList1[i].stockLogList1[m].productCount)
+ } else {
+ obj.productCount += this.carList1[i].stockLogList1[m].productCount
+ }
}
this.carList.set(this.carList1[i].productId, obj)
} else { //当前页有数据
@@ -1637,35 +1855,39 @@
productNum: this.carList1[i].stockLogList1[m].stockCount
}
this.carList.get(this.carList1[i].productId).stockLogList.set(this.carList1[i]
- .stockLogList1[
- m].attributeList, data1)
+ .stockLogList1[m].attributeList, data1)
+ }
+ if (this.carList.get(this.carList1[i].productId).productCount < 0) { //退货数量
+ this.carList.get(this.carList1[i].productId).returnCount += Math.abs(this.carList1[
+ i].stockLogList1[m].productCount)
+ } else {
+ this.carList.get(this.carList1[i].productId).productCount += this.carList1[i]
+ .stockLogList1[m].productCount
}
- this.carList.get(this.carList1[i].productId).productCount += this.carList1[i]
- .stockLogList1[
- m].productCount
}
} else { //商品不同
let obj = {
purchasePrice: this.carList1[i].purchasePrice, //采购价
price: 0, //总价
discount: 10, //折扣
- categoryId: this.carList1[i].categoryId,
- categoryName:this.carList1[i].isNew?'默认分类':this.carList1[i].categoryName,
- productId: this.carList1[i].productId,
- isNew:this.carList1[i].isNew,
+ categoryId: this.carList1[i].categoryId,
+ 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, //折后价
+ 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,
+ 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 || [],
+ 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(),
stockLogList1: [],
@@ -1683,7 +1905,11 @@
obj.stockLogList.set(this.carList1[i].stockLogList1[m].attributeList, data1)
obj.name = this.sliceMsg(this.carList1[i].stockLogList1[m].attributeList)
- obj.productCount += this.carList1[i].stockLogList1[m].productCount
+ if (this.carList1[i].stockLogList1[m].productCount < 0) { //退货数量
+ obj.returnCount += Math.abs(this.carList1[i].stockLogList1[m].productCount)
+ } else {
+ obj.productCount += this.carList1[i].stockLogList1[m].productCount
+ }
}
this.carList.set(this.carList1[i].productId, obj)
}
@@ -1702,7 +1928,8 @@
value.unitPrice = value.wholesalePrice
}
if (that.discountType == 1) { //整体折扣
- value.price = value.unitPrice * 10000 * value.productCount * that.discountNum / 10 / 10000
+ value.price = value.unitPrice * 10000 * value.productCount * that.discountNum /
+ 10 / 10000
}
})
// this.getAllPrice()
@@ -1723,13 +1950,13 @@
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] + ' | '
+ for (let as in newObj) {
+ if (as == '尺码') {
+ name += newObj[as]
+ } else {
+ name += newObj[as] + ' | '
}
-
+
}
}
return name;
@@ -1798,234 +2025,236 @@
}).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 {})
- },
- 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) => {})
- },
- //获取新货号
- getNewSn(img){
- this.tui.request("/app/productSn/getNewProductSn", "POST", {
- snPre: this.snName
- }, false, true).then((res) => {
- if (res.code == 200) {
- this.addPageGoods(img,res.result)
- } else {
- this.tui.toast(res.message)
- }
- }).catch((res) => {})
- },
- addPageGoods(path,sn) {
- let obj = {
- id: generateUUID(),
- categoryName: this.fenleiList.categoryName,
- categoryId: this.fenleiList.categoryId,
- isNew: true,
- productPictures:[],
- purchasePrice: "", //采购价
- price: 0, //总价
- discount: 10, //折扣
- unitPrice: 0, //单价
- discountAmount: 0, //折后价
- returnPrice:0,
- disNoAmount: 0, //折前价,用于计算整体折扣
- wholesalePrice: 0, //批发价
- lsprice: 0, //零售价
- productCount: 0, //总数量
- returnCount:0, //退货数量
- productId: '',
- productName: '',
- productPicture: '',
- productSn: sn?sn:"",
- stockLogList: new Map(),
- stockLogList1: [],
- supplierName: '' //供应商
- }
- let data = {
- attributeList:'{"颜色":"均色","尺码":"均码"}',
- name:'均色 | 均码',
- productCount:0,
- productNum:null
- }
- obj.stockLogList.set(data.attributeList,data)
- this.carList.set(obj.id, obj)
- this.$forceUpdate()
+ },
+ //店铺默认分类
+ 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) => {})
+ },
+ //获取新货号
+ getNewSn(img) {
+ this.tui.request("/app/productSn/getNewProductSn", "POST", {
+ snPre: this.snName
+ }, false, true).then((res) => {
+ if (res.code == 200) {
+ this.addPageGoods(img, res.result)
+ } else {
+ this.tui.toast(res.message)
+ }
+ }).catch((res) => {})
+ },
+ addPageGoods(path, sn) {
+ let obj = {
+ id: generateUUID(),
+ categoryName: this.fenleiList.categoryName,
+ categoryId: this.fenleiList.categoryId,
+ isNew: true,
+ productPictures: [],
+ purchasePrice: "", //采购价
+ price: 0, //总价
+ discount: 10, //折扣
+ unitPrice: 0, //单价
+ discountAmount: 0, //折后价
+ returnPrice: 0,
+ disNoAmount: 0, //折前价,用于计算整体折扣
+ wholesalePrice: 0, //批发价
+ lsprice: 0, //零售价
+ productCount: 0, //总数量
+ returnCount: 0, //退货数量
+ productId: '',
+ productName: '',
+ productPicture: '',
+ productSn: sn ? sn : "",
+ stockLogList: new Map(),
+ stockLogList1: [],
+ supplierName: '' //供应商
+ }
+ let data = {
+ attributeList: '{"颜色":"均色","尺码":"均码"}',
+ name: '均色 | 均码',
+ productCount: 0,
+ productNum: null
+ }
+ obj.stockLogList.set(data.attributeList, 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 += 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 += 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 += 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 += 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()
+ 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 += 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 += 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 += 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 += 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()
})
},
@@ -2035,6 +2264,8 @@
}, false, false, true).then((res) => {
if (res.code !== 200) return
+ this.xsyId = res.result[0].id
+ this.createByName = res.result[0].nickname
this.categoryList = res.result.map(item => {
return {
value: item.id,
@@ -2043,21 +2274,21 @@
})
})
},
- allChange(e) {
+ allChange(e) {
this.allChangeNum = e
//监听到输入框改变,给所有的都赋值
if (this.isPlusAndMinus == false) {
- for (var i = 0; i < this.temporaryList.length; i++) {
- if(this.evalue.length == 0){
- this.temporaryList[i].productCount = Number(this.allChangeNum)
- }else{
- for(var j=0;j {
uni.hideLoading();
@@ -2162,368 +2393,374 @@
}
})
},
- attrNameChange(index, data1, index1) {
+ 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: 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 = 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 = this.oldTemList[i].productCount
- notChcek = false;
- }
- }
- if (this.newTemList.length > 0 && notChcek) {
- this.newTemList.push(this.oldTemList[i]);
- }
- }
-
- for (var i = 0; i < this.pageOldTemList.length; i++) {
- let oldAttributeList = '';
- let oldProductCount = '';
- let notChcek = true;
- for (var m = 0; m < this.newTemList.length; m++) {
- if (this.pageOldTemList[i].attributeList == this.newTemList[m].attributeList) {
- this.newTemList[m].productCount = this.pageOldTemList[i].productCount
- notChcek = false;
- }
- }
- if (this.newTemList.length > 0 && notChcek) {
- this.newTemList.push(this.pageOldTemList[i]);
- }
- }
- }
- this.$nextTick(() => {
- for (var i = 0; i < 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 0 && notChcek) {
- this.newTemList.push(this.oldTemList[i]);
- }
- }
-
- for (var i = 0; i < this.pageOldTemList.length; i++) {
- let oldAttributeList = '';
- let oldProductCount = '';
- let notChcek = true;
- for (var m = 0; m < this.newTemList.length; m++) {
- if (this.pageOldTemList[i].attributeList == this.newTemList[m].attributeList) {
- this.newTemList[m].productCount = this.pageOldTemList[i].productCount
- notChcek = false;
- }
- }
- if (this.newTemList.length > 0 && notChcek) {
- this.newTemList.push(this.pageOldTemList[i]);
- }
- }
- }
- this.$nextTick(() => {
- for (var i = 0; i < this.temporaryList.length; i++) {
- for (var m = 0; m < this.pecsList.length; m++) {
- if (this.temporaryList[i].attributeList == this.pecsList[m].attributeList) {
- this.temporaryList[i].productNum = this.pecsList[m].stockCount
- }
- }
- }
- })
- if (this.newTemList.length != 0) {
- this.temporaryList = this.newTemList;
- this.oldTemList = []
- this.newTemList = []
- }
- setTimeout(res => {
- uni.hideLoading();
- }, 200)
+ .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: 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 = 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 = this.oldTemList[i].productCount
+ notChcek = false;
+ }
+ }
+ if (this.newTemList.length > 0 && notChcek) {
+ this.newTemList.push(this.oldTemList[i]);
+ }
+ }
+
+ for (var i = 0; i < this.pageOldTemList.length; i++) {
+ let oldAttributeList = '';
+ let oldProductCount = '';
+ let notChcek = true;
+ for (var m = 0; m < this.newTemList.length; m++) {
+ if (this.pageOldTemList[i].attributeList == this.newTemList[m].attributeList) {
+ this.newTemList[m].productCount = this.pageOldTemList[i].productCount
+ notChcek = false;
+ }
+ }
+ if (this.newTemList.length > 0 && notChcek) {
+ this.newTemList.push(this.pageOldTemList[i]);
+ }
+ }
+ }
+ this.$nextTick(() => {
+ for (var i = 0; i < 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: 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 = 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 = this.oldTemList[i].productCount
+ notChcek = false;
+ }
+ }
+ if (this.newTemList.length > 0 && notChcek) {
+ this.newTemList.push(this.oldTemList[i]);
+ }
+ }
+
+ for (var i = 0; i < this.pageOldTemList.length; i++) {
+ let oldAttributeList = '';
+ let oldProductCount = '';
+ let notChcek = true;
+ for (var m = 0; m < this.newTemList.length; m++) {
+ if (this.pageOldTemList[i].attributeList == this.newTemList[m].attributeList) {
+ this.newTemList[m].productCount = this.pageOldTemList[i].productCount
+ notChcek = false;
+ }
+ }
+ if (this.newTemList.length > 0 && notChcek) {
+ this.newTemList.push(this.pageOldTemList[i]);
+ }
+ }
+ }
+ this.$nextTick(() => {
+ for (var i = 0; i < this.temporaryList.length; i++) {
+ for (var m = 0; m < this.pecsList.length; m++) {
+ if (this.temporaryList[i].attributeList == this.pecsList[m].attributeList) {
+ this.temporaryList[i].productNum = this.pecsList[m].stockCount
+ }
+ }
+ }
+ })
+ if (this.newTemList.length != 0) {
+ this.temporaryList = this.newTemList;
+ this.oldTemList = []
+ this.newTemList = []
+ }
+ setTimeout(res => {
+ uni.hideLoading();
+ }, 200)
+ }
+
+
+ },
+ 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 == 'danzhe') {
+ this.carList.get(num).discount = ''
+ this.$forceUpdate()
+ } else if (type == 'danjishu') {
+ this.keyboard = 'danjishu'
+ this.keyboardIndex = num
+ this.showFu = true
+ } else if (type == 'zongjishu') {
+ this.keyboard = 'zongjishu'
+ 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 {
+ this.showPrice = true
+ this.priceOk = ''
}
-
-
- },
- 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=='danzhe'){
- this.carList.get(num).discount = ''
- this.$forceUpdate()
- }else if(type=='danjishu'){
- this.keyboard = 'danjishu'
- this.keyboardIndex = num
- this.showFu = true
- }else if(type=='zongjishu'){
- this.keyboard = 'zongjishu'
- 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{
- this.showPrice = true
- this.priceOk = ''
- }
- },
- numChange(e,index){
- this.temporaryList[index].productCount = e
- this.$forceUpdate()
- this.temporaryChange()
- },
- mapnumChange(e,id,id1){
- let that = this;
- this.carList.get(id).productCount = 0
- this.carList.get(id).returnCount = 0
-
- this.carList.get(id).stockLogList.get(id1).productCount = Number(e)
-
- 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 = that.carList.get(id).productCount + value.productCount
- }
- })
- this.$nextTick(()=>{
- // if (that.discountType != 0) { //单品折扣
- that.carList.get(id).price = that.carList.get(id).productCount * that.carList
- .get(id).discountAmount
- // }
- })
- this.$nextTick(()=>{
- this.getAllPrice()
- })
- },
- async mapMinusNum(index){
- this.temporaryList[index].productCount --
- this.temporaryChange()
- },
- mapPlusNum(index){
- this.temporaryList[index].productCount ++
- this.temporaryChange()
- },
- async oneMinusNum(index,index1){
- let that = this;
- this.carList.get(index).productCount = 0
- this.carList.get(index).returnCount = 0
- this.carList.get(index).stockLogList.get(index1).productCount --
- await this.carList.get(index).stockLogList.forEach(function(value, key) {
- if(value.productCount < 0){
- that.carList.get(index).returnCount = that.carList.get(index).returnCount + Math.abs(value.productCount)
- }else{
- that.carList.get(index).productCount = that.carList.get(index).productCount + value.productCount
- }
- })
- await this.$nextTick(()=>{
- // if (that.discountType != 0) { //单品折扣
- that.carList.get(index).price = that.carList.get(index).productCount * that.carList
- .get(index).discountAmount
- // }
- })
- this.$forceUpdate()
- this.getAllPrice()
- },
- onePlusNum(index,index1){
- let that = this;
- this.carList.get(index).productCount = 0
- this.carList.get(index).returnCount = 0
- this.carList.get(index).stockLogList.get(index1).productCount ++
- this.carList.get(index).stockLogList.forEach(function(value, key) {
- if(value.productCount < 0){
- that.carList.get(index).returnCount = that.carList.get(index).returnCount + Math.abs(value.productCount)
- }else{
- that.carList.get(index).productCount = that.carList.get(index).productCount + value.productCount
- }
- })
- this.$nextTick(()=>{
- // if (that.discountType != 0) { //单品折扣
- that.carList.get(index).price = that.carList.get(index).productCount * that.carList
- .get(index).discountAmount
- // }
- })
- this.$nextTick(()=>{
- this.getAllPrice()
- })
- },
-
+ },
+ numChange(e, index) {
+ this.temporaryList[index].productCount = e
+ this.$forceUpdate()
+ this.temporaryChange()
+ },
+ mapnumChange(e, id, id1) {
+ let that = this;
+ this.carList.get(id).productCount = 0
+ this.carList.get(id).returnCount = 0
+
+ this.carList.get(id).stockLogList.get(id1).productCount = Number(e)
+
+ 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 = that.carList.get(id).productCount + value.productCount
+ }
+ })
+ this.$nextTick(() => {
+ // if (that.discountType != 0) { //单品折扣
+ that.carList.get(id).price = that.carList.get(id).productCount * that.carList
+ .get(id).discountAmount
+ // }
+ })
+ this.$nextTick(() => {
+ this.getAllPrice()
+ })
+ },
+ async mapMinusNum(index) {
+ this.temporaryList[index].productCount--
+ this.temporaryChange()
+ },
+ mapPlusNum(index) {
+ this.temporaryList[index].productCount++
+ this.temporaryChange()
+ },
+ async oneMinusNum(index, index1) {
+ let that = this;
+ this.carList.get(index).productCount = 0
+ this.carList.get(index).returnCount = 0
+ this.carList.get(index).stockLogList.get(index1).productCount--
+ await this.carList.get(index).stockLogList.forEach(function(value, key) {
+ if (value.productCount < 0) {
+ that.carList.get(index).returnCount = that.carList.get(index).returnCount + Math.abs(
+ value.productCount)
+ } else {
+ that.carList.get(index).productCount = that.carList.get(index).productCount + value
+ .productCount
+ }
+ })
+ await this.$nextTick(() => {
+ // if (that.discountType != 0) { //单品折扣
+ that.carList.get(index).price = that.carList.get(index).productCount * that.carList
+ .get(index).discountAmount
+ // }
+ })
+ this.$forceUpdate()
+ this.getAllPrice()
+ },
+ onePlusNum(index, index1) {
+ let that = this;
+ this.carList.get(index).productCount = 0
+ this.carList.get(index).returnCount = 0
+ this.carList.get(index).stockLogList.get(index1).productCount++
+ this.carList.get(index).stockLogList.forEach(function(value, key) {
+ if (value.productCount < 0) {
+ that.carList.get(index).returnCount = that.carList.get(index).returnCount + Math.abs(value
+ .productCount)
+ } else {
+ that.carList.get(index).productCount = that.carList.get(index).productCount + value
+ .productCount
+ }
+ })
+ this.$nextTick(() => {
+ // if (that.discountType != 0) { //单品折扣
+ that.carList.get(index).price = that.carList.get(index).productCount * that.carList
+ .get(index).discountAmount
+ // }
+ })
+ this.$nextTick(() => {
+ this.getAllPrice()
+ })
+ },
+
//实收金额失去焦点
- changessPrice(e) {
+ changessPrice(e) {
this.relPrice = e
this.priceOk = this.relPrice
this.noPay = this.relPrice - this.priceOk;
},
- changePrice(e) {
- this.tanyishou = true
+ changePrice(e) {
+ this.tanyishou = true
this.priceOk = e
this.noPay = this.relPrice - this.priceOk;
- this.noPay = this.noPay.toFixed(2)
- this.leijiqiankuan = Number(this.zhiqianqiankuan) - Number(this.qiankuandikou) + Number(this.yuedikou) + Number(this.noPay)
+ this.noPay = this.noPay.toFixed(2)
+ this.leijiqiankuan = Number(this.zhiqianqiankuan) - Number(this.qiankuandikou) + Number(this.yuedikou) +
+ Number(this.noPay)
this.$forceUpdate()
},
getImg(key) {
@@ -2545,6 +2782,9 @@
}
}).catch((res) => {})
},
+ getText(e){
+ this.voiceText = e.detail.value
+ },
//切换销售员
categoryChange(e) {
for (let i = 0; i < this.categoryList.length; i++) {
@@ -2553,18 +2793,19 @@
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;
- }
- }
+ },
+ //切换销售员
+ 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;
@@ -2593,315 +2834,1852 @@
'世间': '10件',
'实践': '10件',
'实件': '10件',
+ '十件': '10件',
'景': '#',
'警': '#',
- '颈': '#',
- '括号':'货号'
+ '颈': '#',
+ '括号': '货号',
+ '付': '-',
+ '负': '-',
+ '父': '-',
+ '名城': '名称',
+ '明城': '名称',
+ '名成': '名称',
+ '名程': '名称',
+ '上移': '上衣',
+ '时1': '11',
+ '时2': '12',
+ '时3': '13',
+ '时4': '14',
+ '时5': '15',
+ '时6': '16',
+ '时7': '17',
+ '时8': '18',
+ '时9': '19',
};
- const regex = /(零|一|二|两|三|四|五|六|七|八|九|杠|刚|军色|叉|井|时间|事件|世间|实践|实件|景|警|颈|括号)/g;
+ const regex = /(零|一|二|两|三|四|五|六|七|八|九|杠|刚|军色|叉|井|时间|十件|事件|世间|实践|实件|景|警|颈|括号|付|负|父|名城|名程|名成|明城|上移|时1|时2|时3|时4|时5|时6|时7|时8|时9)/g;
return str.replace(regex, match => chineseNumToArabic[match]);
},
//编辑挂单信息
- setDetail(e) {
- if(this.oneGoodsId){
- this.setOneDetail()
- return
- }
- if(this.voiceText ==''){
- this.tui.toast('识别内容不能为空')
- return
+ async setDetail(e) {
+ if (this.oneGoodsId) {
+ this.setOneDetail()
+ return
}
- let convertedStr = this.convertChineseToArabic(this.voiceText);
- 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, ',数量:')
- }
- convertedStr = this.convertStringCorrectly(convertedStr)
- convertedStr = this.spliceMsg(convertedStr)
- if(convertedStr.indexOf(',') == 0){
-
- convertedStr = convertedStr.substr(1)
- }
- if (convertedStr.startsWith("号")) {
- convertedStr = "货号" + convertedStr.substr(1);
+ if (this.voiceText == '') {
+ this.tui.toast('识别内容不能为空')
+ return
}
- this.getMsg = convertedStr
- this.tui.request("/app/sale/buyAi", "POST", {
- aiMsg: this.getMsg
- }, false, true).then((res) => {
- if (res.code == 200) {
- this.voiceText = ''
- 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 = []
- if(res.result.data[i].productId == null){
- res.result.data[i].isNew = true
- res.result.data[i].productId = res.result.data[i].productSn || res.result.data[i].productName
- }else{
- res.result.data[i].isNew = false
- }
- // 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:0,
- productNum:null
- }
- newList.push(data)
- }
-
-
- res.result.data[i].stockLogList1 = newList
- if (newList.length > 0) {
- newData.push(res.result.data[i])
- }
-
- }
- 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("抱歉:小助手对" + this.getMsg + "的部分商品未识别,请检查识别信息是否正确")
+ let convertedStr = this.trimWhitespace(this.voiceText);
+ convertedStr = this.convertChineseToArabic(convertedStr);
+ if (convertedStr.indexOf('点') != -1) {
+ convertedStr = this.replaceCharAfterNumber(convertedStr, '点', '.')
+ }
+ if (convertedStr.indexOf('货号,') != -1) {
+ convertedStr = convertedStr.replace(/货号,/g, '货号')
+ }
+ if (convertedStr.indexOf('货号::') != -1) {
+ convertedStr = convertedStr.replace(/货号::/g, '货号')
+ }
+ if (convertedStr.indexOf('货号:') != -1) {
+ convertedStr = convertedStr.replace(/货号:/g, '货号')
+ }
+ if (convertedStr.indexOf(',名称') != -1) {
+ convertedStr = convertedStr.replace(/,名称/g, '名称')
+ }
+ if (convertedStr.indexOf('名称,') != -1) {
+ convertedStr = convertedStr.replace(/名称,/g, '名称')
+ }
+ if (convertedStr.indexOf('名称::') != -1) {
+ convertedStr = convertedStr.replace(/名称::/g, '名称')
+ }
+ if (convertedStr.indexOf('名称:') != -1) {
+ convertedStr = convertedStr.replace(/名称:/g, '名称')
+ }
+ if (convertedStr.indexOf('名称') != -1) {
+ convertedStr = convertedStr.replace(/名称/g, ',名称:')
+ }
+ if (convertedStr.indexOf(',单价') != -1) {
+ convertedStr = convertedStr.replace(/,单价/g, '单价')
+ }
+ if (convertedStr.indexOf('单价,') != -1) {
+ convertedStr = convertedStr.replace(/单价,/g, '单价')
+ }
+ if (convertedStr.indexOf('单价::') != -1) {
+ convertedStr = convertedStr.replace(/单价::/g, '单价')
+ }
+ if (convertedStr.indexOf('单价:') != -1) {
+ convertedStr = convertedStr.replace(/单价:/g, '单价')
+ }
+ if (convertedStr.indexOf('单价') != -1) {
+ convertedStr = convertedStr.replace(/单价/g, ',单价:')
+ }
+ if (convertedStr.indexOf(',数量') != -1) {
+ convertedStr = convertedStr.replace(/,数量/g, '数量')
+ }
+ if (convertedStr.indexOf('数量,') != -1) {
+ convertedStr = convertedStr.replace(/数量,/g, '数量')
+ }
+ if (convertedStr.indexOf('数量::') != -1) {
+ convertedStr = convertedStr.replace(/数量::/g, '数量')
+ }
+ if (convertedStr.indexOf('数量:') != -1) {
+ convertedStr = convertedStr.replace(/数量:/g, '数量')
+ }
+ if (convertedStr.indexOf('数量') != -1) {
+ convertedStr = convertedStr.replace(/数量/g, ',数量:')
+ }
+ if (convertedStr.indexOf(',批发价') != -1) {
+ convertedStr = convertedStr.replace(/,批发价/g, '批发价')
+ }
+ if (convertedStr.indexOf('批发价,') != -1) {
+ convertedStr = convertedStr.replace(/批发价,/g, '批发价')
+ }
+ if (convertedStr.indexOf('批发价::') != -1) {
+ convertedStr = convertedStr.replace(/批发价::/g, '批发价')
+ }
+ if (convertedStr.indexOf('批发价:') != -1) {
+ convertedStr = convertedStr.replace(/批发价:/g, '批发价')
+ }
+ if (convertedStr.indexOf('批发价') != -1) {
+ convertedStr = convertedStr.replace(/批发价/g, ',批发价:')
+ }
+ convertedStr = this.convertStringCorrectly(convertedStr)
+ convertedStr = this.spliceMsg(convertedStr)
+ if (convertedStr.indexOf(',') == 0) {
+
+ convertedStr = convertedStr.substr(1)
+ }
+ if (convertedStr.startsWith("号")) {
+ convertedStr = "货号" + convertedStr.substr(1);
+ }
+ this.getMsg = convertedStr
+ let regexCount = /-?\d+/g;
+ if (this.isQuantityFollowsProductCode(convertedStr) || (convertedStr.indexOf('色') == -1 && convertedStr
+ .indexOf('码') == -1)) {
+ 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, '块', '.')
+ this.voiceData.wholesalePrice = this.replaceCharAfterNumber(this
+ .voiceData.wholesalePrice, '元', '')
+ this.voiceData.wholesalePrice = this.voiceData.wholesalePrice.replace(
+ /[^0-9.]/g, '');
+ }
+ if (this.voiceData.wholesalePrice1) {
+ this.voiceData.wholesalePrice1 = this.replaceCharAfterNumber(this
+ .voiceData.wholesalePrice1, '块', '.')
+ this.voiceData.wholesalePrice1 = this.replaceCharAfterNumber(this
+ .voiceData.wholesalePrice1, '元', '')
+ 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 {
+ 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,
+ '块', '.')
+ voiceData.wholesalePrice = this.replaceCharAfterNumber(
+ voiceData.wholesalePrice, '元', '')
+ voiceData.wholesalePrice = voiceData.wholesalePrice.replace(/[^0-9.]/g, "");
+ }
+ if (voiceData.wholesalePrice1) {
+ voiceData.wholesalePrice1 = this.replaceCharAfterNumber(voiceData.wholesalePrice1,
+ '块', '.')
+ voiceData.wholesalePrice1 = this.replaceCharAfterNumber(
+ voiceData.wholesalePrice1, '元', '')
+ voiceData.wholesalePrice = voiceData.wholesalePrice1.replace(/[^0-9.]/g, "");
+ }
+ this.tui.request('/app/product/getByProductSn', "post", {
+ productSn: voiceData.productSn
+ }, false, true).then((res) => {
+ if (res.code == 200) {
+ if (res.result != '') {
+ this.voiceText = ''
+ this.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[0]),
+ stockCount: null
+ }
+ if (res1.result.stock.length > 0) {
+ for (let i = 0; i < res1.result.stock
+ .length; i++) {
+ if (res1.result.stock[i].attributeList ==
+ '{"颜色":"均色","尺码":"均码"}') {
+ console.log("进来了")
+ data = {
+ attributeList: '{"颜色":"均色","尺码":"均码"}',
+ productCount: Number(voiceData
+ .productCount[0]),
+ 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 =
+ voiceData
+ .productCount[0]
+ res.result[0].returnPrice = res
+ .result[
+ 0].wholesalePrice
+ } else {
+ res.result[0].productCount =
+ 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.voiceText = ''
+ this.voiceText1 = ''
+ this.$refs.popup.close()
+ console.log('voiceData3070', voiceData)
+ if (voiceData.productCount) {
+ let regexZCount = /\d+/g;
+ voiceData.productCount = voiceData.productCount[0].match(
+ regexZCount);
+ }
+ if (voiceData.wholesalePrice) {
+ voiceData.wholesalePrice = this.replaceCharAfterNumber(
+ voiceData.wholesalePrice, '块', '.')
+ voiceData.wholesalePrice = this.replaceCharAfterNumber(
+ voiceData.wholesalePrice, '元', '')
+ voiceData.wholesalePrice = voiceData.wholesalePrice.replace(
+ /[^0-9.]/g, "");
+ }
+ if (voiceData.wholesalePrice1) {
+ voiceData.wholesalePrice1 = this.replaceCharAfterNumber(
+ voiceData.wholesalePrice1, '块', '.')
+ voiceData.wholesalePrice1 = this.replaceCharAfterNumber(
+ voiceData.wholesalePrice1, '元', '')
+ voiceData.wholesalePrice = voiceData.wholesalePrice1.replace(
+ /[^0-9.]/g, "");
+ }
+ let data = {
+ id: voiceData.productSn,
+ productId: voiceData.productSn,
+ productCount: voiceData.productCount[0] || 0,
+ productName: voiceData.productName,
+ productSn: voiceData.productSn,
+ isNew: true,
+ 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[
+ 0]),
+ stockCount: null
+ }]
+ }
+ console.log(data)
+ let purchaseDetails = []
+ purchaseDetails.push(data)
+
+ setTimeout(ress => {
+ if (purchaseDetails.length > 0) {
+ this.carList1 = purchaseDetails
+ this.$nextTick(() => {
+ this.AiHandleData()
+ })
+
+ } else {
+ this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
+ }
+ }, 300 * i)
+
+ }
+ }
+ })
+ }
+ }
+
+ } catch (e) {
+ this.tui.request("/app/sale/buyAi", "POST", {
+ aiMsg: this.getMsg
+ }, 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 = []
+ if (res.result.data[i].productId == null) {
+ res.result.data[i].isNew = true
+ res.result.data[i].productId = res.result.data[i].productSn || res
+ .result
+ .data[i].productName
+ } else {
+ res.result.data[i].isNew = false
+ }
+ // 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: 0,
+ productNum: null
+ }
+ newList.push(data)
+ }
+
+
+ res.result.data[i].stockLogList1 = newList
+ if (newList.length > 0) {
+ newData.push(res.result.data[i])
+ }
+
+ }
+ 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("抱歉:小助手对" + this.getMsg + "的部分商品未识别,请检查识别信息是否正确")
+ }
+ }).catch((res) => {
+ this.tui.toast(res)
+ })
}
- }).catch((res) => {
- this.tui.toast(res)
- })
- },
- //编辑挂单信息
- async setOneDetail(e) {
- let that = this;
- if (this.voiceText == '') {
- this.tui.toast('识别内容不能为空')
- return
- }
- let convertedStr = this.convertChineseToArabic(this.voiceText);
- 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, '货号')
- }
- convertedStr = this.convertStringCorrectly(convertedStr)
- convertedStr = this.spliceMsg(convertedStr)
- if (convertedStr.indexOf(',') == 0) {
- convertedStr = convertedStr.substr(1)
- }
- if (convertedStr.startsWith("号")) {
- convertedStr = "货号" + convertedStr.substr(1);
- }
- this.getMsg = convertedStr
- await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", {
- questionMsg: this.getMsg
- }, false, true).then((res) => {
- if (res.code == 200) {
- this.voiceText = ''
- this.$refs.popup.close()
- let purchaseDetails = res.result.data.purchaseDetails
- let id = this.oneGoodsId
- if(purchaseDetails.length > 0){
- if(this.carList.get(id).productName == ''){
- this.carList.get(id).productName = purchaseDetails[0].productName
- }
- 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){
- this.carList.get(id).wholesalePrice = purchaseDetails[0].wholesalePrice
- this.carList.get(id).lsPrice = purchaseDetails[0].lsPrice
- }else{
- this.carList.get(id).wholesalePrice = purchaseDetails[0].purchasePrice
- this.carList.get(id).unitPrice = purchaseDetails[0].purchasePrice
- this.carList.get(id).discountAmount = purchaseDetails[0].purchasePrice
- }
-
- 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 0){
- this.carList.get(id).stockLogList.delete('{"颜色":"均色","尺码":"均码"}')
- }
- }
- this.carList.get(id).price = this.carList.get(id).productCount * this.carList.get(id).discountAmount
- })
- this.$nextTick(()=>{
- this.getAllPrice()
- this.oneGoodsId = ''
- })
- }else{
- this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
- }
-
- } else {
- uni.showModal({
- title: "提示",
- content: "抱歉:小助手对" + this.getMsg + "的部分商品未识别,请检查识别信息是否正确",
- success: function(res) {}
- })
- }
- }).catch((res) => {
- this.tui.toast(res)
- })
+ } else {
+ this.tui.request("/app/sale/buyAi", "POST", {
+ aiMsg: this.getMsg
+ }, 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 = []
+ if (res.result.data[i].productId == null) {
+ res.result.data[i].isNew = true
+ res.result.data[i].productId = res.result.data[i].productSn || res.result
+ .data[
+ i].productName
+ } else {
+ res.result.data[i].isNew = false
+ }
+ // 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: 0,
+ productNum: null
+ }
+ newList.push(data)
+ }
+
+
+ res.result.data[i].stockLogList1 = newList
+ if (newList.length > 0) {
+ newData.push(res.result.data[i])
+ }
+
+ }
+ 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("抱歉:小助手对" + this.getMsg + "的部分商品未识别,请检查识别信息是否正确")
+ }
+ }).catch((res) => {
+ this.tui.toast(res)
+ })
+ }
},
- delDefaultCate(index,value,index1){
+ //去掉空格和换行
+ trimWhitespace(str) {
+ return str.replace(/\s+/g, '');
+ },
+ //编辑挂单信息
+ 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 = 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, '货号')
+ }
+ convertedStr = this.convertStringCorrectly(convertedStr)
+ convertedStr = this.spliceMsg(convertedStr)
+ if (convertedStr.indexOf(',') == 0) {
+ convertedStr = convertedStr.substr(1)
+ }
+ if (convertedStr.startsWith("号")) {
+ convertedStr = "货号" + convertedStr.substr(1);
+ }
+ this.getMsg = convertedStr
+ let regexCount = /-?\d+/g;
+ if (this.isQuantityFollowsProductCode(convertedStr) || (convertedStr.indexOf('色') == -1 && convertedStr
+ .indexOf('码') == -1)) {
+ try {
+ console.log('convertedStr', convertedStr)
+ const regex = /货号.*?(?=货号|$)/g;
+ convertedStr = convertedStr.match(regex);
+ for (let i = 0; i < convertedStr.length; i++) {
+ let voiceData = this.extractInfo(convertedStr[i] + '。')
+ console.log('voiceData', voiceData)
+ 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, '块',
+ '.')
+ voiceData.wholesalePrice = this.replaceCharAfterNumber(
+ voiceData.wholesalePrice, '元', '')
+ voiceData.wholesalePrice = voiceData.wholesalePrice.replace(/[^0-9.]/g, "");
+ }
+ if (voiceData.wholesalePrice1) {
+ voiceData.wholesalePrice1 = this.replaceCharAfterNumber(voiceData.wholesalePrice1, '块',
+ '.')
+ voiceData.wholesalePrice1 = this.replaceCharAfterNumber(
+ voiceData.wholesalePrice1, '元', '')
+ voiceData.wholesalePrice = voiceData.wholesalePrice1.replace(/[^0-9.]/g, "");
+ }
+ this.tui.request('/app/product/getByProductSn', "post", {
+ productSn: voiceData.productSn
+ }, false, true).then((res) => {
+ if (res.code == 200) {
+ if (res.result != '') {
+ this.voiceText = ''
+ this.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),
+ stockCount: null
+ }
+ if (res1.result.stock.length > 0) {
+ for (let i = 0; i < res1.result.stock
+ .length; i++) {
+ if (res1.result.stock[i].attributeList ==
+ '{"颜色":"均色","尺码":"均码"}') {
+ console.log("进来了")
+ data = {
+ attributeList: '{"颜色":"均色","尺码":"均码"}',
+ productCount: Number(voiceData
+ .productCount),
+ 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) {
+
+ console.log('this.carList', this
+ .carList)
+ 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 =
+ purchaseDetails[
+ 0]
+ .productCount
+ this.carList.get(
+ id)
+ .returnPrice =
+ purchaseDetails[
+ 0]
+ .wholesalePrice
+ } else {
+ this.carList.get(
+ id)
+ .productCount =
+ purchaseDetails[
+ 0]
+ .productCount
+ }
+
+ }
+ if (purchaseDetails[0]
+ .wholesalePrice) {
+ this.carList.get(id)
+ .discountAmount =
+ 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
+ }
+ console.log('this.carList',
+ this.carList)
+ console.log(
+ 'purchaseDetails3450',
+ purchaseDetails)
+ 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 +=
+ 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 +=
+ purchaseDetails[j]
+ .stockLogList1[i]
+ .productCount
+ }
+ }
+ if (this.carList.get(id)
+ .stockLogList.get(
+ '{"颜色":"均色","尺码":"均码"}')
+ .productCount == 0 &&
+ purchaseDetails[0]
+ .stockLogList1.length > 0) {
+ this.carList.get(id)
+ .stockLogList.delete(
+ '{"颜色":"均色","尺码":"均码"}'
+ )
+ }
+ this.carList.get(id).price = 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)
+ .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).lsPrice =
+ purchaseDetails[0].price
+ this.carList.get(id).price =
+ purchaseDetails[0]
+ .wholesalePrice * this
+ .carList.get(id)
+ .productCount
+
+ } 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 * 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
+ .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 +=
+ 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 +=
+ purchaseDetails[
+ j]
+ .stockLogList1[
+ i]
+ .productCount
+ }
+
+ }
+ }
+ this.carList.get(id)
+ .price = this
+ .carList.get(id)
+ .productCount *
+ this.carList.get(
+ id)
+ .wholesalePrice
+ if (this.carList.get(
+ id)
+ .stockLogList.get(
+ '{"颜色":"均色","尺码":"均码"}'
+ )
+ .productCount ==
+ 0 &&
+ purchaseDetails[0]
+ .stockLogList1
+ .length > 0) {
+ this.carList.get(
+ id)
+ .stockLogList
+ .delete(
+ '{"颜色":"均色","尺码":"均码"}'
+ )
+ }
+ })
+ }
+
+ this.$nextTick(() => {
+ this.getAllPrice()
+ this.oneGoodsId = ''
+ })
+ } else {
+ this.tui.toast(
+ "抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
+ }
+ }, 500)
+ } else {
+ this.tui.toast(res1.message)
+ }
+ }).catch((res) => {})
+
+
+ } else {
+ this.voiceText = ''
+ this.voiceText1 = ''
+ this.$refs.popup.close()
+ console.log('voiceData3070', voiceData)
+ if (voiceData.productCount) {
+ let regexZCount = /\d+/g;
+ voiceData.productCount = voiceData.productCount[0].match(
+ regexZCount);
+ }
+ if (voiceData.wholesalePrice) {
+ voiceData.wholesalePrice = this.replaceCharAfterNumber(voiceData
+ .wholesalePrice, '块', '.')
+ this.voiceData.wholesalePrice = this.replaceCharAfterNumber(this
+ .voiceData.wholesalePrice, '元', '')
+ voiceData.wholesalePrice = voiceData.wholesalePrice.replace(
+ /[^0-9.]/g, "");
+ }
+ if (voiceData.wholesalePrice1) {
+ voiceData.wholesalePrice1 = this.replaceCharAfterNumber(voiceData
+ .wholesalePrice1, '块', '.')
+ voiceData.wholesalePrice1 = this.replaceCharAfterNumber(
+ voiceData.wholesalePrice1, '元', '')
+ voiceData.wholesalePrice = voiceData.wholesalePrice1.replace(
+ /[^0-9.]/g, "");
+ }
+ let data = {
+ id: voiceData.productSn,
+ productCount: voiceData.productCount || 0,
+ productName: voiceData.productName,
+ productSn: voiceData.productSn,
+ 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),
+ stockCount: null
+ }]
+ }
+ console.log(data)
+ 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++) {
+ 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
+ }
+ if (this.carList.get(id).productCount == '') {
+ this.carList.get(id).productCount =
+ purchaseDetails[0].productCount
+ }
+ if (this.carList.get(id).discountAmount == '') {
+ this.carList.get(id).discountAmount =
+ 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
+ }
+ 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 +=
+ 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 += purchaseDetails[j]
+ .stockLogList1[i].productCount
+ }
+ }
+ if (this.carList.get(id).stockLogList.get(
+ '{"颜色":"均色","尺码":"均码"}').productCount == 0 &&
+ purchaseDetails[0].stockLogList1.length > 0) {
+ this.carList.get(id).stockLogList.delete(
+ '{"颜色":"均色","尺码":"均码"}')
+ }
+ this.carList.get(id).price = 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
+ }
+ 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 * purchaseDetails[0].productCount
+ let specMap = new Map() //新的临时存放值那个更改过的值的map
+ this.$nextTick(() => {
+ this.carList.forEach(function(value, key) {
+ if (key != value.id) {
+ specMap.set(value.id, value)
+ } else {
+ specMap.set(key, value)
+ }
+ })
+ this.carList = specMap
+ })
+ this.$nextTick(() => {
+ for (let j = 0; j < purchaseDetails.length; j++) {
+ for (let i = 0; i < purchaseDetails[j]
+ .stockLogList1.length; i++) {
+ purchaseDetails[j].stockLogList1[i].name =
+ this.sliceMsg(purchaseDetails[j]
+ .stockLogList1[i].attributeList)
+ if (this.carList.get(id).stockLogList
+ .size == 0) {
+ this.carList.get(id).stockLogList.set(
+ purchaseDetails[j]
+ .stockLogList1[i]
+ .attributeList,
+ purchaseDetails[j]
+ .stockLogList1[i])
+ } else {
+ if (this.carList.get(id).stockLogList
+ .has(purchaseDetails[j]
+ .stockLogList1[i].attributeList
+ ) == true) {
+ this.carList.get(id).stockLogList
+ .get(purchaseDetails[j]
+ .stockLogList1[i]
+ .attributeList)
+ .productCount +=
+ 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 +=
+ purchaseDetails[j].stockLogList1[i]
+ .productCount
+ }
+ }
+ this.carList.get(id).price = this.carList.get(id)
+ .productCount * this.carList.get(id)
+ .wholesalePrice
+ if (this.carList.get(id).stockLogList.get(
+ '{"颜色":"均色","尺码":"均码"}').productCount ==
+ 0 && purchaseDetails[0].stockLogList1.length >
+ 0) {
+ this.carList.get(id).stockLogList.delete(
+ '{"颜色":"均色","尺码":"均码"}')
+ }
+ })
+ }
+
+ this.$nextTick(() => {
+ this.getAllPrice()
+ this.oneGoodsId = ''
+ })
+ } else {
+ this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
+ }
+
+ }
+ }
+ })
+ }
+
+ } catch (e) {
+ await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", {
+ 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
+ let id = this.oneGoodsId
+ if (purchaseDetails.length > 0) {
+ if (this.carList.get(id).productName == '') {
+ this.carList.get(id).productName = purchaseDetails[0].productName
+ }
+ 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) {
+ this.carList.get(id).wholesalePrice = purchaseDetails[0].wholesalePrice
+ this.carList.get(id).lsPrice = purchaseDetails[0].lsPrice
+ } else {
+ this.carList.get(id).wholesalePrice = purchaseDetails[0].wholesalePrice
+ this.carList.get(id).unitPrice = purchaseDetails[0].wholesalePrice
+ this.carList.get(id).discountAmount = purchaseDetails[0].wholesalePrice
+ }
+
+ let specMap = new Map() //新的临时存放值那个更改过的值的map
+ this.$nextTick(() => {
+ this.carList.forEach(function(value, key) {
+ if (key != value.id) {
+ specMap.set(value.id, value)
+ } else {
+ specMap.set(key, value)
+ }
+ })
+ this.carList = specMap
+ })
+ this.$nextTick(() => {
+ for (let 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 {
+ 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 +=
+ Number(purchaseDetails[0].stockLogList1[i]
+ .productCount)
+ } else {
+ this.carList.get(id).stockLogList.set(
+ purchaseDetails[0].stockLogList1[i]
+ .attributeList, purchaseDetails[0]
+ .stockLogList1[i])
+ }
+ }
+ this.carList.get(id).productCount += Number(
+ purchaseDetails[0].stockLogList1[i].productCount)
+ if (this.carList.get(id).stockLogList.get(
+ '{"颜色":"均色","尺码":"均码"}').productCount == 0 &&
+ purchaseDetails[0].stockLogList1.length > 0) {
+ this.carList.get(id).stockLogList.delete(
+ '{"颜色":"均色","尺码":"均码"}')
+ }
+ }
+ this.carList.get(id).price = this.carList.get(id)
+ .productCount * this.carList.get(id).discountAmount
+ })
+ this.$nextTick(() => {
+ this.getAllPrice()
+ this.oneGoodsId = ''
+ })
+ } else {
+ this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
+ }
+
+ } else {
+ uni.showModal({
+ title: "提示",
+ content: "抱歉:小助手对" + this.getMsg + "的部分商品未识别,请检查识别信息是否正确",
+ success: function(res) {}
+ })
+ }
+ }).catch((res) => {
+ this.tui.toast(res)
+ })
+ }
+ } else {
+ await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", {
+ 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
+ let id = this.oneGoodsId
+ if (purchaseDetails.length > 0) {
+ if (this.carList.get(id).productName == '') {
+ this.carList.get(id).productName = purchaseDetails[0].productName
+ }
+ 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) {
+ this.carList.get(id).wholesalePrice = purchaseDetails[0].wholesalePrice
+ this.carList.get(id).lsPrice = purchaseDetails[0].lsPrice
+ } else {
+ this.carList.get(id).wholesalePrice = purchaseDetails[0].wholesalePrice
+ this.carList.get(id).unitPrice = purchaseDetails[0].wholesalePrice
+ this.carList.get(id).discountAmount = purchaseDetails[0].wholesalePrice
+ }
+
+ let specMap = new Map() //新的临时存放值那个更改过的值的map
+ this.$nextTick(() => {
+ this.carList.forEach(function(value, key) {
+ if (key != value.id) {
+ specMap.set(value.id, value)
+ } else {
+ specMap.set(key, value)
+ }
+ })
+ this.carList = specMap
+ })
+ this.$nextTick(() => {
+ for (let 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 {
+ 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 +=
+ Number(purchaseDetails[0].stockLogList1[i]
+ .productCount)
+ } else {
+ this.carList.get(id).stockLogList.set(purchaseDetails[
+ 0].stockLogList1[i].attributeList,
+ purchaseDetails[0].stockLogList1[i])
+ }
+ }
+ this.carList.get(id).productCount += Number(purchaseDetails[0]
+ .stockLogList1[i].productCount)
+ if (this.carList.get(id).stockLogList.get(
+ '{"颜色":"均色","尺码":"均码"}')) {
+ if (this.carList.get(id).stockLogList.get(
+ '{"颜色":"均色","尺码":"均码"}').productCount == 0 &&
+ purchaseDetails[0].stockLogList1.length > 0) {
+ this.carList.get(id).stockLogList.delete(
+ '{"颜色":"均色","尺码":"均码"}')
+ }
+ }
+
+ }
+ this.carList.get(id).price = this.carList.get(id).productCount *
+ this.carList.get(id).discountAmount
+ })
+ this.$nextTick(() => {
+ this.getAllPrice()
+ this.oneGoodsId = ''
+ })
+ } else {
+ this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
+ }
+
+ } else {
+ uni.showModal({
+ title: "提示",
+ content: "抱歉:小助手对" + this.getMsg + "的部分商品未识别,请检查识别信息是否正确",
+ success: function(res) {}
+ })
+ }
+ }).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", {
@@ -2976,14 +4754,325 @@
})
}
})
- },
- //编辑每一个的单价
- clickCollapse(e, id) {
- 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 = this.carList.get(id).productCount * this.carList.get(id).discountAmount
- this.getAllPrice()
+ },
+ //编辑每一个的单价
+ clickCollapse(e, id) {
+ 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 = 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)
+ // },
+ async getOneData(oneData, type) {
+ console.log('oneData4666', oneData)
+ this.tui.request('/app/product/getShareList', "post", {
+ categoryId: "",
+ pageNum: 1,
+ pageSize: '10',
+ searchStr: oneData.productSn
+ }, false, false).then((res) => {
+ if (res.code == 200) {
+ if (res.result.records != '') {
+ if (res.result.records.length > 1) {
+
+
+ for (let i = 0; i < res.result.records.length; i++) {
+ if (oneData.wholesalePrice) {
+ res.result.records[i].wholesalePrice = oneData.wholesalePrice
+ res.result.records[i].unitPrice = oneData.wholesalePrice
+ res.result.records[i].discountAmount = oneData.wholesalePrice
+
+ }
+ res.result.records[i].productCount = oneData.productCount[0]
+ }
+ this.$nextTick(() => {
+ this.moreData.push(res.result.records)
+ this.oneData = oneData
+ })
+
+ } else {
+ this.voiceText = ''
+ this.voiceText1 = ''
+ this.$refs.popup.close();
+ // this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId",
+ // "POST", {
+ // categoryId: res.result.records[0].attrId
+ // }, false, true).then((res1) => {
+ // if (res1.code == 200) {
+ let data = {
+ attributeList: '{"颜色":"均色","尺码":"均码"}',
+ productCount: Number(oneData.productCount[0]),
+ stockCount: res.result.records[0].defaultStockCount
+ }
+ // if (res1.result.stock.length > 0) {
+ // for (let i = 0; i < res1.result.stock.length; i++) {
+ // if (res1.result.stock[i].attributeList ==
+ // '{"颜色":"均色","尺码":"均码"}') {
+ // console.log("进来了")
+ // data.stockCount = res1.result.stock[i].stockCount
+
+ // }
+ // }
+ // } else {
+
+ // }
+
+ 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
+ }
+ // if(res.result[0].productCount == '' || ){
+ // if(voiceData.productCount < 0){
+ // res.result[0].returnCount = voiceData.productCount
+ // res.result[0].returnPrice = voiceData.wholesalePrice
+ // }else{
+ // res.result[0].productCount = voiceData.productCount
+ // }
+ // }
+ let purchaseDetails = res.result.records
+
+ let id = this.oneGoodsId
+ console.log('purchaseDetails4693', purchaseDetails)
+ if (purchaseDetails.length > 0) {
+ this.carList1 = purchaseDetails
+ // this.$nextTick(() => {
+ this.AiHandleData()
+ // })
+
+ } else {
+ this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
+ }
+ }, 300)
+ // } else {
+ // this.tui.toast(res1.message)
+ // }
+ // }).catch((res) => {})
+ }
+
+
+
+ } else {
+ this.voiceText = ''
+ this.voiceText1 = ''
+ this.$refs.popup.close()
+ console.log('oneData3070', oneData)
+ if (oneData.productCount) {
+ let regexZCount = /\d+/g;
+ oneData.productCount = oneData.productCount[0].match(regexZCount);
+ }
+ if (oneData.wholesalePrice) {
+ oneData.wholesalePrice = this.replaceCharAfterNumber(oneData.wholesalePrice,
+ '块', '.')
+ this.voiceData.wholesalePrice = this.replaceCharAfterNumber(this
+ .voiceData.wholesalePrice, '元', '')
+ oneData.wholesalePrice = oneData.wholesalePrice.replace(/[^0-9.]/g, "");
+ }
+ if (oneData.wholesalePrice1) {
+ oneData.wholesalePrice1 = this.replaceCharAfterNumber(oneData.wholesalePrice1,
+ '块', '.')
+ oneData.wholesalePrice1 = this.replaceCharAfterNumber(
+ oneData.wholesalePrice1, '元', '')
+ oneData.wholesalePrice = oneData.wholesalePrice1.replace(/[^0-9.]/g, "");
+ }
+ let data = {
+ id: oneData.productSn,
+ productId: oneData.productSn,
+ productCount: oneData.productCount[0] || 0,
+ productName: oneData.productName,
+ productSn: oneData.productSn,
+ isNew: true,
+ categoryId: this.fenleiList.categoryId,
+ categoryName: this.fenleiList.categoryName,
+ unitPrice: oneData.wholesalePrice || 0,
+ discountAmount: oneData.wholesalePrice || 0,
+ wholesalePrice: oneData.wholesalePrice || 0,
+ stockLogList1: [{
+ attributeList: '{"颜色":"均色","尺码":"均码"}',
+ productCount: Number(oneData.productCount[0]),
+ stockCount: null
+ }]
+ }
+ console.log(data)
+ let purchaseDetails = []
+ purchaseDetails.push(data)
+
+ setTimeout(ress => {
+ if (purchaseDetails.length > 0) {
+ this.carList1 = purchaseDetails
+ this.AiHandleData()
+
+ } else {
+ this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
+ }
+ }, 500)
+
+ }
+ setTimeout(res => {
+ if (type == true && this.moreData.length > 0) {
+ this.$refs.popup.close()
+ this.$refs.oneDataPopup.open()
+ this.showPopup(0)
+ }
+ }, 300)
+
+ }
+ })
+ // this.$nextTick(()=>{
+ // console.log('moreData', this.moreData)
+ // if (type == true && this.moreData.length > 0) {
+ // this.$refs.popup.close()
+ // this.$refs.oneDataPopup.open()
+ // this.showPopup(0)
+ // }
+ // })
+
+ },
+ showPopup(index) {
+ this.currentPopupIndex = index;
+ this.showTan = true;
+ },
+ clickGetOne(item) {
+ console.log('选择了:', item);
+
+ // 如果还有下一个弹出层,则显示下一个
+ if (this.currentPopupIndex + 1 < this.moreData.length) {
+ this.showTan = false; // 先关闭当前弹出层
+ this.voiceText = ''
+ this.voiceText1 = ''
+ this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId",
+ "POST", {
+ categoryId: item.attrId
+ }, false, true).then((res1) => {
+ if (res1.code == 200) {
+ let data = {
+ attributeList: '{"颜色":"均色","尺码":"均码"}',
+ productCount: Number(item.productCount),
+ stockCount: null
+ }
+ if (res1.result.stock.length > 0) {
+ for (let i = 0; i < res1.result.stock.length; i++) {
+ if (res1.result.stock[i].attributeList ==
+ '{"颜色":"均色","尺码":"均码"}') {
+ console.log("进来了")
+ data.stockCount = res1.result.stock[i].stockCount
+
+ }
+ }
+ } else {
+
+ }
+
+ this.$nextTick(() => {
+ item.productId = item.id
+ item.stockLogList1 = []
+ item.stockLogList1.push(data)
+
+ // if(res.result[0].productCount == '' || ){
+ // if(voiceData.productCount < 0){
+ // res.result[0].returnCount = voiceData.productCount
+ // res.result[0].returnPrice = voiceData.wholesalePrice
+ // }else{
+ // res.result[0].productCount = voiceData.productCount
+ // }
+ // }
+ let purchaseDetails = item
+
+ let id = this.oneGoodsId
+ console.log('purchaseDetails4827', purchaseDetails)
+ if (purchaseDetails) {
+ this.carList1.push(purchaseDetails)
+ this.$nextTick(() => {
+ this.AiHandleData()
+ })
+
+ } else {
+ this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
+ }
+ })
+ } else {
+ this.tui.toast(res1.message)
+ }
+ }).catch((res) => {})
+ setTimeout(() => {
+ this.showTan = true; // 再显示下一个弹出层
+ this.currentPopupIndex += 1;
+ }, 0);
+ } else {
+ this.showTan = false; // 如果没有更多弹出层,则关闭最后一个弹出层
+ this.voiceText = ''
+ this.voiceText1 = ''
+ this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId",
+ "POST", {
+ categoryId: item.attrId
+ }, false, true).then((res1) => {
+ if (res1.code == 200) {
+ let data = {
+ attributeList: '{"颜色":"均色","尺码":"均码"}',
+ productCount: Number(item.productCount),
+ stockCount: null
+ }
+ if (res1.result.stock.length > 0) {
+ for (let i = 0; i < res1.result.stock.length; i++) {
+ if (res1.result.stock[i].attributeList ==
+ '{"颜色":"均色","尺码":"均码"}') {
+ console.log("进来了")
+ data.stockCount = res1.result.stock[i].stockCount
+
+ }
+ }
+ } else {
+
+ }
+
+ this.$nextTick(() => {
+ item.productId = item.id
+ item.stockLogList1 = []
+ item.stockLogList1.push(data)
+
+ // if(res.result[0].productCount == '' || ){
+ // if(voiceData.productCount < 0){
+ // res.result[0].returnCount = voiceData.productCount
+ // res.result[0].returnPrice = voiceData.wholesalePrice
+ // }else{
+ // res.result[0].productCount = voiceData.productCount
+ // }
+ // }
+ let purchaseDetails = item
+
+ let id = this.oneGoodsId
+ console.log('purchaseDetails4888', purchaseDetails)
+ if (purchaseDetails) {
+ this.moreData = []
+ this.carList1.push(purchaseDetails)
+ this.$nextTick(() => {
+ this.AiHandleData()
+ })
+
+ } else {
+ this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确")
+ }
+ })
+ } else {
+ this.tui.toast(res1.message)
+ }
+ }).catch((res) => {})
+ }
},
//弹出商品规格选择
toggle(type, id) {
@@ -2999,252 +5088,269 @@
this.getGategoryList()
this.$refs.typePopup.open()
} else if (type == 'oneGoods') {
- this.oneGoodsId = id
- this.initRecord();
- this.voiceText = ''
+ this.oneGoodsId = id
+ this.initRecord();
+ this.voiceText = ''
+ this.voiceText1 = ''
this.$refs.popup.open('center')
} else {
this.initRecord();
this.voiceText = ''
+ this.voiceText1 = ''
this.$refs.popup.open(type)
}
- },
- getName(e, id) {
- this.carList.get(id).productName = e.detail.value
- },
- sninput(e ,id){
- 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){
- await this.tui.request("/app/productSn/getNewProductSn", "POST", {
- snPre: value
- }, false, true).then((res) => {
- if (res.code == 200) {
- this.carList.get(this.oneGoodsId).productSn = res.result
- this.$forceUpdate()
- } else {
- this.tui.toast(res.message)
- }
- }).catch((res) => {})
- await this.$nextTick(()=>{
- this.oneGoodsId = ''
- this.numRule = ''
- this.prefixRule = ''
- })
- this.$refs.SNDialog.close()
- },
- clickGategroy(item) {
- this.carList.get(this.productId).categoryName = item.categoryName
- this.carList.get(this.productId).categoryId = item.id
- this.$forceUpdate()
- this.$refs.typePopup.close()
- },
- uploadFilePromise(value) {
- let that = this;
- uni.chooseMedia({
- count: 1,
- mediaType: ['image'],
- sourceType: ['album', 'camera'],
- camera: 'back',
- success(res) {
- uni.uploadFile({
- url: that.tui.interfaceUrl() +'/upload/file',
- filePath: res.tempFiles[0].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
- },
- pictureAdd(id,huan) {
- let that = this
- uni.showLoading({
- title: '加载中...',
- mask:true
- })
- if(id != ''){ //上传多图
- this.childrenId = id
- if(this.carList.get(id).productPictures.length > 0 && huan !='huan'){
- this.productPictures = this.carList.get(id).productPictures
- this.$refs.showImgDiaLog.open()
- uni.hideLoading();
- return;
- }else if(huan == 'huan'){
- this.$refs.showImgDiaLog.close()
- }
- }else{
- this.childrenId = ''
- }
- uni.chooseMedia({
- count: 9,
- mediaType: ['image'],
- sourceType: ['album'],
- success(res) {
- if(that.childrenId !=''){
- that.carList.get(that.childrenId).productPictures = []
- }
- for(let i=0;i {
- 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) => {})
+ },
+ getName(e, id) {
+ this.carList.get(id).productName = e.detail.value
+ },
+ sninput(e, id) {
+ 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) {
+ await this.tui.request("/app/productSn/getNewProductSn", "POST", {
+ snPre: value
+ }, false, true).then((res) => {
+ if (res.code == 200) {
+ this.carList.get(this.oneGoodsId).productSn = res.result
+ this.$forceUpdate()
+ } else {
+ this.tui.toast(res.message)
+ }
+ }).catch((res) => {})
+ await this.$nextTick(() => {
+ this.oneGoodsId = ''
+ this.numRule = ''
+ this.prefixRule = ''
+ })
+ this.$refs.SNDialog.close()
+ },
+ 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.uploadFile({
+ url: that.tui.interfaceUrl() + '/upload/file',
+ filePath: res.tempFiles[0].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) {
+ console.log(path)
+ let paths = []
+ paths.push(path)
+ uni.previewImage({
+ urls: paths
+ });
+ },
+ pictureAdd(id, huan) {
+ let that = this
+ uni.showLoading({
+ title: '加载中...',
+ mask: true
+ })
+ if (id != '') { //上传多图
+ this.childrenId = id
+ if (this.carList.get(id).productPictures.length > 0 && huan != 'huan') {
+ this.productPictures = this.carList.get(id).productPictures
+ this.$refs.showImgDiaLog.open()
+ uni.hideLoading();
+ return;
+ } else if (huan == 'huan') {
+ this.$refs.showImgDiaLog.close()
+ }
+ } else {
+ this.childrenId = ''
+ }
+ uni.chooseMedia({
+ count: 9,
+ mediaType: ['image'],
+ sourceType: ['album'],
+ success(res) {
+ if (that.childrenId != '') {
+ that.carList.get(that.childrenId).productPictures = []
+ }
+ for (let i = 0; i < res.tempFiles.length; i++) {
+ that.upLoadFile(res.tempFiles[i].tempFilePath, i + 1)
+ }
+ },
+ fail(err) {
+ uni.hideLoading();
+ }
+ })
+ uni.hideLoading();
+ },
+ async upLoadFile(path, time) {
+ let that = this;
+ let hiver_token = uni.getStorageSync("hiver_token")
+ await uni.uploadFile({
+ url: that.tui.interfaceUrl() + '/upload/file',
+ filePath: path,
+ 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) {
@@ -3256,15 +5362,15 @@
this.priceType = e
that.priceCurrent = index
await this.carList.forEach(function(value, key) {
- that.index = value.productId || value.id
- if(value.isNew != true){
- if (e == '0') { //零售
- value.discountAmount = value.lsprice
- value.returnPrice= value.lsprice
- } else { //批发
- value.discountAmount = value.wholesalePrice
- value.returnPrice= value.wholesalePrice
- }
+ that.index = value.productId || value.id
+ if (value.isNew != true) {
+ if (e == '0') { //零售
+ value.discountAmount = value.lsprice
+ value.returnPrice = value.lsprice
+ } else { //批发
+ value.discountAmount = value.wholesalePrice
+ value.returnPrice = value.wholesalePrice
+ }
}
})
// await this.getAllPrice()
@@ -3275,7 +5381,7 @@
this.$forceUpdate()
},
//商品上选择是零售价还是批发价
- checkPay(price,returnPrice) {
+ checkPay(price, returnPrice) {
if (price == undefined || price == null) {
this.tui.toast("暂无拿货记录")
@@ -3284,9 +5390,9 @@
let that = this;
let num = this.carList.get(this.index)
- num.discountAmount = price
- if(returnPrice != ''){
- num.returnPrice = returnPrice
+ num.discountAmount = price
+ if (returnPrice != '') {
+ num.returnPrice = returnPrice
}
num.unitPrice = price;
num.price = price * num.productCount;
@@ -3298,8 +5404,8 @@
that.relPrice = that.shouldPay
that.priceOk = that.shouldPay
// this.getAllPrice()
- this.getAmountAndWho()
- this.customPrice = ''
+ this.getAmountAndWho()
+ this.customPrice = ''
this.returnPrice = ''
},
//整体选择时使用批发价、零售价,选择整体折扣的方法
@@ -3318,8 +5424,8 @@
price = value.wholesalePrice
}
}
- if(value.isNew != true){
- value.unitPrice = price;
+ if (value.isNew != true) {
+ value.unitPrice = price;
}
if (that.discountType == 1) { //整体折扣
value.discountAmount = value.unitPrice * (that.discountNum / 10)
@@ -3342,138 +5448,139 @@
// that.noPay = this.relPrice - this.priceOk
// }
},
- AiAddSpec(value,current) {
- this.getById(value,current);
+ AiAddSpec(value, current) {
+ this.getById(value, current);
},
//通过商品id查询商品详细信息
- async getById(id,current) {
- let that = this;
- //判断isNew,新商品直接调店铺颜色库
- if(current == 1){
- that.goodsDetail = id;
- that.goodsDetail.attributeList = []
- if(this.goodsDetail.isNew){
- this.goodsList = []
- that.goodsDetail.attributeList = this.defaultList
- for (var i = 0; i < that.goodsDetail.attributeList.length; i++) {
- for (var m = 0; m < that.goodsDetail.attributeList[i].value.length; m++) {
- that.dataObj.set(that.goodsDetail.attributeList[i].value[m].value,that.goodsDetail.attributeList[i].name)
- }
- let specs1 = {
- specs: []
- }
- that.goodsList.push(specs1)
- }
- this.$refs.shopPopup.open('bottom')
- }else{
- that.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId",
- "POST", {
- categoryId: that.goodsDetail.attrId
- }, false, true).then((res1) => {
- if (res1.code == 200) {
- that.goodsList = []
- if (typeof(res1.result.attributeAndValue) == 'string') {
- let newObj = JSON.parse(res1.result.attributeAndValue)
- let newArr = []
- let dataArr = []
- for (let val in newObj) {
- let valueObj = [];
- for (var i = 0; i < newObj[val].length; i++) {
- valueObj.push({
- value: newObj[val][i],
- isChecked: false
- })
- that.dataObj.set(newObj[val][i], val)
- }
- newArr.push({
- name: val,
- value: valueObj
- })
- }
- that.goodsDetail.attributeList = newArr;
- for (var i = 0; i < that.goodsDetail.attributeList.length; i++) {
- let specs1 = {
- specs: []
- }
- that.goodsList.push(specs1)
- }
- } else {
- that.tui.toast('失败了')
- }
- that.getKCList(res1.result.stock);
- } else {
- that.tui.toast(res1.message)
- }
- }).catch((res) => {})
- }
- this.pageOldTemList = []
- that.temporaryList = []
- if (that.carList.size > 0) {
- let isArgin = false
- 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: 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: values.productCount,
- name: values.name,
- attributeList: keys,
- productNum: values.productNum
- }
- value.stockLogList1.push(obj)
- }
- }
- }
- }
-
- })
-
- if (value.productId == id) {
- that.zNum = 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 = value.productCount
- that.temporaryList = value.stockLogList1
- that.pageOldTemList = value.stockLogList1
- that.oldTemList = value.stockLogList1
- isArgin = true
- }
- } else {
- if (value.productId == id.productId) {
- that.zNum = value.productCount
- that.temporaryList = value.stockLogList1
- that.pageOldTemList = value.stockLogList1
- that.oldTemList = value.stockLogList1
- isArgin = true
- }
- }
-
- }
- value.stockLogList1 = []
-
- }
-
- })
- that.zNum = 0
- }
- }else{
+ async getById(id, current) {
+ let that = this;
+ //判断isNew,新商品直接调店铺颜色库
+ if (current == 1) {
+ that.goodsDetail = id;
+ that.goodsDetail.attributeList = []
+ if (this.goodsDetail.isNew) {
+ this.goodsList = []
+ that.goodsDetail.attributeList = this.defaultList
+ for (var i = 0; i < that.goodsDetail.attributeList.length; i++) {
+ for (var m = 0; m < that.goodsDetail.attributeList[i].value.length; m++) {
+ that.dataObj.set(that.goodsDetail.attributeList[i].value[m].value, that.goodsDetail
+ .attributeList[i].name)
+ }
+ let specs1 = {
+ specs: []
+ }
+ that.goodsList.push(specs1)
+ }
+ this.$refs.shopPopup.open('bottom')
+ } else {
+ that.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId",
+ "POST", {
+ categoryId: that.goodsDetail.attrId
+ }, false, true).then((res1) => {
+ if (res1.code == 200) {
+ that.goodsList = []
+ if (typeof(res1.result.attributeAndValue) == 'string') {
+ let newObj = JSON.parse(res1.result.attributeAndValue)
+ let newArr = []
+ let dataArr = []
+ for (let val in newObj) {
+ let valueObj = [];
+ for (var i = 0; i < newObj[val].length; i++) {
+ valueObj.push({
+ value: newObj[val][i],
+ isChecked: false
+ })
+ that.dataObj.set(newObj[val][i], val)
+ }
+ newArr.push({
+ name: val,
+ value: valueObj
+ })
+ }
+ that.goodsDetail.attributeList = newArr;
+ for (var i = 0; i < that.goodsDetail.attributeList.length; i++) {
+ let specs1 = {
+ specs: []
+ }
+ that.goodsList.push(specs1)
+ }
+ } else {
+ that.tui.toast('失败了')
+ }
+ that.getKCList(res1.result.stock);
+ } else {
+ that.tui.toast(res1.message)
+ }
+ }).catch((res) => {})
+ }
+ this.pageOldTemList = []
+ that.temporaryList = []
+ if (that.carList.size > 0) {
+ let isArgin = false
+ 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: 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: values.productCount,
+ name: values.name,
+ attributeList: keys,
+ productNum: values.productNum
+ }
+ value.stockLogList1.push(obj)
+ }
+ }
+ }
+ }
+
+ })
+
+ if (value.productId == id) {
+ that.zNum = 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 = value.productCount
+ that.temporaryList = value.stockLogList1
+ that.pageOldTemList = value.stockLogList1
+ that.oldTemList = value.stockLogList1
+ isArgin = true
+ }
+ } else {
+ if (value.productId == id.productId) {
+ that.zNum = 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, "POST", {}, false, true).then((res) => {
if (res.code == 200) {
@@ -3482,7 +5589,7 @@
return
}
that.goodsDetail = res.result;
- that.temporaryList = []
+ that.temporaryList = []
this.pageOldTemList = []
if (that.carList.size > 0) {
that.carList.forEach(function(value, key) {
@@ -3496,11 +5603,15 @@
}
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)) {
+ for (var i = 0; i < value.stockLogList1
+ .length; i++) {
+ if (value.stockLogList1[i].attributeList !=
+ keys) {
+ if (value.stockLogList1.length == (i +
+ 1)) {
let obj = {
- productCount: values.productCount,
+ productCount: values
+ .productCount,
name: values.name,
attributeList: keys,
productNum: values.productNum
@@ -3525,73 +5636,82 @@
})
})
}
- that.$nextTick(() => {
- this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId", "POST", {
- categoryId: this.goodsDetail.attrId
- }, false, true).then((res1) => {
- if (res1.code == 200) {
- this.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
- })
- this.dataObj.set(newObj[val][i], val)
- }
- newArr.push({
- name: val,
- value: valueObj
- })
- }
- this.goodsDetail.attributeList = newArr;
- for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
- let oldCheck = false
- let oldValue = []
- for (var m = 0; m < this.goodsDetail.attributeList[i].value
- .length; m++) {
- if (this.goodsDetail.attributeList[i].value[m].isChecked ==
- true) {
- oldCheck = true
- oldValue.push(this.goodsDetail.attributeList[i].value[
- m].value)
- }
- }
- let specs1 = {
- specs: []
- }
- this.goodsList.push(specs1)
- oldCheck = false
- oldValue = []
- }
- if(this.temporaryList == ''){
- this.attrNameChange(0,that.goodsDetail.attributeList[0].value[0].value,0)
- }
- } else {
- this.tui.toast('失败了')
- }
- this.getKCList(res1.result.stock)
- } else {
- this.tui.toast(res1.message)
- }
+ that.$nextTick(() => {
+ this.tui.request(
+ "/app/productAttribute/selectAttributeAndValueByCategoryId",
+ "POST", {
+ categoryId: this.goodsDetail.attrId
+ }, false, true).then((res1) => {
+ if (res1.code == 200) {
+ this.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
+ })
+ this.dataObj.set(newObj[val][i], val)
+ }
+ newArr.push({
+ name: val,
+ value: valueObj
+ })
+ }
+ this.goodsDetail.attributeList = newArr;
+ for (var i = 0; i < this.goodsDetail.attributeList
+ .length; i++) {
+ let oldCheck = false
+ let oldValue = []
+ for (var m = 0; m < this.goodsDetail
+ .attributeList[i].value
+ .length; m++) {
+ if (this.goodsDetail.attributeList[i]
+ .value[m].isChecked ==
+ true) {
+ oldCheck = true
+ oldValue.push(this.goodsDetail
+ .attributeList[i].value[
+ m].value)
+ }
+ }
+ let specs1 = {
+ specs: []
+ }
+ this.goodsList.push(specs1)
+ oldCheck = false
+ oldValue = []
+ }
+ if (this.temporaryList == '') {
+ this.attrNameChange(0, that.goodsDetail
+ .attributeList[0].value[0].value, 0)
+ }
+ } 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) => {})
+ }).catch((res) => {})
}
},
//库存商品详情
getKCList(list) {
this.yanseList = new Map()
- this.chimaList = new Map()
+ this.chimaList = new Map()
this.$refs.shopPopup.open('bottom')
this.pecsList = list
@@ -3640,40 +5760,40 @@
}
}
this.zNum = 0
- for (var i = 0; i < this.temporaryList.length; i++) {
- if(this.temporaryList[i].productCount > 0){
- this.zNum += this.temporaryList[i].productCount
+ for (var i = 0; i < this.temporaryList.length; i++) {
+ if (this.temporaryList[i].productCount > 0) {
+ this.zNum += this.temporaryList[i].productCount
}
}
- },
- handleBlur(e) {
- this.categoryText = e.detail.value
- },
- 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()
+ },
+ handleBlur(e) {
+ this.categoryText = e.detail.value
+ },
+ 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) {
@@ -3714,44 +5834,44 @@
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
- }
+ })
+ 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)
- },
- xiaoshouChange(e) {
- uni.showLoading({
- title: '加载中...'
- })
- if (this.linshiPrice == e.target.value) {
- this.shouldPay = e.target.value
- } else {
- if (e.target.value == '') {
- this.shouldPay = this.linshiPrice
- } else {
- this.shouldPay = e.target.value
- }
- }
- this.getAllPrice(this.shouldPay)
- // this.getAmountAndWho()
- setTimeout(res => {
- uni.hideLoading();
- }, 200)
+ },
+ xiaoshouChange(e) {
+ uni.showLoading({
+ title: '加载中...'
+ })
+ if (this.linshiPrice == e.target.value) {
+ this.shouldPay = e.target.value
+ } else {
+ if (e.target.value == '') {
+ this.shouldPay = this.linshiPrice
+ } else {
+ this.shouldPay = e.target.value
+ }
+ }
+ this.getAllPrice(this.shouldPay)
+ // this.getAmountAndWho()
+ setTimeout(res => {
+ uni.hideLoading();
+ }, 200)
},
//点击发货方式按钮
radioChange(e) {
@@ -3783,205 +5903,218 @@
})
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
- }
- }
+ },
+ 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
+ }
+ }
},
//弹窗选择规格后,点击弹窗中选好了按钮
temporaryCheck() {
uni.showLoading({
title: '加载中...'
- })
-
+ })
+
this.evalue = []
let that = this,
- carList1 = [],
- newList = []
- for(let i=0;i{
- let data = {
- id: this.goodsDetail.id,
- price: this.zPrice,
- num: this.zNum,
- 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 = {
- purchasePrice: carList1[i].price, //采购价
- price: 0, //总价
- discount: 10, //折扣
- unitPrice: carList1[i].unitPrice || 0, //单价
- categoryId: carList1[i].categoryId,
- discountAmount: 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(),
- stockLogList1: [],
- supplierName: carList1[i].supplierName //供应商
- }
- for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
-
- var data1 = {
- productCount: 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 += 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).stockLogList = new Map()
- }
- if (this.carList.has(carList1[i].id) == true) { //商品相同
- this.carList.get(carList1[i].id).productCount = 0
- for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
- if (this.carList.get(carList1[i].id).stockLogList.has(carList1[i]
- .saleDetailQueryDTO[
- m].attributeList) == true) { //规格相同
- var data1 = {
- productCount: 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: 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){
- this.carList.get(carList1[i].id).productCount += 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).price = that.carList.get(carList1[i].id).productCount *
- that.carList.get(carList1[i].id).unitPrice
- }
- } else { //商品不同
- let obj = {
- purchasePrice: carList1[i].price, //采购价
- price: 0,
- discount: 10,
- discountAmount: 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(),
- stockLogList1: [],
- productSn: carList1[i].productSn,
- supplierName: carList1[i].supplierName
- }
-
- for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
- var data1 = {
- productCount: 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 += 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 == 0) { //零售
- value.unitPrice = value.lsprice
- } else if (that.priceType == 1) { //批发
- value.unitPrice = value.wholesalePrice
- }
- if (that.discountType == 1) { //整体折扣
- value.price = value.unitPrice * 10000 * value.productCount * that.discountNum / 10 / 10000
- }
- }
-
- })
- // this.getAllPrice()
- this.getAmountAndWho();
- this.noPay = this.shouldPay
- this.$refs.shopPopup.close()
- setTimeout(res => {
- uni.hideLoading();
- }, 1000)
+ this.$nextTick(() => {
+ let data = {
+ id: this.goodsDetail.id,
+ price: this.zPrice,
+ num: this.zNum,
+ 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 = {
+ purchasePrice: carList1[i].price, //采购价
+ price: 0, //总价
+ discount: 10, //折扣
+ unitPrice: carList1[i].unitPrice || 0, //单价
+ categoryId: carList1[i].categoryId,
+ discountAmount: 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(),
+ stockLogList1: [],
+ supplierName: carList1[i].supplierName //供应商
+ }
+ for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
+
+ var data1 = {
+ productCount: 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 += 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).stockLogList = new Map()
+ }
+ if (this.carList.has(carList1[i].id) == true) { //商品相同
+ this.carList.get(carList1[i].id).productCount = 0
+ for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
+ if (this.carList.get(carList1[i].id).stockLogList.has(carList1[i]
+ .saleDetailQueryDTO[
+ m].attributeList) == true) { //规格相同
+ var data1 = {
+ productCount: 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: 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) {
+ this.carList.get(carList1[i].id).productCount += 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).price = that.carList.get(carList1[i].id)
+ .productCount *
+ that.carList.get(carList1[i].id).unitPrice
+ }
+ } else { //商品不同
+ let obj = {
+ purchasePrice: carList1[i].price, //采购价
+ price: 0,
+ discount: 10,
+ discountAmount: 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(),
+ stockLogList1: [],
+ productSn: carList1[i].productSn,
+ supplierName: carList1[i].supplierName
+ }
+
+ for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
+ var data1 = {
+ productCount: 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 += 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 == 0) { //零售
+ value.unitPrice = value.lsprice
+ } else if (that.priceType == 1) { //批发
+ value.unitPrice = value.wholesalePrice
+ }
+ if (that.discountType == 1) { //整体折扣
+ value.price = value.unitPrice * 10000 * value.productCount * that
+ .discountNum / 10 / 10000
+ }
+ }
+
+ })
+ // this.getAllPrice()
+ this.getAmountAndWho();
+ this.noPay = this.shouldPay
+ this.$refs.shopPopup.close()
+ setTimeout(res => {
+ uni.hideLoading();
+ }, 1000)
})
},
//是否平台取货
@@ -3998,25 +6131,33 @@
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"
- });
+ 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
- // })
+ jieshu() {
+ // uni.showLoading({
+ // title: '识别中...',
+ // mask:true
+ // })
manager.stop()
this.recordState = false
},
@@ -4029,68 +6170,84 @@
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));
+ //去掉嗯啊等
+ 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.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(',') == 0){
- convertedStr = convertedStr.substr(1)
- }
- if (convertedStr.startsWith("号")) {
- convertedStr = "货号" + convertedStr.substr(1);
}
+ if (convertedStr.indexOf(',') == 0) {
+ convertedStr = convertedStr.substr(1)
+ }
+ if (convertedStr.startsWith("号")) {
+ 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
- }
- if(res.retcode == '-30003'){
- that.isVoice = false
- }
- if(res.retcode == '-30004'){
- // uni.hideLoading()
- that.isVoice = false
- uni.hideToast()
- uni.showToast({
- title: "未识别到声音信息,请重新录入",
- icon: 'none'
- })
+ manager.onError = (res) => {
+
+ if (res.retcode == '-30011') {
+ that.isVoice = true
+ }
+ 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({
@@ -4100,8 +6257,8 @@
}
}
},
- async showPrice1() {
- let that = this;
+ async showPrice1(type) {
+ let that = this;
this.sellObj = ""
if (this.khName == '') {
this.tui.toast('请选择客户!')
@@ -4130,169 +6287,210 @@
} else {
this.tui.toast('请选择发货方式!')
return
- }
- let obj = {
- orderByWorker: this.lbgName.workerId || this.kdyName.workerId,
- oldSaleId: this.saleId || '',
- sale: {
- // relPrice:,
- 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:[]
- }
- }
-
- let purchaseDetails = [];
- let returnList = [];
- let ZreturnCount = 0
- await this.carList.forEach(function(value, key) {
- if(value.productSn == "" || value.productSn == null){
- that.tui.toast('开单商品货号不能为空')
- throw Error('1')
- }
- 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: values.productCount,
- attributeList: keys
- }
- goodsList.push(obj1)
- }
-
- })
- that.$nextTick(()=>{
- if(returnGoods.length > 0){
- let data = {
- 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: 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 = {
- categoryId: value.categoryId,
- disNoAmount: value.disNoAmount,
- discount: value.discount,
- discountAmount: value.discountAmount,
- price: value.lsprice?value.lsprice:0,
- productCount: 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: 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)
- })
+ }
+ 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: []
+ }
+ }
+
+ let purchaseDetails = [];
+ let returnList = [];
+ let ZreturnCount = 0
+ await this.carList.forEach(function(value, key) {
+ if (value.productSn == "" || value.productSn == null) {
+ that.tui.toast('开单商品货号不能为空')
+ throw Error('1')
+ }
+ 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: values.productCount,
+ attributeList: keys
+ }
+ goodsList.push(obj1)
+ }
+
+ })
+ that.$nextTick(() => {
+ if (returnGoods.length > 0) {
+ let data = {
+ 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: 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 = {
+ categoryId: value.categoryId,
+ disNoAmount: value.disNoAmount,
+ discount: value.discount,
+ discountAmount: value.discountAmount,
+ price: value.lsprice ? value.lsprice : 0,
+ productCount: 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: 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
- this.$refs.showPopup.open()
+ if (type != 'hang') {
+ this.$refs.showPopup.open()
+ }
+ },
+ hangOrderFn() {
+ let that = this;
+ this.showPrice1("hang")
+ uni.showModal({
+ title: "提示",
+ content: "挂单后可从首页挂单中查看,是否继续?",
+ success: function(res) {
+ uni.showLoading({
+ title: '加载中...'
+ })
+ if (res.confirm) {
+ that.sellObj.sale.saleId = that.sellObj.oldSaleId
+ that.tui.request('/app/sale/temporarySaveSale', "post", that.sellObj, false, false)
+ .then((res) => {
+ if (res.code == 200) {
+ uni.showToast({
+ title: "挂单成功",
+ icon: 'none'
+ })
+ setTimeout(res1 => {
+ that.clearAll1()
+ // uni.switchTab({
+ // url: '/pages/index/index'
+ // });
+ }, 1000)
+ } else {
+ that.tui.toast(res.message)
+ }
+ })
+ }
+ setTimeout(res => {
+ uni.hideLoading();
+ }, 500)
+ }
+ })
},
//点击底部开单按钮
async goSell() {
@@ -4301,28 +6499,28 @@
title: '加载中...'
})
this.$refs.showPopup.close()
- let url = ''
- if (this.saleId != '') {
- url = '/app/sale/shareToBuyNew'
- } else {
- url = '/app/sale/buyNew'
- }
- this.tui.request(url, "post", this.sellObj, false, false).then((res) => {
- if (res.code == 200) {
- uni.showToast({
- title: "开单成功",
- icon: 'none'
- })
- setTimeout(res1 => {
- this.$refs.showPopup.close()
- that.clearAll1()
- uni.navigateTo({
- url: '/package1/index/orderDetail?id='+res.result
- })
- }, 1000)
- } else {
- this.tui.toast(res.message)
- }
+ let url = ''
+ if (this.saleId != '') {
+ url = '/app/sale/shareToBuyNew'
+ } else {
+ url = '/app/sale/buyNew'
+ }
+ this.tui.request(url, "post", this.sellObj, false, false).then((res) => {
+ if (res.code == 200) {
+ uni.showToast({
+ title: "开单成功",
+ icon: 'none'
+ })
+ setTimeout(res1 => {
+ this.$refs.showPopup.close()
+ that.clearAll1()
+ uni.navigateTo({
+ url: '/package1/index/orderDetail?id=' + res.result
+ })
+ }, 1000)
+ } else {
+ this.tui.toast(res.message)
+ }
})
setTimeout(res => {
uni.hideLoading();
@@ -4334,10 +6532,10 @@
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
+ },
+ //输入商品自定义退货金额
+ changeReturnPay(e) {
+ this.returnPrice = e.detail.value
},
//输入商品自定义金额
changePay(e) {
@@ -4346,19 +6544,19 @@
//更改单品折扣
changeDis(e, id) {
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;
- }
+ 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
@@ -4404,17 +6602,19 @@
title: "提示",
content: "确定删除此条规格吗?",
success: function(res) {
- if (res.confirm) {
- if(that.carList.get(id).stockLogList.get(name).productCount > 0){
- that.carList.get(id).productCount -= that.carList.get(id).stockLogList.get(name)
- .productCount;
- }else{
- that.carList.get(id).returnCount -= Math.abs(that.carList.get(id).stockLogList.get(name).productCount);
+ if (res.confirm) {
+ if (that.carList.get(id).stockLogList.get(name).productCount > 0) {
+ that.carList.get(id).productCount -= 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 = that.carList.get(id).productCount * that.carList.get(
+ that.carList.get(id).stockLogList.delete(name);
+ that.carList.get(id).price = that.carList.get(id).productCount * that.carList.get(
id).unitPrice
-
+
if (that.carList.get(id).stockLogList.size == 0) {
that.carList.delete(id)
}
@@ -4425,184 +6625,192 @@
}
})
- },
- 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)
+ },
+ 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)
},
//计算总金额和总数量
- getAllPrice(price,type) {
- if(type == 'tanyue'){
- this.tanyue = !this.tanyue
- }else if(type == 'tanxiaoshou'){
- this.tanxiaoshou = !this.tanxiaoshou
+ getAllPrice(price, type) {
+ if (type == 'tanyue') {
+ this.tanyue = !this.tanyue
+ } else if (type == 'tanxiaoshou') {
+ this.tanxiaoshou = !this.tanxiaoshou
}
let that = this;
- this.totalAmount = 0
+ this.totalAmount = 0
that.returnTotalAmount = 0
- that.returnPay = 0
- that.qiankuandikou = 0
- that.xiaoshoudikou = 0
- that.leijiqiankuan = 0
- that.yuedikou = 0
- if(!price){
- this.shouldPay = 0
- }
- this.carList.forEach(function(value, key) {
- if(!price){
- that.shouldPay = Number(that.shouldPay) + Number(value.price)
- }
- that.returnPay = Number(that.returnPay) + (Number(value.returnPrice) * Math.abs(Number(value.returnCount)))
- if(!price){
- if(value.productCount > 0){
- that.totalAmount = Number(that.totalAmount) + Number(value.productCount)
- }
- }
- that.returnTotalAmount = Number(that.returnTotalAmount) + Number(value.returnCount)
- })
- if(!price){
- that.shouldPay = that.shouldPay.toFixed(2)
- }
- that.returnPay = that.returnPay.toFixed(2)
- /**
- * 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 = that.shouldPay - (that.returnPay - that.zhiqianqiankuan)
- }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 = this.shouldPay - Math.abs(that.zhiqianqiankuan)
- }else if(that.shouldPay <= Math.abs(that.zhiqianqiankuan)){
- that.yuedikou = that.shouldPay
- this.relPrice = 0
- }
- if(that.returnPay != 0){
- this.relPrice = this.relPrice - that.returnPay
- }
- }else if(parseFloat(that.zhiqianqiankuan) == 0){
- if(parseFloat(that.returnPay) > 0){
- this.relPrice = that.shouldPay - that.returnPay
- 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 = that.shouldPay - (that.returnPay - that.zhiqianqiankuan)
- }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.relPrice
- that.noPay = this.relPrice - (this.priceOk == '' ? 0 : this.priceOk)
- that.noPay = that.noPay.toFixed(2)
- this.leijiqiankuan = Number(this.zhiqianqiankuan) - Number(this.qiankuandikou) + Number(this.yuedikou) + Number(this.noPay)
- this.$forceUpdate()
+ that.returnPay = 0
+ that.qiankuandikou = 0
+ that.xiaoshoudikou = 0
+ that.leijiqiankuan = 0
+ that.yuedikou = 0
+ if (!price) {
+ this.shouldPay = 0
+ }
+ this.carList.forEach(function(value, key) {
+ if (!price) {
+ that.shouldPay = Number(that.shouldPay) + Number(value.price)
+ }
+ that.returnPay = Number(that.returnPay) + (Number(value.returnPrice) * Math.abs(Number(value
+ .returnCount)))
+ if (!price) {
+ if (value.productCount > 0) {
+ that.totalAmount = Number(that.totalAmount) + Number(value.productCount)
+ }
+ }
+ that.returnTotalAmount = Number(that.returnTotalAmount) + Number(value.returnCount)
})
- },
- noReturn(){
- this.priceOk = 0
- this.noPay = this.relPrice - (this.priceOk == '' ? 0 : this.priceOk)
- this.noPay = this.noPay.toFixed(2)
- this.leijiqiankuan = Number(this.zhiqianqiankuan) - Number(this.qiankuandikou) + Number(this.yuedikou) + Number(this.noPay)
- },
- getkhName(){
- this.tui.request("/app/customer/list", "post", {
- notBuyDays: "",
- pageNum: 1,
- pageSize: 10,
- searchStr: "散客",
- sort: "",
- }, false, false).then((res) => {
+ if (!price) {
+ that.shouldPay = that.shouldPay.toFixed(2)
+ }
+ that.returnPay = that.returnPay.toFixed(2)
+ /**
+ * 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 = that.shouldPay - (that.returnPay - that.zhiqianqiankuan)
+ // } 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 = this.shouldPay - Math.abs(that.zhiqianqiankuan)
+ } else if (that.shouldPay <= Math.abs(that.zhiqianqiankuan)) {
+ that.yuedikou = that.shouldPay
+ this.relPrice = 0
+ }
+ // if (that.returnPay != 0) {
+ // this.relPrice = this.relPrice - that.returnPay
+ // }
+ } else if (parseFloat(that.zhiqianqiankuan) == 0) {
+ // if (parseFloat(that.returnPay) > 0) {
+ // this.relPrice = that.shouldPay - that.returnPay
+ // 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 = that.shouldPay - (that.returnPay - that.zhiqianqiankuan)
+ // } 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.relPrice
+ that.noPay = this.relPrice - (this.priceOk == '' ? 0 : this.priceOk)
+ that.noPay = that.noPay.toFixed(2)
+ this.leijiqiankuan = Number(this.zhiqianqiankuan) - Number(this.qiankuandikou) + Number(this
+ .yuedikou) + Number(this.noPay)
+ this.$forceUpdate()
+ })
+ },
+ noReturn() {
+ this.priceOk = 0
+ this.noPay = this.relPrice - (this.priceOk == '' ? 0 : this.priceOk)
+ this.noPay = this.noPay.toFixed(2)
+ this.leijiqiankuan = Number(this.zhiqianqiankuan) - Number(this.qiankuandikou) + Number(this.yuedikou) +
+ Number(this.noPay)
+ },
+ getkhName() {
+ 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:null
- }
- }else{
- this.tui.toast(res.message)
- }
- })
+ this.khData = res.result.records[0]
+ this.khName = {
+ id: res.result.records[0].id,
+ name: res.result.records[0].name,
+ noEarn: null
+ }
+ } else {
+ this.tui.toast(res.message)
+ }
+ })
},
clearAll1() {
let that = this;
@@ -4610,26 +6818,26 @@
that.remark = ''
that.index = ''
that.priceCurrent = ''
- that.lunbocurrent = 4
+ that.lunbocurrent = 4
that.radioType = '2'
that.discountType = ''
- that.pbAddress = ''
- that.zhiqianqiankuan = 0
- that.leijiqiankuan = 0
- that.qiankuandikou = 0
- that.returnPay = 0
- that.yuedikou = 0
+ that.pbAddress = ''
+ that.zhiqianqiankuan = 0
+ that.leijiqiankuan = 0
+ that.qiankuandikou = 0
+ that.returnPay = 0
+ that.yuedikou = 0
that.xiaoshoudikou = 0
that.discountCurrent = ''
that.temporaryList = []
that.purchasePrice = 0
that.zPrice = 0
that.zNum = 0
- that.shouldPay = 0
+ that.shouldPay = 0
that.khName = {
- id:that.khData.id,
- name:that.khData.name,
- noEarn:null
+ id: that.khData.id,
+ name: that.khData.name,
+ noEarn: null
}
that.gysName = []
that.wlName = []
@@ -4639,7 +6847,7 @@
that.priceOk = 0
that.noPay = 0
that.otherExpense = 0
- that.totalAmount = 0
+ that.totalAmount = 0
that.returnTotalAmount = 0
that.saleId = ''
that.$forceUpdate()
@@ -4665,21 +6873,21 @@
that.lunbocurrent = 4
that.discountType = ''
that.discountCurrent = null
- that.temporaryList = []
- that.zhiqianqiankuan = 0
- that.returnPay = 0
- that.qiankuandikou = 0
- that.yuedikou = 0
- that.xiaoshoudikou = 0
+ that.temporaryList = []
+ that.zhiqianqiankuan = 0
+ 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.shouldPay = 0
that.khName = {
- id:that.khData.id,
- name:that.khData.name,
- noEarn:null
+ id: that.khData.id,
+ name: that.khData.name,
+ noEarn: null
}
that.gysName = []
that.wlName = []
@@ -4689,7 +6897,7 @@
that.priceOk = 0
that.noPay = 0
that.otherExpense = 0
- that.totalAmount = 0
+ that.totalAmount = 0
that.returnTotalAmount = 0
that.saleId = ''
that.priceCurrent = null
@@ -4875,24 +7083,24 @@
background: #fff;
height: 60rpx;
}
- }
-
- .price-box{
- width: 95%;
- margin: 10px 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 {
+ width: 95%;
+ margin: 10px 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;
@@ -4927,8 +7135,9 @@
.bottom-left {
flex: 1;
height: 110rpx;
- line-height: 110rpx;
font-size: 26rpx;
+ display: flex;
+ flex-direction: column;
}
.notice {
@@ -4937,20 +7146,20 @@
}
.bottom-right {
- width: 50%;
+ width: 70%;
display: flex;
.bottom-btn {
margin: 0;
padding: 0;
- width: 45%;
+ width: 30%;
line-height: 35px;
height: 70rpx;
text-align: center;
- margin-top: 10rpx;
+ margin: 15rpx 0 0 2%;
color: #fff;
font-size: 28rpx;
- border-radius: 0;
+ border-radius: 5px;
}
.bottom-btn:first-child {
@@ -4968,14 +7177,14 @@
}
.bottom-left text {
- line-height: 84rpx;
display: inline-block;
padding-left: 20rpx;
+ padding-top: 10rpx;
}
.bottom-btn {
width: 320rpx;
- background: linear-gradient(90deg, #60F3FF, #088FEB);
+ background: #D8BFD8;
color: #fff;
border-radius: 50rpx;
height: 85rpx;
@@ -5113,6 +7322,57 @@
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: 30rpx;
+ font-weight: bold;
+ }
+
+ .box-right-num {
+ padding: 5rpx 0;
+ color: #777;
+ }
+
+ .box-right-price {
+ display: flex;
+ font-size: 25rpx;
+ }
+
+ .voice-price-box {
+ display: flex;
+ flex-direction: column;
+ margin-right: 20rpx;
+ }
+
+ .voice-price-box text:first-child {
+ color: #ffa200
+ }
+
.popup-btn {
text-align: center;
background: linear-gradient(90deg, #60F3FF, #088FEB);
@@ -5269,6 +7529,8 @@
.type-popup {
width: 500rpx;
height: auto;
+ max-height: 900rpx;
+ overflow: scroll;
background: #fff;
border-radius: 10px;
position: relative;
@@ -5360,139 +7622,154 @@
.zuni-numbox .zuni-numbox--disabled {
color: #c0c0c0 !important;
cursor: not-allowed;
- }
- .mask-model{
- width: 60%;
- height: 100rpx;
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- margin: auto;
- text-align: center;
- background: rgba(0,0,0,0.7);
- color: #eee;
- padding: 5px;
- border-radius: 5px;
- z-index: 99;
- }
- .new-logo {
- position: absolute;
- top: 35rpx;
- left: 131rpx;
- background: red;
- color: #fff;
- width: 40rpx;
- height: 40rpx;
- line-height: 40rpx;
- text-align: center;
- border-top-right-radius: 10px;
- }
- .u-upload {
- position: absolute;
- top: 30rpx;
- left: 30rpx;
- opacity: 0;
- width: 140rpx;
- height: 140rpx;
- }
- .left-btn {
- font-weight: 800;
- font-size: 28rpx;
- color: #fff;
- background: #088FEB;
- border-radius: 5px;
- width: 140rpx;
- height: 50rpx;
- line-height: 50rpx;
- text-align: center;
- }
- .one-goods{
- margin-top: 10px;
- width: 100%;
- height: 50rpx;
- background: #088FEB;
- font-size: 28rpx;
- text-align: center;
- line-height: 50rpx;
- color: #fff;
- border-radius: 5px;
- position: relative;
- }
- .jiaobiao{
- width: 40rpx;
- height: 40rpx;
- border-radius: 10px;
- color: #fff;
- background: red;
- position: absolute;
- top: -5px;
- right: -5px;
- text-align: center;
- line-height: 40rpx;
- font-size: 28rpx;
- }
- .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: 40px;
- height: 80rpx;
- padding-left: 20rpx;
- }
- .showImg-box{
- width: 500rpx;
- height: 500rpx;
- }
- .swiper-box {
- height: 200px;
- }
- .swiper-item {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- height: 200px;
- color: #fff;
- background-color: #cee1fd;
- }
- .lb-btn{
- width: 100%;
- height: 100rpx;
- text-align: center;
- line-height: 100rpx;
- background: #088FEB;
- color: #fff;
- border-bottom-left-radius: 10px;
- border-bottom-right-radius: 10px;
- }
- .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;
}
+
+ .mask-model {
+ width: 60%;
+ height: 100rpx;
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ margin: auto;
+ text-align: center;
+ background: rgba(0, 0, 0, 0.7);
+ color: #eee;
+ padding: 5px;
+ border-radius: 5px;
+ z-index: 99;
+ }
+
+ .new-logo {
+ position: absolute;
+ top: 35rpx;
+ left: 131rpx;
+ background: red;
+ color: #fff;
+ width: 40rpx;
+ height: 40rpx;
+ line-height: 40rpx;
+ text-align: center;
+ border-top-right-radius: 10px;
+ }
+
+ .u-upload {
+ position: absolute;
+ top: 30rpx;
+ left: 30rpx;
+ opacity: 0;
+ width: 140rpx;
+ height: 140rpx;
+ }
+
+ .left-btn {
+ font-weight: 800;
+ font-size: 28rpx;
+ color: #fff;
+ background: #088FEB;
+ border-radius: 5px;
+ width: 140rpx;
+ height: 50rpx;
+ line-height: 50rpx;
+ text-align: center;
+ }
+
+ .one-goods {
+ margin-top: 10px;
+ width: 100%;
+ height: 50rpx;
+ background: #088FEB;
+ font-size: 28rpx;
+ text-align: center;
+ line-height: 50rpx;
+ color: #fff;
+ border-radius: 5px;
+ position: relative;
+ }
+
+ .jiaobiao {
+ width: 40rpx;
+ height: 40rpx;
+ border-radius: 10px;
+ color: #fff;
+ background: red;
+ position: absolute;
+ top: -5px;
+ right: -5px;
+ text-align: center;
+ line-height: 40rpx;
+ font-size: 28rpx;
+ }
+
+ .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: 40px;
+ height: 80rpx;
+ padding-left: 20rpx;
+ }
+
+ .showImg-box {
+ width: 700rpx;
+ height: 1000rpx;
+ }
+
+ .swiper-box {
+ height: 900rpx;
+ }
+
+ .swiper-item {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ height: 900rpx;
+ color: #fff;
+ background-color: #cee1fd;
+ }
+
+ .lb-btn {
+ width: 100%;
+ height: 100rpx;
+ text-align: center;
+ line-height: 100rpx;
+ background: #088FEB;
+ color: #fff;
+ border-bottom-left-radius: 10px;
+ border-bottom-right-radius: 10px;
+ }
+
+ .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;
+ }
+
@media screen and (min-width: 470px) {
.shop-popup-content {
height: 900rpx;
diff --git a/pages/inventory/inventory.vue b/pages/inventory/inventory.vue
index 5946201..dc89a55 100644
--- a/pages/inventory/inventory.vue
+++ b/pages/inventory/inventory.vue
@@ -47,7 +47,7 @@
-
+
-
+
暂无图片
@@ -94,13 +94,15 @@
-
+
暂无图片
-
- {{item.productName}}
- 货号:{{item.productSn}}
+
+
+ 货号:{{item.productSn}}
+ 名称:{{item.productName == null?'暂无':item.productName}}
+ 供应商:{{item.supplierName == null?'暂无':item.supplierName}}
下架
上架
@@ -146,6 +148,9 @@
+
@@ -168,6 +173,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -182,6 +199,8 @@
return {
size: 30,
indexList: [],
+ bigImg:[],
+ swiperDotIndex:0,
// status: 'loadmore',
pageNum: 1, //分页的页码
shopList: [],
@@ -204,7 +223,10 @@
uni.redirectTo({
url: "/package1/index/downStearmList?khid=" + option.khid
})
- }
+ }
+ // if(uni.getStorageSync('noReload') == true){
+ // uni.removeStorageSync('noReload')
+ // }
let that = this
this.type=uni.getStorageSync('type')
uni.getSystemInfo({
@@ -223,19 +245,48 @@
onReachBottom() {
if (this.pageNum >= this.pages) return;
// this.status = 'loading';
- this.pageNum ++;
- this.getShareList();
+ this.pageNum ++;
+ if(this.gateType == 'search'){
+ this.getShareList('search');
+ }else{
+ this.getShareList();
+ }
+
},
onShow() {
- if(uni.getStorageSync('noReload') == true){
+ if(uni.getStorageSync('noReload') == true){
+ this.searchName = ''
uni.removeStorageSync('noReload')
- }else{
+ }else{
+ this.searchName = ''
this.getGategoryList()
}
this.getWarnMsg()
this.getweiruku()
},
methods: {
+ lunbochange(e) {
+ this.current = e.detail.current
+ },
+ largeImg(img) {
+ if(img.productPicture == null &&img.productPictures == null ){
+ this.tui.toast("暂无可展示的图片",1000)
+ return
+ }
+ this.bigImg = []
+ if(img.productPicture != null){
+ let data = {
+ productPicture:img.productPicture
+ }
+ this.bigImg.push(data)
+ }
+ if(img.productPictures != null){
+ for(let i=0;i
-
+
{{item.attributeList | sliceMsg}}
@@ -56,7 +56,8 @@
+ @change="changeNumBtn(item)" style="margin-top: 10rpx;display: block;" />
+
@@ -406,9 +407,11 @@
}
if(this.current==1){
for(let i=0;i {
+ if (res1.code == 200) {
+ uni.showToast({
+ title: "删除成功",
+ icon: 'none'
+ })
+ that.getShareList()
+ if(item.stockCount > 0){
+ that.dataList.stockCount = that.dataList.stockCount - item.stockCount
+ uni.removeStorageSync('noReload')
+ }
+ } else {
+ uni.showToast({
+ title: "删除失败",
+ icon: 'none'
+ })
+ }
+ })
+ }
+ }
+ })
},
sliceMsg(val) {
var name = ''
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 669cd9d..e311b6f 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -183,10 +183,13 @@
if (res.code == 200) {
this.toggle("center");
this.shopList = res.result
- }else{
+ }else{
+ this.getCaptchaImg()
this.tui.toast(res.message)
}
- }).catch((res) => {})
+ }).catch((res) => {
+ this.getCaptchaImg()
+ })
}else{
this.tui.request(loginUrl, "POST", data, true, true).then((res) => {
if (res.code == 200) {
@@ -209,10 +212,14 @@
}else{
this.checkShop(res.result.shopList[0])
}
- } else {
+ } else {
+ this.getCaptchaImg()
this.tui.toast(res.message)
}
- }).catch((res) => {})
+ }).catch((res) => {
+
+ this.getCaptchaImg()
+ })
}
},
@@ -255,7 +262,8 @@
uni.setStorageSync('shopName',item.shopName)
uni.setStorageSync('shopIcon',res.result.shopIcon)
uni.setStorageSync('shopAddress',res.result.shopAddress)
- uni.setStorageSync('shopRemark',res.result.remark)
+ uni.setStorageSync('shopRemark',res.result.remark)
+ uni.setStorageSync("shopOwnerPhone", item.shopOwnerPhone)
setTimeout(() => {
uni.reLaunch({
url: '/pages/index/index'
@@ -428,6 +436,8 @@
padding: 15px;
width: 500rpx;
height: auto;
+ overflow: scroll;
+ max-height: 900rpx;
background-color: #fff;
}