Browse Source

二期海报分享

twodate
Enzo 4 years ago
parent
commit
75a2bc99ca
  1. 3
      common/api.js
  2. 65
      pages/center/invite.vue
  3. 61
      pages/center/widthdraw.vue
  4. 53
      pages/goodsDetail/index.vue
  5. 2
      pages/index/index.vue

3
common/api.js

@ -64,6 +64,9 @@ export const API_FANS = '/api/salesman/fans'//获取粉丝列表
export const API_BINDGOODS = '/api/salesman/share'//商品海报分享绑定
export const API_BINDSALES = '/api/salesman/shareMan'//分销海报分享绑定
export const API_BILLBACKGROUND = '/api/share/img'//海报背景图接口
export const API_WXBILL = '/api/salesman/qrcode'//微信小程序太阳码
/* 商户相关 */
export const API_CONFIRM_CODE = '/api/confirm/code'; // 扫码核销

65
pages/center/invite.vue

@ -16,10 +16,10 @@
</button>
</view>
<view class="flex justify-center align-center lf-m-t-30">
<!-- <view class="flex justify-center align-center lf-m-t-30">
<view class="lf-color-gray lf-font-28">https//hbdsufiewhuifusikj.com</view>
<view class="lf-font-24 text-orange lf-m-l-30" @click="copy('https://hbdsufiewhuifusikj.com')">复制</view>
</view>
</view> -->
</view>
</view>
@ -44,7 +44,8 @@
userToken: '',
wxCode: '',
onceCode: ''
onceCode: '',
backgroundImg: ''
}
},
onLoad() {
@ -54,24 +55,37 @@
duration: 1000
});
this.getWxCode()
this.getBackground()
},
methods:{
methods: {
getBackground() {
let _this = this
_this.$http(_this.API.API_BILLBACKGROUND, {
type: 'telent_share'
}).then(res => {
let img = res.data.img_url
if (img) {
wx.getImageInfo({
src: img,
success: function(sres) {
_this.backgroundImg = sres.path
console.log('临时路径',_this.backgroundImg)
}
})
}
})
},
getWxCode() {
uni.request({
url: 'http://dev-gxsky.com/api/salesman/qrcode', //
data: {
scene: 'route=home&id=2&pt=2',
page: 'pages/route/index',
width: '2800'
},
method: 'POST',
success: (res) => {
this.wxCode = res.data.data.base_url
if (this.wxCode) {
this.getwxCodeImg()
}
this.$http(this.API.API_WXBILL, {
scene: 'route=home&id=2&pt=2',
page: 'pages/route/index',
width: '2800'
}).then(res => {
this.wxCode = res.data.base_url
if (this.wxCode) {
this.getwxCodeImg()
}
});
})
},
//
getwxCodeImg() {
@ -84,9 +98,13 @@
encoding: 'base64',
success: res => {
this.onceCode = wx.env.USER_DATA_PATH + '/pic' + number + '.jpg'
if(this.onceCode) {
console.log('小程序二维码',this.onceCode)
console.log(this.onceCode)
if (this.onceCode && this.backgroundImg) {
this.createNewImg()
}else if(!this.onceCode){
this.$msg('小程序码生成失败!')
}else if(!this.backgroundImg){
this.$msg('海报背景图生成失败!')
}
},
fail: err => {
@ -97,7 +115,8 @@
createNewImg() {
var that = this;
var context = wx.createCanvasContext('mycanvas');
var path = "../../static/images/bill.png";
console.log('画布', that.backgroundImg)
var path = that.backgroundImg;
context.drawImage(path, 0, 0, 375, 667);
//
let wxcode = that.onceCode
@ -115,7 +134,7 @@
canvasId: 'mycanvas',
success: function(res) {
that.imagePath = res.tempFilePath;
if(that.imagePath) {
if (that.imagePath) {
that.canvasHidden = true
that.maskHidden = true
}
@ -125,7 +144,7 @@
console.log(res);
}
});
},900);
}, 900);
},
saveBill() {
var that = this

61
pages/center/widthdraw.vue

@ -1,50 +1,6 @@
<template>
<view class="wrap">
<view class="lf-p-30" style="height: 408rpx;">
<view class="bg-white lf-h-100" style="border-radius: 10rpx;">
<view class="text-black lf-font-28 lf-p-l-30 lf-p-t-30">提取金额</view>
<view class="lf-p-l-20 flex solid-bottom align-center" style="padding-top: 90rpx;">
<text class="text-black lf-font-48 unit"></text>
<!-- <u-input v-model="num" :type="type" :border="border" :height="height" :auto-height="autoHeight"/> -->
<input type="number" @focus="showClear()" v-model="num" class="lf-p-l-10 text-black1" style="width: 80%;padding-right: 30rpx;font-size: 72rpx;height: 100rpx;" />
<view v-if="showClean && num != ''">
<u-icon @click="clearAble()" name="close-circle" color="#999999" size="40"></u-icon>
</view>
</view>
<view class="lf-font-28 lf-color-999 lf-p-t-26 lf-p-l-30" v-if="num==''">
可用余额
<text>0.00</text>
</view>
<view v-else class="lf-color-price lf-font-28 lf-p-t-26 lf-p-l-30">输入金额超过可用余额</view>
</view>
</view>
<view class="lf-p-l-30 lf-p-r-30 lf-p-b-30" style="height: auto;">
<view class="bg-white lf-h-100 lf-p-30" style="border-radius: 10rpx; box-sizing: border-box;">
<view class="text-black lf-font-28">提现说明</view>
<view class="flex flex-direction justify-around lf-p-t-20">
<view class="lf-font-28" style="color: #555;">
1提现到账时间为T+1
</view>
<view class="lf-font-28" style="color: #555;">
2提现最高单笔金额为1000元
</view>
<view class="lf-font-28" style="color: #555;">
3提现手续费单笔收费10%
</view>
</view>
</view>
</view>
<view class="btn-bottom" style="bottom: 60rpx;">
<view class="padding-lr-lg">
<button class="cu-btn block bg-orange lg" style="border-radius: 42rpx;" @tap="subimitApply()">
<text class="lf-font-32 text-white">提现</text>
</button>
</view>
</view>
<web-view :src="'http://192.168.3.14:8080/?user='+userInfo"></web-view>
</view>
</template>
@ -52,18 +8,15 @@
export default {
data() {
return {
num: '',
showClean: false
userInfo: ''
}
},
methods: {
clearAble() {
this.num = ''
this.showClean = false
},
showClear() {
this.showClean = true
}
},
onLoad(e) {
this.userInfo = uni.getStorageSync('userinfo') || {};
console.log(this.userInfo)
}
}
</script>

53
pages/goodsDetail/index.vue

@ -138,7 +138,8 @@
wxCode: '',
onceCode: '',
pt: 1,
afterDone: ''
afterDone: '',
backgroundImg: ''
}
},
computed: {
@ -153,8 +154,25 @@
this.pt = options.pt || 1;
this.getGoodsDetail();
this.getWxCode()
this.getBackground()
},
methods: {
getBackground() {
let _this = this
_this.$http(_this.API.API_BILLBACKGROUND, {
type: 'goods'
}).then(res => {
let img = res.data.img_url
if (img) {
wx.getImageInfo({
src: img,
success: function(sres) {
_this.backgroundImg = sres.path
}
})
}
})
},
//
bindGoods() {
var _this = this;
@ -186,21 +204,16 @@
},
getWxCode() {
let userInfo = uni.getStorageSync('userinfo') || {};
uni.request({
url: 'http://dev-gxsky.com/api/salesman/qrcode', //
data: {
scene: 'route=goods&pt=2&id='+this.goods_id+'&share_id='+userInfo.id,
page: 'pages/route/index',
width: '2800'
},
method: 'POST',
success: (res) => {
this.wxCode = res.data.data.base_url
if (this.wxCode) {
this.getwxCodeImg()
}
this.$http(this.API.API_WXBILL, {
scene: 'route=goods&pt=2&id='+this.goods_id+'&share_id='+userInfo.id,
page: 'pages/route/index',
width: '2800'
}).then(res => {
this.wxCode = res.data.base_url
if (this.wxCode) {
this.getwxCodeImg()
}
});
})
},
//
//
@ -223,7 +236,7 @@
createNewImg() {
var that = this;
var context = wx.createCanvasContext('mycanvas');
var path = "../../static/images/bill.png";
var path = that.backgroundImg;
context.drawImage(path, 0, 0, 375, 667);
//
let wxcode = that.onceCode
@ -286,8 +299,14 @@
duration: 1000
});
wx.hideToast()
if(that.onceCode) {
console.log(that.onceCode)
console.log(that.backgroundImg)
if(that.onceCode&&that.backgroundImg) {
that.createNewImg()
}else if(!that.onceCode){
this.$msg('小程序码生成失败!')
}else if(!that.backgroundImg){
this.$msg('海报背景图生成失败!')
}
},
//

2
pages/index/index.vue

@ -70,7 +70,7 @@
this.windowHeight = getApp().globalData.windowHeight;
this.getCategoryList();
this.getShareInfo();
if(this.pt == 1) {
if(this.pt == 2) {
this.bindUsders()
}
},

Loading…
Cancel
Save