wangfukang 2 years ago
parent
commit
dfe7bcab40
  1. 1
      pages/billing/addUser.vue
  2. 2
      pages/index/index.vue
  3. 229
      pages/inventory/goodsList1.vue
  4. 157
      pages/inventory/inventory.vue

1
pages/billing/addUser.vue

@ -363,6 +363,7 @@
that.tui.request("/app/customer/edit", "post", {
name: this.formData.consigneeName,
phone: this.formData.consigneeMobile,
shopId:uni.getStorageSync('shopId'),
orderByField: Number((this.formData.orderByField == '' || this.formData.orderByField == null) ? 0 : this.formData.orderByField),
address: this.formData.address,
province: this.formData.province,

2
pages/index/index.vue

@ -177,7 +177,7 @@
<view class="border-line"></view>
<u-cell icon="rewind-right-fill" url="/package1/index/updateShopMsg" title="更新店铺信息" clickable
isLink arrow-direction="left"></u-cell>
<u-cell v-if="shopName == '炘钱' || shopName == '测试库新店' || shopName == '提钱退休'"
<u-cell v-if="shopName == '炘钱' || shopName == '炘玩' || shopName == '测试库新店' || shopName == '提钱退休'"
icon="integral-fill" url="/package1/AI/addAiList" title="管理员登录" clickable isLink
arrow-direction="left"></u-cell>
<!-- <u-cell icon="integral-fill" url="" title="电费缴纳" clickable isLink

229
pages/inventory/goodsList1.vue

@ -1557,56 +1557,57 @@
console.log(this.khName)
console.log(this.carList)
if(this.khName.categoryId != null){
if(this.khName.categoryId != null && this.khName.categoryId != ''){
this.carList.forEach(function(value, key) {
if(value.isChangePrice == undefined){
value.isChangePrice = false
}
if(value.isChangeReturnPrice == undefined){
value.isChangeReturnPrice = false
}
if(value.customerCategoryList != null){
let truePrice = 0
let ischeckCustom = false
let ischeckCustomPrice = false
for(let i=0;i<value.customerCategoryList.length;i++){
if(Number(value.unitPrice) == Number(value.customerCategoryList[i].categoryPrice)){
ischeckCustom = true
if(value.productId != '' && value.productId != null){
if(value.isChangePrice == undefined){
value.isChangePrice = false
}
if(value.isChangeReturnPrice == undefined){
value.isChangeReturnPrice = false
}
if(value.customerCategoryList != null){
let truePrice = 0
let ischeckCustom = false
let ischeckCustomPrice = false
for(let i=0;i<value.customerCategoryList.length;i++){
if(Number(value.unitPrice) == Number(value.customerCategoryList[i].categoryPrice)){
ischeckCustom = true
}
if(that.khName.categoryId == value.customerCategoryList[i].categoryId && value.customerCategoryList[i].categoryPrice != ''){
truePrice = value.customerCategoryList[i].categoryPrice
ischeckCustomPrice = true
}
/* if(that.khName.categoryId == value.customerCategoryList[i].categoryId && value.customerCategoryList[i].categoryPrice == ''){
uni.showToast({title:value.productSn+'商品没有维护"'+value.customerCategoryList[i].categoryName+'"价格',mask:true,duration:2000});
} */
}
if(that.khName.categoryId == value.customerCategoryList[i].categoryId && value.customerCategoryList[i].categoryPrice != ''){
truePrice = value.customerCategoryList[i].categoryPrice
ischeckCustomPrice = true
if(ischeckCustomPrice && (Number(value.unitPrice) == Number(value.wholesalePrice) || Number(value.unitPrice) == Number(value.lsprice) || ischeckCustom) && !value.isChangePrice && !uni.getStorageSync('hangOrder')){
value.unitPrice = truePrice
value.discountAmount = truePrice
}
if(ischeckCustomPrice == false && !value.isChangePrice && !uni.getStorageSync('hangOrder')){
value.unitPrice = value.wholesalePrice
value.discountAmount = value.wholesalePrice
}
if(ischeckCustomPrice && (Number(value.returnPrice) == Number(value.wholesalePrice) || Number(value.unitPrice) == Number(value.lsprice) || ischeckCustom) && !value.isChangeReturnPrice && !uni.getStorageSync('hangOrder')){
value.returnPrice = truePrice
}
if(ischeckCustomPrice == false && !value.isChangeReturnPrice && !uni.getStorageSync('hangOrder')){
value.returnPrice = value.wholesalePrice
}
/* if(that.khName.categoryId == value.customerCategoryList[i].categoryId && value.customerCategoryList[i].categoryPrice == ''){
uni.showToast({title:value.productSn+'商品没有维护"'+value.customerCategoryList[i].categoryName+'"价格',mask:true,duration:2000});
} */
}
if(ischeckCustomPrice && (Number(value.unitPrice) == Number(value.wholesalePrice) || Number(value.unitPrice) == Number(value.lsprice) || ischeckCustom) && !value.isChangePrice && !uni.getStorageSync('hangOrder')){
value.unitPrice = truePrice
value.discountAmount = truePrice
}
if(ischeckCustomPrice == false && !value.isChangePrice && !uni.getStorageSync('hangOrder')){
value.unitPrice = value.wholesalePrice
value.discountAmount = value.wholesalePrice
}
if(ischeckCustomPrice && (Number(value.returnPrice) == Number(value.wholesalePrice) || Number(value.unitPrice) == Number(value.lsprice) || ischeckCustom) && !value.isChangeReturnPrice && !uni.getStorageSync('hangOrder')){
value.returnPrice = truePrice
}
if(ischeckCustomPrice == false && !value.isChangeReturnPrice && !uni.getStorageSync('hangOrder')){
value.returnPrice = value.wholesalePrice
}
}else{
if(!value.isChangeReturnPrice){
value.returnPrice = value.wholesalePrice
}
if(!value.isChangePrice){
value.discountAmount = value.wholesalePrice
value.unitPrice = value.wholesalePrice
}else{
value.discountAmount = value.unitPrice
if(!value.isChangeReturnPrice){
value.returnPrice = value.wholesalePrice
}
if(!value.isChangePrice){
value.discountAmount = value.wholesalePrice
value.unitPrice = value.wholesalePrice
}else{
value.discountAmount = value.unitPrice
}
}
}
})
@ -4371,6 +4372,10 @@
}
}, 100 * i)
} else { //精准搜索
if (convertedStr[i].indexOf('数量') == -1 && convertedStr[i].indexOf('名称') == -1 && convertedStr[i].indexOf(
'单价') == -1 && convertedStr[i].indexOf('批发价') == -1 && convertedStr[i].indexOf(',') == -1) {
convertedStr[i] = convertedStr[i] + ','
}
let voiceData = this.extractInfo(convertedStr[i] + '。')
if (voiceData.productSn) {
voiceData.productSn = voiceData.productSn.replace(/[沟勾钩]/g, 'J');
@ -6971,6 +6976,7 @@
}
} catch (e) {
let id = this.oneGoodsId
if (this.getMsg.indexOf('色,') != -1) {
this.getMsg = this.getMsg.replace(/色,/g, '色')
}
@ -6983,6 +6989,15 @@
if (this.getMsg.indexOf('件') != -1) {
this.getMsg = this.getMsg.replace(/件/g, '件,')
}
if(this.carList.get(id).isFirst == undefined){
this.carList.get(id).isFirst = false
}else{
if (this.getMsg.startsWith("货号")) {
this.getMsg = this.getMsg.replace(/货号/g, '')
}
this.getMsg = '请返回以下规格:'+this.getMsg
}
await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", {
customerId:this.khName.id,
questionMsg: this.getMsg
@ -6992,7 +7007,7 @@
this.voiceText1 = ''
this.$refs.popup.close()
let purchaseDetails = res.result.data.purchaseDetails
let id = this.oneGoodsId
if (purchaseDetails.length > 0) {
// this.carList.get(id).productCount = 0
// this.carList.get(id).returnCount = 0
@ -7190,6 +7205,7 @@
})
}
} else {
let id = this.oneGoodsId
if (this.getMsg.indexOf('色,') != -1) {
this.getMsg = this.getMsg.replace(/色,/g, '色')
}
@ -7202,16 +7218,25 @@
if (this.getMsg.indexOf('件') != -1) {
this.getMsg = this.getMsg.replace(/件/g, '件,')
}
if(this.carList.get(id).isFirst == undefined){
this.carList.get(id).isFirst = false
}else{
if (this.getMsg.startsWith("货号")) {
this.getMsg = this.getMsg.replace(/货号/g, '')
}
this.getMsg = '请返回以下规格:'+this.getMsg
}
await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", {
customerId:this.khName.id,
questionMsg: this.getMsg
}, false, true).then((res) => {
if (res.code == 200) {
this.voiceText = ''
this.voiceText1 = ''
this.$refs.popup.close()
let purchaseDetails = res.result.data.purchaseDetails
let id = this.oneGoodsId
if (purchaseDetails.length > 0) {
if (this.carList.get(id).productName == '') {
this.carList.get(id).productName = purchaseDetails[0].productName
@ -7236,7 +7261,7 @@
if (isTrue == false && this.carList.get(id).productSn == '') {
this.carList.get(id).productSn = purchaseDetails[0].productSn
}
if (isTrue == false) {
if (isTrue == false && this.carList.get(id).isFirst == undefined) {
if (purchaseDetails[0].productId) {
this.carList.get(id).id = purchaseDetails[0].productId
@ -7324,57 +7349,61 @@
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 +=
purchaseDetails[0].stockLogList1[i]
.productCount ?
Number(purchaseDetails[0].stockLogList1[i]
.productCount):0
this.carList.get(id).stockLogList.get(purchaseDetails[
0].stockLogList1[i].attributeList).productNum = purchaseDetails[
0].stockLogList1[i].stockCount
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 {
this.carList.get(id).stockLogList.set(purchaseDetails[
0].stockLogList1[i].attributeList,
purchaseDetails[0].stockLogList1[i])
this.carList.get(id).stockLogList.get(
purchaseDetails[0].stockLogList1[i]
.attributeList).productNum = this.carList.get(id).stockLogList.get(
purchaseDetails[0].stockLogList1[i]
.attributeList).stockCount
if (this.carList.get(id).stockLogList.has(purchaseDetails[
0].stockLogList1[i].attributeList) == true) {
this.carList.get(id).stockLogList.get(purchaseDetails[
0].stockLogList1[i].attributeList)
.productCount +=
purchaseDetails[j].stockLogList1[i]
.productCount ?
Number(purchaseDetails[j].stockLogList1[i]
.productCount):0
this.carList.get(id).stockLogList.get(purchaseDetails[
0].stockLogList1[i].attributeList).productNum = purchaseDetails[
0].stockLogList1[i].stockCount
} else {
this.carList.get(id).stockLogList.set(purchaseDetails[
0].stockLogList1[i].attributeList,
purchaseDetails[j].stockLogList1[i])
this.carList.get(id).stockLogList.get(
purchaseDetails[j].stockLogList1[i]
.attributeList).productNum = this.carList.get(id).stockLogList.get(
purchaseDetails[j].stockLogList1[i]
.attributeList).stockCount
}
}
if(purchaseDetails[j].stockLogList1[i].productCount > 0){
this.carList.get(id).productCount += Number(
purchaseDetails[j].stockLogList1[i].productCount)
}else{
this.carList.get(id).returnCount += Math.abs(purchaseDetails[j].stockLogList1[i].productCount)
}
}
if(purchaseDetails[0].stockLogList1[i].productCount > 0){
this.carList.get(id).productCount += Number(
purchaseDetails[0].stockLogList1[i].productCount)
}else{
this.carList.get(id).returnCount += Math.abs(purchaseDetails[0].stockLogList1[i].productCount)
}
if (this.carList.get(id).stockLogList.get(
'{"颜色":"均色","尺码":"均码"}')) {
if (this.carList.get(id).stockLogList.get(
'{"颜色":"均色","尺码":"均码"}').productCount == 1 && this.carList.get(
id)
.stockLogList.size> 1&&
purchaseDetails[0].stockLogList1.length > 0) {
this.carList.get(id).stockLogList.delete(
'{"颜色":"均色","尺码":"均码"}')
'{"颜色":"均色","尺码":"均码"}')) {
if (this.carList.get(id).stockLogList.get(
'{"颜色":"均色","尺码":"均码"}').productCount == 1 && this.carList.get(
id)
.stockLogList.size> 1&&
purchaseDetails[j].stockLogList1.length > 0) {
this.carList.get(id).stockLogList.delete(
'{"颜色":"均色","尺码":"均码"}')
this.carList.get(id).productCount-=1
}
}
}
}
this.carList.get(id).price = Number(this.carList.get(id).productCount) *
this.carList.get(id).discountAmount
})
@ -8499,7 +8528,7 @@
this.getMsg = this.getMsg.replace(/货号/g, '')
}
this.tui.request("/app/sale/buyAi", "POST", {
aiMsg: "请返回以下规格:"+this.getMsg,
aiMsg: "请返回以下规格"+this.getMsg,
productId: this.oneGoodsId
}, false, true).then((res) => {
if (res.code == 200) {
@ -8571,7 +8600,7 @@
this.getMsg = this.getMsg.replace(/货号/g, '')
}
this.tui.request("/app/sale/buyAi", "POST", {
aiMsg: "请返回以下规格:"+this.getMsg,
aiMsg: "请返回以下规格"+this.getMsg,
productId: this.oneGoodsId
}, false, true).then((res) => {
if (res.code == 200) {
@ -8664,9 +8693,11 @@
if (shopId == uni.getStorageSync('shopId').substring('10','12')) {
that.productId = base.decode(res.result.split(',')[0])
that.toggle('bottom', base.decode(res.result.split(',')[0]));
setTimeout(res => {
that.scanCodeAdd()
}, 1100)
if(that.attrBuilt != null && that.attrBuilt != ''){
setTimeout(res => {
that.scanCodeAdd()
}, 1100)
}
} else {
setTimeout(res => {
that.tui.toast('您的店铺中暂无该商品!')
@ -11998,7 +12029,7 @@
}
}).catch((res) => {})
}
if((this.shopId == '1838094297858183168' || this.shopId == '1811579958284390400' || this.shopId == '1818888277105709056') && this.khName.name != '散客'){
if((this.shopId == '1838094297858183168' || this.shopId == '1811579958284390400' || this.shopId == '1818888277105709056') && this.khName.name != '散客' && productIds != ''){
this.tui.request("/app/product/getByUserIdAndProductIds", "POST", {
userId: this.khName.id,

157
pages/inventory/inventory.vue

@ -204,6 +204,14 @@
<!-- 弹出输入框 -->
<uni-popup ref="sharePriceDialog" background-color="#fff">
<view class="popup-pay-content">
<view class="content-list" @tap.stop="goPopleList('khName')">
<view class="list-name">客户</view>
<view class="list-val">
<input type="text" placeholder="可选择客户" disabled :value="khName.name"
style="text-align: center;margin-top: 20rpx;">
<uni-icons type="right" size="16" style="margin-left: 80rpx;line-height: 80rpx;"></uni-icons>
</view>
</view>
<view class="popup-pay-title">
<text>选择商品价格</text>
</view>
@ -213,13 +221,16 @@
<view class="popup-pay-container" @tap="checkPay('1')">
<text style="display: inline-block">以批发价分享</text>
</view>
<view v-for="(item,index) in customerCategoryList" :key="index" @tap="checkPay('3',item)" class="popup-pay-container">
<text style="display: inline-block">{{item.categoryName}}</text>
</view>
</view>
</uni-popup>
<!-- 弹出层 -->
<uni-popup ref="sharePopup" background-color="#fff">
<view style="height: 250rpx;">
<view style="height: 350rpx;">
<button open-type="share" @tap="$refs.sharePopup.close()" class="popup-photo">分享给微信好友</button>
<!-- <button @tap="getUserData" class="popup-photo">生成商品图</button> -->
<button @tap="getUserData" class="popup-photo">生成商品图</button>
<view @tap="$refs.sharePopup.close()" class="popup-photo"
style="border-bottom:0;border-top:10px solid #eee;">取消</view>
</view>
@ -305,9 +316,9 @@
return {
canvasshow: false,
size: 30,
customerCategoryList: [],
indexList: [],
zheng: '0',
khName:{},
canvasWidth:0,
canvasHeight:0,
fu: '0',
@ -330,18 +341,16 @@
shopList1: [],
picture: '',
gateType: '',
total: 0
total: 0,
customerCategoryList:[]
}
},
onLoad(option) {
if (option.khid != undefined) {
uni.redirectTo({
url: "/package1/index/downStearmList?khid=" + option.khid
url: "/package1/index/oneGoodsShare?khid=" + option.khid
})
}
// if(uni.getStorageSync('noReload') == true){
// uni.removeStorageSync('noReload')
// }
let that = this
this.type = uni.getStorageSync('type')
uni.getSystemInfo({
@ -349,12 +358,13 @@
that.windowHeight = info.windowHeight
}
});
this.getCustomerCategoryList()
},
onShareAppMessage() {
return {
title: '查看我的推荐',
title: uni.getStorageSync('shopName') +'给您推荐的商品',
imageUrl: this.picture,
path: '/package1/index/downStearmList?khid=' + this.khid + '&userId=""'
path: '/package1/index/oneGoodsShare?khid=' + this.khid + '&userId='+this.khName.id
}
},
onReachBottom() {
@ -369,7 +379,7 @@
},
onShow() {
console.log('shopList', this.shopList)
console.log('shopList', this.khName)
if (uni.getStorageSync('noReload') == true) {
this.searchName = ''
uni.removeStorageSync('noReload')
@ -381,9 +391,46 @@
this.getweiruku()
},
methods: {
//跳转到客户选择页
goPopleList(){
uni.navigateTo({
url: '/package1/index/peopleList?popleType=khName'
})
},
//获取客户分类
getCustomerCategoryList(){
this.tui.request("/app/customerCategory/getCustomerCategoryListByShopId", "POST", {
shopId:uni.getStorageSync('shopId')
}, false, true).then((res) => {
if (res.code == 200) {
if(res.result.length > 0){
this.customerCategoryList = res.result
for(let i=0;i<this.customerCategoryList.length;i++){
let data = {
categoryName:this.customerCategoryList[i].categoryName,
categoryId:this.customerCategoryList[i].id,
categoryPrice:""
}
this.customerCategoryList[i] = data
}
}else{
this.customerCategoryList = null
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
getUserData() {
let that = this;
if(this.goodsData.productPicture == null || this.goodsData.productPicture == ''){
this.tui.toast("暂无可展示的图片", 300)
return
}
uni.setStorageSync('noReload', true)
this.tui.request("/order/ow/getWechatQrcode", "post", {
// page: 'package1/index/oneGoodsShare',
page: 'package1/index/downStearmList',
scene: this.khid,
envVersion: __wxConfig.envVersion,
@ -416,7 +463,7 @@
title: '生成中...'
})
this.canvasshow = true
const ctx = uni.createCanvasContext('myCanvas', this);
//背景图
let imgA = this.goodsData.productPicture;
@ -431,51 +478,59 @@
// that.canvasWidth = (image.width/ Number((image.height/1500).toFixed(2))).toFixed(0)
// }else{
that.canvasWidth = image.width
that.canvasHeight = image.height + 200
if((image.height + 200) / image.width > 2){
that.canvasHeight = image.width * 2
image.height = that.canvasHeight * 0.8
}else{
that.canvasHeight = image.height / 0.8
}
// }
const ctx = uni.createCanvasContext('myCanvas', this);
console.log(that.canvasWidth);
console.log(that.canvasHeight);
ctx.setFillStyle('#fff');
ctx.fillRect(0, 0, that.canvasWidth, that.canvasHeight);
// // 绘制第一张图片
ctx.drawImage(image.path, 0, 0, image.width, image.height);
ctx.draw()
// 绘制第二张图片
ctx.drawImage(that.base64, 25, that.canvasHeight - 175, 150, 150);
ctx.drawImage(that.base64, 25, (that.canvasHeight * 0.8) + (that.canvasHeight * 0.2 * 0.15), (that.canvasHeight * 0.2 * 0.75), (that.canvasHeight * 0.2 * 0.75));
ctx.draw(true);
ctx.font = "20px 宋体";
// 设置字体样式
ctx.setFontSize(28)
let codeWidth = that.canvasHeight * 0.2 * 0.75
ctx.setFontSize((codeWidth / 6).toFixed(0))
// 设置文字颜色
ctx.fillStyle = '#FF5809';
// 绘制文字
ctx.fillText(uni.getStorageSync('shopName'), 200 , that.canvasHeight - 125);
ctx.fillText(uni.getStorageSync('shopName'), (that.canvasHeight * 0.2 * 0.75) + 35 , (that.canvasHeight * 0.8) + (that.canvasHeight * 0.2 * 0.47));
// 设置字体样式
ctx.setFontSize(24)
ctx.setFontSize((codeWidth / 7).toFixed(0))
// 设置文字颜色
ctx.fillStyle = '#000';
// 绘制文字
ctx.fillText('长按识别查看商品', 200 ,that.canvasHeight - 75);
ctx.draw(true)
setTimeout(ress => {
uni.canvasToTempFilePath({
x: 0,
y: 0,
width: that.canvasWidth,
height: that.canvasHeight,
destWidth: that.canvasWidth,
destHeight: that.canvasHeight,
canvasId: 'myCanvas',
success: (res3) => {
that.canvasshow = false
that.tempFilePath = res3.tempFilePath
uni.previewImage({
urls: [res3.tempFilePath]
})
uni.hideLoading()
}
});
}, 500)
ctx.fillText('长按识别查看商品', (that.canvasHeight * 0.2 * 0.75) + 35 ,(that.canvasHeight * 0.8) + (that.canvasHeight * 0.2 * 0.47) + Number((codeWidth / 5).toFixed(0)));
ctx.draw(true,(()=>{
setTimeout(ress=>{
uni.canvasToTempFilePath({
x: 0,
y: 0,
width: that.canvasWidth,
height: that.canvasHeight,
destWidth: that.canvasWidth,
destHeight: that.canvasHeight,
canvasId: 'myCanvas',
success: (res3) => {
that.canvasshow = false
that.tempFilePath = res3.tempFilePath
uni.previewImage({
urls: [res3.tempFilePath]
})
uni.hideLoading()
}
});
},500)
})())
}
});
@ -525,7 +580,7 @@
priceType: type
}, false, true).then((res) => {
if (res.code == 200) {
this.khid = res.result.id
this.khid = res.result.id+'-'
} else {
this.tui.toast(res.message)
}
@ -1134,4 +1189,24 @@
margin-bottom: 80rpx;
overflow: scroll;
}
.content-list {
width: 100%;
display: flex;
height: 80rpx;
border-bottom: 1px solid #eee;
}
.list-name {
width: 100rpx;
text-align: left;
line-height: 80rpx;
height: 80rpx;
font-size: 36rpx;
}
.list-val {
width: 345rpx;
height: 80rpx;
line-height: 80rpx;
display: flex;
}
</style>
Loading…
Cancel
Save