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

2
pages/index/index.vue

@ -177,7 +177,7 @@
<view class="border-line"></view> <view class="border-line"></view>
<u-cell icon="rewind-right-fill" url="/package1/index/updateShopMsg" title="更新店铺信息" clickable <u-cell icon="rewind-right-fill" url="/package1/index/updateShopMsg" title="更新店铺信息" clickable
isLink arrow-direction="left"></u-cell> 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 icon="integral-fill" url="/package1/AI/addAiList" title="管理员登录" clickable isLink
arrow-direction="left"></u-cell> arrow-direction="left"></u-cell>
<!-- <u-cell icon="integral-fill" url="" title="电费缴纳" clickable isLink <!-- <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.khName)
console.log(this.carList) console.log(this.carList)
if(this.khName.categoryId != null){ if(this.khName.categoryId != null && this.khName.categoryId != ''){
this.carList.forEach(function(value, key) { this.carList.forEach(function(value, key) {
if(value.isChangePrice == undefined){ if(value.productId != '' && value.productId != null){
value.isChangePrice = false if(value.isChangePrice == undefined){
} value.isChangePrice = false
if(value.isChangeReturnPrice == undefined){ }
value.isChangeReturnPrice = false if(value.isChangeReturnPrice == undefined){
} value.isChangeReturnPrice = false
if(value.customerCategoryList != null){ }
let truePrice = 0 if(value.customerCategoryList != null){
let ischeckCustom = false let truePrice = 0
let ischeckCustomPrice = false let ischeckCustom = false
for(let i=0;i<value.customerCategoryList.length;i++){ let ischeckCustomPrice = false
if(Number(value.unitPrice) == Number(value.customerCategoryList[i].categoryPrice)){ for(let i=0;i<value.customerCategoryList.length;i++){
ischeckCustom = true 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 != ''){ if(ischeckCustomPrice && (Number(value.unitPrice) == Number(value.wholesalePrice) || Number(value.unitPrice) == Number(value.lsprice) || ischeckCustom) && !value.isChangePrice && !uni.getStorageSync('hangOrder')){
truePrice = value.customerCategoryList[i].categoryPrice value.unitPrice = truePrice
ischeckCustomPrice = true 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{ }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) }, 100 * i)
} else { //精准搜索 } 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] + '。') let voiceData = this.extractInfo(convertedStr[i] + '。')
if (voiceData.productSn) { if (voiceData.productSn) {
voiceData.productSn = voiceData.productSn.replace(/[沟勾钩]/g, 'J'); voiceData.productSn = voiceData.productSn.replace(/[沟勾钩]/g, 'J');
@ -6971,6 +6976,7 @@
} }
} catch (e) { } catch (e) {
let id = this.oneGoodsId
if (this.getMsg.indexOf('色,') != -1) { if (this.getMsg.indexOf('色,') != -1) {
this.getMsg = this.getMsg.replace(/色,/g, '色') this.getMsg = this.getMsg.replace(/色,/g, '色')
} }
@ -6983,6 +6989,15 @@
if (this.getMsg.indexOf('件') != -1) { if (this.getMsg.indexOf('件') != -1) {
this.getMsg = this.getMsg.replace(/件/g, '件,') 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", { await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", {
customerId:this.khName.id, customerId:this.khName.id,
questionMsg: this.getMsg questionMsg: this.getMsg
@ -6992,7 +7007,7 @@
this.voiceText1 = '' this.voiceText1 = ''
this.$refs.popup.close() this.$refs.popup.close()
let purchaseDetails = res.result.data.purchaseDetails let purchaseDetails = res.result.data.purchaseDetails
let id = this.oneGoodsId
if (purchaseDetails.length > 0) { if (purchaseDetails.length > 0) {
// this.carList.get(id).productCount = 0 // this.carList.get(id).productCount = 0
// this.carList.get(id).returnCount = 0 // this.carList.get(id).returnCount = 0
@ -7190,6 +7205,7 @@
}) })
} }
} else { } else {
let id = this.oneGoodsId
if (this.getMsg.indexOf('色,') != -1) { if (this.getMsg.indexOf('色,') != -1) {
this.getMsg = this.getMsg.replace(/色,/g, '色') this.getMsg = this.getMsg.replace(/色,/g, '色')
} }
@ -7202,16 +7218,25 @@
if (this.getMsg.indexOf('件') != -1) { if (this.getMsg.indexOf('件') != -1) {
this.getMsg = this.getMsg.replace(/件/g, '件,') 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", { await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", {
customerId:this.khName.id, customerId:this.khName.id,
questionMsg: this.getMsg questionMsg: this.getMsg
}, false, true).then((res) => { }, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.voiceText = '' this.voiceText = ''
this.voiceText1 = '' this.voiceText1 = ''
this.$refs.popup.close() this.$refs.popup.close()
let purchaseDetails = res.result.data.purchaseDetails let purchaseDetails = res.result.data.purchaseDetails
let id = this.oneGoodsId
if (purchaseDetails.length > 0) { if (purchaseDetails.length > 0) {
if (this.carList.get(id).productName == '') { if (this.carList.get(id).productName == '') {
this.carList.get(id).productName = purchaseDetails[0].productName this.carList.get(id).productName = purchaseDetails[0].productName
@ -7236,7 +7261,7 @@
if (isTrue == false && this.carList.get(id).productSn == '') { if (isTrue == false && this.carList.get(id).productSn == '') {
this.carList.get(id).productSn = purchaseDetails[0].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) { if (purchaseDetails[0].productId) {
this.carList.get(id).id = purchaseDetails[0].productId this.carList.get(id).id = purchaseDetails[0].productId
@ -7324,57 +7349,61 @@
this.carList = specMap this.carList = specMap
}) })
this.$nextTick(() => { this.$nextTick(() => {
for (let i = 0; i < purchaseDetails[0].stockLogList1.length; i++) { for(let j = 0; j < purchaseDetails.length; j++){
purchaseDetails[0].stockLogList1[i].name = this.sliceMsg( for (let i = 0; i < purchaseDetails[j].stockLogList1.length; i++) {
purchaseDetails[0].stockLogList1[i].attributeList) purchaseDetails[j].stockLogList1[i].name = this.sliceMsg(
if (this.carList.get(id).stockLogList.size == 0) { purchaseDetails[j].stockLogList1[i].attributeList)
this.carList.get(id).stockLogList.set(purchaseDetails[0] if (this.carList.get(id).stockLogList.size == 0) {
.stockLogList1[i].attributeList, purchaseDetails[0] this.carList.get(id).stockLogList.set(purchaseDetails[j]
.stockLogList1[i]) .stockLogList1[i].attributeList, purchaseDetails[j]
} else { .stockLogList1[i])
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
} else { } else {
this.carList.get(id).stockLogList.set(purchaseDetails[
0].stockLogList1[i].attributeList, if (this.carList.get(id).stockLogList.has(purchaseDetails[
purchaseDetails[0].stockLogList1[i]) 0].stockLogList1[i].attributeList) == true) {
this.carList.get(id).stockLogList.get( this.carList.get(id).stockLogList.get(purchaseDetails[
purchaseDetails[0].stockLogList1[i] 0].stockLogList1[i].attributeList)
.attributeList).productNum = this.carList.get(id).stockLogList.get( .productCount +=
purchaseDetails[0].stockLogList1[i] purchaseDetails[j].stockLogList1[i]
.attributeList).stockCount .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( if (this.carList.get(id).stockLogList.get(
'{"颜色":"均色","尺码":"均码"}').productCount == 1 && this.carList.get( '{"颜色":"均色","尺码":"均码"}')) {
id) if (this.carList.get(id).stockLogList.get(
.stockLogList.size> 1&& '{"颜色":"均色","尺码":"均码"}').productCount == 1 && this.carList.get(
purchaseDetails[0].stockLogList1.length > 0) { id)
this.carList.get(id).stockLogList.delete( .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).price = Number(this.carList.get(id).productCount) *
this.carList.get(id).discountAmount this.carList.get(id).discountAmount
}) })
@ -8499,7 +8528,7 @@
this.getMsg = this.getMsg.replace(/货号/g, '') this.getMsg = this.getMsg.replace(/货号/g, '')
} }
this.tui.request("/app/sale/buyAi", "POST", { this.tui.request("/app/sale/buyAi", "POST", {
aiMsg: "请返回以下规格:"+this.getMsg, aiMsg: "请返回以下规格"+this.getMsg,
productId: this.oneGoodsId productId: this.oneGoodsId
}, false, true).then((res) => { }, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
@ -8571,7 +8600,7 @@
this.getMsg = this.getMsg.replace(/货号/g, '') this.getMsg = this.getMsg.replace(/货号/g, '')
} }
this.tui.request("/app/sale/buyAi", "POST", { this.tui.request("/app/sale/buyAi", "POST", {
aiMsg: "请返回以下规格:"+this.getMsg, aiMsg: "请返回以下规格"+this.getMsg,
productId: this.oneGoodsId productId: this.oneGoodsId
}, false, true).then((res) => { }, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
@ -8664,9 +8693,11 @@
if (shopId == uni.getStorageSync('shopId').substring('10','12')) { if (shopId == uni.getStorageSync('shopId').substring('10','12')) {
that.productId = base.decode(res.result.split(',')[0]) that.productId = base.decode(res.result.split(',')[0])
that.toggle('bottom', base.decode(res.result.split(',')[0])); that.toggle('bottom', base.decode(res.result.split(',')[0]));
setTimeout(res => { if(that.attrBuilt != null && that.attrBuilt != ''){
that.scanCodeAdd() setTimeout(res => {
}, 1100) that.scanCodeAdd()
}, 1100)
}
} else { } else {
setTimeout(res => { setTimeout(res => {
that.tui.toast('您的店铺中暂无该商品!') that.tui.toast('您的店铺中暂无该商品!')
@ -11998,7 +12029,7 @@
} }
}).catch((res) => {}) }).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", { this.tui.request("/app/product/getByUserIdAndProductIds", "POST", {
userId: this.khName.id, userId: this.khName.id,

157
pages/inventory/inventory.vue

@ -204,6 +204,14 @@
<!-- 弹出输入框 --> <!-- 弹出输入框 -->
<uni-popup ref="sharePriceDialog" background-color="#fff"> <uni-popup ref="sharePriceDialog" background-color="#fff">
<view class="popup-pay-content"> <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"> <view class="popup-pay-title">
<text>选择商品价格</text> <text>选择商品价格</text>
</view> </view>
@ -213,13 +221,16 @@
<view class="popup-pay-container" @tap="checkPay('1')"> <view class="popup-pay-container" @tap="checkPay('1')">
<text style="display: inline-block">以批发价分享</text> <text style="display: inline-block">以批发价分享</text>
</view> </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> </view>
</uni-popup> </uni-popup>
<!-- 弹出层 --> <!-- 弹出层 -->
<uni-popup ref="sharePopup" background-color="#fff"> <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 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" <view @tap="$refs.sharePopup.close()" class="popup-photo"
style="border-bottom:0;border-top:10px solid #eee;">取消</view> style="border-bottom:0;border-top:10px solid #eee;">取消</view>
</view> </view>
@ -305,9 +316,9 @@
return { return {
canvasshow: false, canvasshow: false,
size: 30, size: 30,
customerCategoryList: [],
indexList: [], indexList: [],
zheng: '0', zheng: '0',
khName:{},
canvasWidth:0, canvasWidth:0,
canvasHeight:0, canvasHeight:0,
fu: '0', fu: '0',
@ -330,18 +341,16 @@
shopList1: [], shopList1: [],
picture: '', picture: '',
gateType: '', gateType: '',
total: 0 total: 0,
customerCategoryList:[]
} }
}, },
onLoad(option) { onLoad(option) {
if (option.khid != undefined) { if (option.khid != undefined) {
uni.redirectTo({ 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 let that = this
this.type = uni.getStorageSync('type') this.type = uni.getStorageSync('type')
uni.getSystemInfo({ uni.getSystemInfo({
@ -349,12 +358,13 @@
that.windowHeight = info.windowHeight that.windowHeight = info.windowHeight
} }
}); });
this.getCustomerCategoryList()
}, },
onShareAppMessage() { onShareAppMessage() {
return { return {
title: '查看我的推荐', title: uni.getStorageSync('shopName') +'给您推荐的商品',
imageUrl: this.picture, imageUrl: this.picture,
path: '/package1/index/downStearmList?khid=' + this.khid + '&userId=""' path: '/package1/index/oneGoodsShare?khid=' + this.khid + '&userId='+this.khName.id
} }
}, },
onReachBottom() { onReachBottom() {
@ -369,7 +379,7 @@
}, },
onShow() { onShow() {
console.log('shopList', this.shopList) console.log('shopList', this.khName)
if (uni.getStorageSync('noReload') == true) { if (uni.getStorageSync('noReload') == true) {
this.searchName = '' this.searchName = ''
uni.removeStorageSync('noReload') uni.removeStorageSync('noReload')
@ -381,9 +391,46 @@
this.getweiruku() this.getweiruku()
}, },
methods: { 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() { getUserData() {
let that = this; 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", { this.tui.request("/order/ow/getWechatQrcode", "post", {
// page: 'package1/index/oneGoodsShare',
page: 'package1/index/downStearmList', page: 'package1/index/downStearmList',
scene: this.khid, scene: this.khid,
envVersion: __wxConfig.envVersion, envVersion: __wxConfig.envVersion,
@ -416,7 +463,7 @@
title: '生成中...' title: '生成中...'
}) })
this.canvasshow = true this.canvasshow = true
const ctx = uni.createCanvasContext('myCanvas', this);
//背景图 //背景图
let imgA = this.goodsData.productPicture; let imgA = this.goodsData.productPicture;
@ -431,51 +478,59 @@
// that.canvasWidth = (image.width/ Number((image.height/1500).toFixed(2))).toFixed(0) // that.canvasWidth = (image.width/ Number((image.height/1500).toFixed(2))).toFixed(0)
// }else{ // }else{
that.canvasWidth = image.width 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
}
// } // }
console.log(that.canvasWidth);
const ctx = uni.createCanvasContext('myCanvas', this); console.log(that.canvasHeight);
ctx.setFillStyle('#fff'); ctx.setFillStyle('#fff');
ctx.fillRect(0, 0, that.canvasWidth, that.canvasHeight); ctx.fillRect(0, 0, that.canvasWidth, that.canvasHeight);
// // 绘制第一张图片 // // 绘制第一张图片
ctx.drawImage(image.path, 0, 0, image.width, image.height); ctx.drawImage(image.path, 0, 0, image.width, image.height);
ctx.draw() 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.draw(true);
ctx.font = "20px 宋体"; ctx.font = "20px 宋体";
// 设置字体样式 // 设置字体样式
ctx.setFontSize(28) let codeWidth = that.canvasHeight * 0.2 * 0.75
ctx.setFontSize((codeWidth / 6).toFixed(0))
// 设置文字颜色 // 设置文字颜色
ctx.fillStyle = '#FF5809'; 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.fillStyle = '#000';
// 绘制文字 // 绘制文字
ctx.fillText('长按识别查看商品', 200 ,that.canvasHeight - 75); 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) ctx.draw(true,(()=>{
setTimeout(ress => { setTimeout(ress=>{
uni.canvasToTempFilePath({ uni.canvasToTempFilePath({
x: 0, x: 0,
y: 0, y: 0,
width: that.canvasWidth, width: that.canvasWidth,
height: that.canvasHeight, height: that.canvasHeight,
destWidth: that.canvasWidth, destWidth: that.canvasWidth,
destHeight: that.canvasHeight, destHeight: that.canvasHeight,
canvasId: 'myCanvas', canvasId: 'myCanvas',
success: (res3) => { success: (res3) => {
that.canvasshow = false that.canvasshow = false
that.tempFilePath = res3.tempFilePath that.tempFilePath = res3.tempFilePath
uni.previewImage({ uni.previewImage({
urls: [res3.tempFilePath] urls: [res3.tempFilePath]
}) })
uni.hideLoading() uni.hideLoading()
} }
}); });
}, 500) },500)
})())
} }
}); });
@ -525,7 +580,7 @@
priceType: type priceType: type
}, false, true).then((res) => { }, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.khid = res.result.id this.khid = res.result.id+'-'
} else { } else {
this.tui.toast(res.message) this.tui.toast(res.message)
} }
@ -1134,4 +1189,24 @@
margin-bottom: 80rpx; margin-bottom: 80rpx;
overflow: scroll; 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> </style>
Loading…
Cancel
Save