Browse Source

二期海报分享

twodate
Enzo 4 years ago
parent
commit
75a2bc99ca
  1. 3
      common/api.js
  2. 111
      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'; // 扫码核销

111
pages/center/invite.vue

@ -8,20 +8,20 @@
<view class="canvas-box">
<canvas style="width: 375px;height: 667px;position:fixed;top:9999px" canvas-id="mycanvas" />
</view>
<view class="btn-bottom" style="bottom: 40rpx;">
<view class="padding-lr-lg">
<button class="cu-btn block bg-orange lg" style="border-radius: 42rpx;" @tap="saveBill()">
<text class="lf-font-32 text-white">保存</text>
</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>
</template>
@ -41,10 +41,11 @@
},
showLogin: true,
imagePath: '',
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
@ -166,14 +185,14 @@
width: 100%;
height: 366rpx;
}
.mine {
display: block;
text-align: center;
color: #333;
margin-top: 44rpx;
}
.code {
display: block;
text-align: center;
@ -182,7 +201,7 @@
font-weight: bold;
margin-top: 30rpx;
}
.who {
display: block;
margin-top: 80rpx;
@ -190,12 +209,12 @@
color: #333;
text-align: center;
}
.inputBox {
text-align: center;
margin-top: 44rpx;
}
.input {
text-align: center;
width: 440rpx;
@ -205,7 +224,7 @@
font-size: 32rpx;
display: inline-block;
}
.btn {
width: 160rpx;
height: 88rpx;
@ -218,18 +237,18 @@
line-height: 88rpx;
margin-left: 40rpx;
}
button[class="btn"]::after {
border: 0;
}
.tishi {
display: block;
text-align: center;
color: #999;
margin-top: 30rpx;
}
.shareText {
display: block;
text-align: center;
@ -237,24 +256,24 @@
font-size: 28rpx;
margin-top: 100rpx;
}
.imgBox {
text-align: center;
width: 100%;
margin-top: 60rpx;
padding-bottom: 120rpx;
}
.img {
display: inline-block;
width: 100%;
height: 100%;
}
.m_l {
margin-left: 180rpx;
}
.zfbtn {
display: inline-block;
width: 120rpx;
@ -265,15 +284,15 @@
border: 0;
padding: 0;
}
button[class="zfbtn"]::after {
border: 0;
}
button[class="zfbtn m_l"]::after {
border: 0;
}
.imagePathBox {
width: 100%;
height: 100%;
@ -285,7 +304,7 @@
bottom: 0;
z-index: 10;
}
.shengcheng {
width: 80%;
height: 80%;
@ -295,7 +314,7 @@
margin-left: -40%;
z-index: 10;
}
.baocun {
display: block;
width: 80%;
@ -311,7 +330,7 @@
font-size: 32rpx;
border-radius: 44rpx;
}
button[class="baocun"]::after {
border: 0;
}

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