圣诞快乐

# v1.3 更新列表
    1. 【新增】砍价
	2. 【新增】拼团
	3. 【新增】一号通
	4. 【修复】商品sku 编辑时出现商品属性对应错误的问题
	5. 【修复】商品推广海报生成二维码可能会出错的问题【小程序调试中】
	6. 【修复】微信公众号和小程序头像可能获取不到的问题
	7. 【修复】下单时可能会出错的问题
	8. 【修复】pc管理端用户访问量
	9. 【修复】微信退款
	10. 【修复】管理端订单状态可能出现不正确的情况
	11. 【修复】WEB管理端-菜单色调,短信API更新,首页用户访问量,系统设置tab是自动选择下一及表单
	12. 【修复】系统设置出现更新不正确的问题
This commit is contained in:
stivepeim
2020-12-23 15:56:45 +08:00
parent d5fc46a211
commit 099fc3de81
768 changed files with 40200 additions and 46123 deletions

View File

@@ -1,7 +1,7 @@
<template>
<view>
<view class='bargain-list'>
<view class='iconfont icon-xiangzuo' @tap='goBack' :style="'top:'+ (navH/2) +'rpx'"></view>
<view class='iconfont icon-xiangzuo' @tap='goBack' :style="'top:'+ (navH/2) +'rpx'" v-if="returnShow"></view>
<view class='header'></view>
<view class='list'>
<block v-for="(item,index) in bargainList" :key="index">
@@ -11,12 +11,15 @@
</view>
<view class='text acea-row row-column-around'>
<view class='name line1'>{{item.title}}</view>
<view class='num'><text class='iconfont icon-pintuan'></text>{{item.people}}人正在参与</view>
<view class='money font-color'>最低: <text class='price'>{{item.min_price}}</text></view>
<view class='num'><text class='iconfont icon-pintuan'></text>{{item.countPeopleAll}}人正在参与</view>
<view class='money font-color'>最低: <text class='price'>{{item.minPrice}}</text></view>
</view>
<view class='cutBnt bg-color'><text class='iconfont icon-kanjia'></text>参与砍价</view>
</view>
</block>
<view class='loadingicon acea-row row-center-wrapper' v-if='bargainList.length > 0'>
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
</view>
</view>
</view>
<!-- #ifdef MP -->
@@ -57,21 +60,24 @@
return {
bargainList: [],
page: 1,
limit: 20,
limit: 10,
loading: false,
loadend: false,
userInfo: {},
navH: '',
isAuto: false, //没有授权的不会自动授权
isShowAuth: false //是否隐藏授权
isShowAuth: false, //是否隐藏授权
returnShow:true,
loadTitle: '加载更多'
};
},
computed: mapGetters(['isLogin']),
onLoad: function(options) {
var pages = getCurrentPages();
this.returnShow = pages.length===1?false:true;
uni.setNavigationBarTitle({
title:"砍价列表"
})
this.navH = app.globalData.navHeight;
if (this.isLogin) {
this.getUserInfo();
@@ -136,16 +142,22 @@
if (that.loadend) return;
if (that.loading) return;
that.loading = true;
that.loadTitle = '';
getBargainList({
page: that.page,
limit: that.limit
}).then(function(res) {
that.$set(that, 'bargainList', that.bargainList.concat(res.data));
let list = res.data.list;
let bargainList = that.$util.SplitArray(list, that.bargainList);
let loadend = list.length < that.limit;
that.loadend = loadend;
that.loading = false;
that.loadTitle = loadend ? '已全部加载' : '加载更多';
that.$set(that, 'bargainList', bargainList);
that.$set(that, 'page', that.page + 1);
that.$set(that, 'loadend', that.limit > res.data.length);
that.$set(that, 'loading', false);
}).catch(res => {
that.loading = false;
that.loadTitle = '加载更多';
});
}
},

View File

@@ -6,7 +6,7 @@
<view class="header" :class="bargainUid != userInfo.uid ? 'on' : ''">
<view class='people' >
<!-- :style="'top:'+navH/2+'rpx'" -->
{{bargainCount.lookCount}}人查看 {{bargainCount.shareCount}}人分享 {{bargainCount.userCount}}人参与
{{bargainCount.lookCount || 0}}人查看 {{bargainCount.shareCount || 0}}人分享 {{bargainCount.userCount || 0}}人参与
</view>
<!-- <view class='time font-color' v-if="bargainUid == userInfo.uid">
倒计时
@@ -25,7 +25,7 @@
<image :src='bargainUserInfo.avatar'></image>
</view>
<view class='text'>
{{bargainUserInfo.nickname}}
{{bargainUserInfo.nickname || ''}}
<text>邀请您帮忙砍价</text>
</view>
</view>
@@ -45,7 +45,7 @@
当前:
<text class='num'>{{bargainInfo.price}}</text>
</view>
<view class='successNum'>最低:{{bargainInfo.min_price}}</view>
<view class='successNum'>最低:{{bargainInfo.minPrice}}</view>
<!-- <view class='successNum'>已有{{bargainSumCount}}人砍价成功</view> -->
</view>
</view>
@@ -60,14 +60,20 @@
</view>
</block>
<!-- 自己砍价 -->
<view v-if="bargainUid == userInfo.uid && !userBargainStatus && bargainUserHelpInfo.price > 0">
<view v-if="bargainUid == userInfo.uid && (userBargainStatus===0 || userBargainStatus === bargainSumCount) && bargainUserHelpInfo.price > 0">
<view class='bargainBnt' @tap='userBargain' v-if="productStock>0&&quota>0">
立即参与砍价
</view>
<view class='bargainBnt grey' v-if="productStock<=0||quota<=0">商品暂无库存</view>
</view>
<!-- <view v-if="bargainUid == userInfo.uid && !userBargainStatus && bargainUserHelpInfo.price > 0">
<view class='bargainBnt' @tap='userBargain' v-if="productStock>0&&quota>0">
立即参与砍价
</view>
<view class='bargainBnt grey' v-if="productStock<=0||quota<=0">立即参与砍价</view>
</view>
</view> -->
<!-- 帮助砍价帮砍成功 -->
<view v-if="bargainUid == userInfo.uid && bargainUserHelpInfo.price > 0 && userBargainStatus">
<view v-if="bargainUid == userInfo.uid && bargainUserHelpInfo.price > 0 && userBargainStatus != bargainSumCount">
<!-- #ifdef H5 -->
<view class='bargainBnt' v-if="$wechat.isWeixin()" @click="H5ShareBox = true">邀请好友帮砍价</view>
<view class='bargainBnt' v-else @tap='getBargainUserBargainPricePoster'>邀请好友帮砍价</view>
@@ -92,8 +98,14 @@
</view>
<view class='bargainBnt' @tap='currentBargainUser'>我也要参与</view>
</view>
<view v-if="bargainUid != userInfo.uid && !userBargainStatusHelp">
<view v-if="bargainUid != userInfo.uid && !userBargainStatusHelp && isHelp">
<view class='bargainSuccess'>
<text class='iconfont icon-xiaolian'></text>
您已帮其他好友砍过此商品
</view>
<view class='bargainBnt' @tap='currentBargainUser'>我也要参与</view>
</view>
<view v-if="bargainUid != userInfo.uid && !userBargainStatusHelp && !isHelp">
<view class='bargainSuccess'>
<text class='iconfont icon-xiaolian'></text>
已成功帮助好友砍价
@@ -122,7 +134,7 @@
</view>
</view>
<view class='list'>
<block v-for="(item,index) in bargainUserHelpList" :key='index'>
<block v-for="(item,index) in bargainUserHelpList" :key='index' v-if="index<3 || !couponsHidden">
<view class='item acea-row row-between-wrapper'>
<view class='pictxt acea-row row-between-wrapper'>
<view class='pictrue'>
@@ -139,6 +151,7 @@
</view>
</view>
</block>
<view class="open acea-row row-center-wrapper" @click="openTap" v-if="bargainUserHelpList.length>3">{{couponsHidden?'展开更多':'关闭展开'}}<text class="iconfont" :class='couponsHidden==true?"icon-xiangxia":"icon-xiangshang"'></text></view>
</view>
<view class='load font-color' v-if="!limitStatus" @tap='getBargainUser'>点击加载更多</view>
<view class='lock'></view>
@@ -155,7 +168,7 @@
</view>
<view class='conter'>
<!-- <template is="wxParse" data="{{wxParseData:description.nodes}}" /> -->
<jyf-parser :html="bargainInfo.description" ref="article" :tag-style="tagStyle"></jyf-parser>
<jyf-parser :html="bargainInfo.content" ref="article" :tag-style="tagStyle"></jyf-parser>
<!-- <rich-text :nodes="bargainInfo.description" class="conter"></rich-text> -->
</view>
<view class='lock'></view>
@@ -182,7 +195,7 @@
<view v-if="bargainUid == userInfo.uid">
<view class='cutOff'>
您已砍掉
<text class='font-color'>{{bargainUserBargainPrice.price}}</text>
<text class='font-color'>{{bargainUserBargainPrice}}</text>
听说分享次数越多砍价成功的机会越大哦
</view>
<!-- #ifdef MP -->
@@ -193,7 +206,7 @@
<!-- #endif -->
</view>
<view v-else>
<view class='help font-color'>成功帮砍{{bargainUserBargainPrice.price}}</view>
<view class='help font-color'>成功帮砍{{bargainUserBargainPrice}}</view>
<view class='cutOff on'>您也可以砍价低价拿哦快去挑选心仪的商品吧~</view>
<view @tap='currentBargainUser' class='tipBnt'>我也要参与</view>
</view>
@@ -267,26 +280,26 @@
bargainUid: 0, //开启砍价用户
bargainUserInfo: {}, //开启砍价用户信息
bargainUserId: 0, //开启砍价编号
bargainInfo: [], //砍价产品
offset: 0,
limit: 20,
bargainInfo: {}, //砍价产品
page: 1,
limit: 5,
limitStatus: false,
bargainUserHelpList: [],
bargainUserHelpInfo: [],
bargainUserBargainPrice: 0,
bargainUserBargainPrice: 0, //砍了多少钱
status: '', // 0 开启砍价 1 朋友帮忙砍价 2 朋友帮忙砍价成功 3 完成砍价 4 砍价失败 5已创建订单
bargainCount: [], //分享人数 浏览人数 参与人数
retunTop: true,
bargainPartake: 0,
isHelp: false,
interval: null,
userBargainStatus: 0, //判断自己是否砍价
userBargainStatus: 0, // 用户开启的砍价活动次数
productStock: 0, //判断是否售罄;
quota: 0, //判断是否已限量;
userBargainStatusHelp: true,
navH: '',
statusPay: '',
bargainSumCount:0,
statusPay: '', //活动状态1参与中2活动结束参与失败3活动结束参与成功
bargainSumCount:0, //用户成功支付的砍价订单数
bargainPrice:0,
datatime:0,
offest:'',
@@ -298,6 +311,9 @@
isAuto: false, //没有授权的不会自动授权
isShowAuth: false, //是否隐藏授权
pages:'',
couponsHidden: true,
loading: false,
loadend: false
}
},
@@ -369,6 +385,9 @@
})
},
methods: {
openTap() {
this.$set(this,'couponsHidden',!this.couponsHidden);
},
// 授权关闭
authColse: function(e) {
this.isShowAuth = e;
@@ -376,14 +395,21 @@
// 去商品页
goProduct(){
uni.navigateTo({
url:`/pages/goods_details/index?id=${this.bargainInfo.product_id}`
url:`/pages/goods_details/index?id=${this.bargainInfo.productId}`
})
},
// 自己砍价;
userBargain:function(){
let that = this;
if (that.userInfo.uid == that.bargainUid){
that.setBargain();
if (that.userBargainStatus == that.bargainInfo.num) {
return that.$util.Tips({
title: `该商品每人限购${that.bargainInfo.num}${that.bargainInfo.unitName}`
});
} else {
this.page = 1;
that.setBargain();
}
}
},
goBack: function() {
@@ -393,9 +419,6 @@
},
gobargainUserInfo: function() { //获取开启砍价用户信息
var that = this;
var data = {
userId: that.bargainUid
};
postBargainStartUser({
bargainId: that.id,
bargainUserUid: that.bargainUid
@@ -406,22 +429,18 @@
goPay: function() { //立即支付
var that = this;
var data = {
productId: that.bargainInfo.product_id,
bargainId: that.id,
cartNum: that.bargainInfo.num,
uniqueId: '',
combinationId: 0,
secKillId: 0,
'new': 1
isNew: true,
productId: that.bargainInfo.productId,
bargainId: that.bargainInfo.id,
cartNum: 1,
productAttrUnique: that.bargainInfo.attrValue[0].id
};
postCartAdd(data).then(res => {
uni.navigateTo({
url: '/pages/users/order_confirm/index?cartId=' + res.data.cartId
url: '/pages/users/order_confirm/index?new=true&cartId=' + res.data.cartId + '&bargain=true'
});
}).catch(err => {
return app.Tips({
title: err
})
return that.$util.Tips({title:err})
});
},
getBargainDetails: function() { //获取砍价产品详情
@@ -433,12 +452,11 @@
that.userInfo = res.data.userInfo;
that.bargainSumCount = res.data.bargainSumCount;
that.userBargainStatus = res.data.userBargainStatus;
that.productStock = res.data.bargain.attr.product_stock;
that.quota = res.data.bargain.attr.quota;
that.datatime = res.data.bargain.stop_time
that.productStock = res.data.bargain.stock;
that.quota = res.data.bargain.quota;
that.datatime = res.data.bargain.endTime/1000;
that.pages = '/pages/activity/goods_bargain_details/index?id=' + that.id + '&bargain=' +
that.bargainUid + '&scene=' + that.userInfo.uid;
console.log(that.pages);
uni.setNavigationBarTitle({
title:res.data.bargain.title.substring(0,13)+'...'
})
@@ -450,7 +468,15 @@
that.setOpenShare();
//#endif
}).catch(function(err) {
that.$util.Tips({title:err})
// uni.navigateTo({
// url: window.location.protocol + "//" + window.location.host +'/pages/activity/goods_bargain/index',
// });
that.$util.Tips({
title: err
}, {
tab: 2,
url: '/pages/activity/goods_bargain/index'
});
})
},
getBargainHelpCount: function () {//获取砍价帮总人数、剩余金额、进度条、已经砍掉的价格
@@ -462,6 +488,11 @@
that.bargainInfo.price = parseFloat(price) <= 0 ? 0 : price;
that.userBargainStatusHelp = res.data.userBargainStatus;
that.statusPay = res.data.status;
this.isHelp = res.data.isConsume;
}).catch(function(err) {
that.$util.Tips({
title: err
});
})
},
currentBargainUser: function() { //当前用户砍价
@@ -471,12 +502,20 @@
setBargain: function() { //参与砍价
var that = this;
postBargainStart(that.id).then(res => {
if (res.code === 'subscribe') {
return;
}
that.$set(that, 'bargainUserId', res.data);
that.getBargainUserBargainPrice();
// that.getBargainUserBargainPrice();
that.setBargainHelp();
that.getBargainHelpCount();
that.userBargainStatus = 1;
})
},error => {
this.bargainUid = 0;
that.$util.Tips({
title: error
})
})
},
setBargainHelp: function() { //帮好友砍价
var that = this;
@@ -485,10 +524,18 @@
bargainUserUid: that.bargainUid
};
postBargainHelp(data).then(res => {
// if(res.data.isConsume){
// that.$set(that, 'isHelp', true);
// }else{
// that.$set(that, 'isHelp', false);
// that.$set(that, 'active', true);
// }
that.page = 1;
that.$set(that, 'bargainUserHelpList', []);
that.$set(that, 'isHelp', true);
that.getBargainUser();
that.getBargainUserBargainPrice();
that.$set(that, 'bargainUserBargainPrice', res.data.bargainPrice);
that.$set(that, 'active', true);
//that.getBargainUserBargainPrice();
that.getBargainHelpCount();
}).catch(err => {
that.$util.Tips({
@@ -500,22 +547,36 @@
},
getBargainUser: function() { //获取砍价帮
var that = this;
// if (that.loadend) return;
if (that.loading) return;
var data = {
bargainId: that.id,
bargainUserUid: that.bargainUid,
offset: that.offset,
};
var datas = {
page: that.page,
limit: that.limit,
};
postBargainHelpList(data).then(res => {
var bargainUserHelpListNew = [];
var bargainUserHelpList = that.bargainUserHelpList;
var len = res.data.length;
bargainUserHelpListNew = bargainUserHelpList.concat(res.data);
this.loading = true;
postBargainHelpList(datas,data).then(res => {
let list = res.data.list;
let bargainUserHelpList = that.$util.SplitArray(list, that.bargainUserHelpList);
let loadend = list.length < that.limit;
let len = list.length;
that.loadend = loadend;
that.loading = false;
that.loadTitle = loadend ? '已全部加载' : '加载更多';
that.$set(that, 'bargainUserHelpList', bargainUserHelpList);
that.$set(that, 'limitStatus', datas.limit > len);
that.$set(that, 'page', that.page + 1);
that.$set(that, 'bargainUserHelpList', res.data);
that.$set(that, 'limitStatus', data.limit > len);
that.$set(that, 'offest', (Number(data.offset) + Number(data.limit)));
// var bargainUserHelpListNew = [];
// var bargainUserHelpList = that.bargainUserHelpList;
// var len = res.data.list.length;
// bargainUserHelpListNew = bargainUserHelpList.concat(res.data.list);
// that.$set(that, 'bargainUserHelpList', res.data.list);
// that.$set(that, 'limitStatus', datas.limit > len);
// that.$set(that, 'page', (Number(datas.page) + Number(datas.limit)));
});
},
getBargainUserBargainPricePoster: function() {
@@ -669,6 +730,16 @@
page {
background-color: #e93323 !important;
}
.bargain .bargainGang .open {
font-size: 24rpx;
color: #999;
margin-top: 30rpx;
}
.bargain .bargainGang .open .iconfont {
font-size: 25rpx;
margin: 5rpx 0 0 10rpx;
}
.bargain .icon-xiangzuo {
font-size: 40rpx;

View File

@@ -1,7 +1,7 @@
<template>
<div>
<view class='group-list'>
<view class='iconfont icon-xiangzuo' @tap='goBack' :style="'top:'+ (navH/2) +'rpx'"></view>
<view class='iconfont icon-xiangzuo' @tap='goBack' :style="'top:'+ (navH/2) +'rpx'" v-if="returnShow"></view>
<view class='header'></view>
<view class='list'>
<block v-for="(item,index) in combinationList" :key='index'>
@@ -19,12 +19,15 @@
</view>
</view>
<view class='bottom acea-row row-between-wrapper'>
<view class='money'><text class='num'>{{item.price}}</text><text class='y-money'>{{item.product_price}}</text></view>
<view class='money'><text class='num'>{{item.price}}</text><text class='y-money'>{{item.otPrice}}</text></view>
<view class='groupBnt bg-color'>去拼团<text class="iconfont icon-jiantou"></text></view>
</view>
</view>
</view>
</block>
<view class='loadingicon acea-row row-center-wrapper' v-if='combinationList.length > 0'>
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
</view>
</view>
</view>
<home></home>
@@ -52,9 +55,13 @@
page: 1,
loading: false,
loadend: false,
returnShow: true,
loadTitle: ''
}
},
onLoad() {
var pages = getCurrentPages();
this.returnShow = pages.length===1?false:true;
uni.setNavigationBarTitle({
title:"拼团列表"
})
@@ -90,21 +97,24 @@
var that = this;
if (that.loadend) return;
if (that.loading) return;
that.loadTitle = '';
var data = {
page: that.page,
limit: that.limit
};
this.loading = true
getCombinationList(data).then(function(res) {
var combinationList = that.combinationList;
var limit = that.limit;
that.page++;
that.loadend = limit > res.data.length;
that.combinationList = combinationList.concat(res.data);
that.page = that.data.page;
let list = res.data.list;
let combinationList = that.$util.SplitArray(list, that.combinationList);
let loadend = list.length < that.limit;
that.loadend = loadend;
that.loading = false;
that.loadTitle = loadend ? '已全部加载' : '加载更多';
that.$set(that, 'combinationList', combinationList);
that.$set(that, 'page', that.page + 1);
}).catch(() => {
that.loading = false
that.loading = false;
that.loadTitle = '加载更多';
})
},
},

View File

@@ -22,15 +22,15 @@
<view class='wrapper'>
<view class='share acea-row row-between row-bottom'>
<view class='money font-color'>
<text class='num'>{{storeInfo.price}}</text><text class='y-money'>{{storeInfo.product_price}}</text>
<text class='num'>{{storeInfo.price || 0}}</text><text class='y-money'>{{storeInfo.product_price || 0}}</text>
</view>
<view class='iconfont icon-fenxiang' @click="listenerActionSheet"></view>
</view>
<view class='introduce'>{{storeInfo.title}}</view>
<view class='label acea-row row-between-wrapper'>
<view class='stock'>类型{{storeInfo.people}}人团</view>
<view>累计销量{{storeInfo.total?storeInfo.total:0}}</view>
<view>限购: {{ storeInfo.quota ? storeInfo.quota : 0 }} </view>
<view class='stock'>类型{{storeInfo.people || 0}}人团</view>
<view>累计销量{{storeInfo.total?storeInfo.total:0}} {{storeInfo.unit_name || ''}}</view>
<view>限购: {{ storeInfo.quotaShow ? storeInfo.quotaShow : 0 }} {{storeInfo.unit_name || ''}}</view>
</view>
</view>
<view class='attribute acea-row row-between-wrapper' @tap='selecAttr' v-if='attribute.productAttr.length'>
@@ -40,14 +40,14 @@
<view class='notice acea-row row-middle'>
<view class='num font-color'>
<text class='iconfont icon-laba'></text>
已拼{{pink_ok_sum}}<text class='line'>|</text>
已拼{{pinkOkSum}}<text class='line'>|</text>
</view>
<view class='swiper'>
<swiper :indicator-dots="indicatorDots" :autoplay="autoplay" interval="2500" duration="500" vertical="true"
circular="true">
<block v-for="(item,index) in itemNew" :key='index'>
<swiper-item>
<view class='line1'>{{item}}</view>
<view class='line1'>{{item.nickname}}拼团成功</view>
</swiper-item>
</block>
</swiper>
@@ -64,7 +64,10 @@
<view class='right acea-row row-middle'>
<view>
<view class='lack'>还差<text class='font-color'>{{item.count}}</text>人成团</view>
<view class='time'><count-down :is-day="false" :tip-text="' '" :day-text="' '" :hour-text="':'" :minute-text="':'" :second-text="' '" :datatime="item.stop_time"></count-down></view>
<view class='time'>
<count-down :is-day="false" :tip-text="' '" :day-text="' '" :hour-text="':'" :minute-text="':'" :second-text="' '"
:datatime="item.stopTime/1000"></count-down>
</view>
</view>
<navigator hover-class='none' :url="'/pages/activity/goods_combination_status/index?id='+item.id" class='spellBnt'>
去拼单
@@ -72,8 +75,10 @@
</navigator>
</view>
</view>
<!-- <view class='more' @tap='showAll' v-if="pink.length >= AllIndex">查看更多<text class='iconfont icon-xiangxia'></text></view>
<view class='more' @tap='hideAll' v-else="pink.length >= AllIndex && !pink.length">收起<text class='iconfont icon-xiangxia'></text></view> -->
<template v-if="pink.length">
<view class='more' @tap='showAll' v-if="pink.length > AllIndex">查看更多<text class='iconfont icon-xiangxia'></text></view>
<view class='more' @tap='hideAll' v-else-if="pink.length === AllIndex && pink.length !== AllIndexDefault">收起<text class='iconfont icon-xiangshang'></text></view>
</template>
</view>
<view class='playWay'>
<view class='title acea-row row-between-wrapper'>
@@ -104,7 +109,7 @@
<view class='userEvaluation' id="past1">
<view class='title acea-row row-between-wrapper'>
<view>用户评价({{replyCount}})</view>
<navigator class='praise' hover-class='none' :url='"/pages/users/goods_comment_list/index?product_id="+storeInfo.product_id'>
<navigator class='praise' hover-class='none' :url='"/pages/users/goods_comment_list/index?productId="+storeInfo.productId'>
<text class='font-color'>{{replyChance || 0}}%</text>
好评率
<text class='iconfont icon-jiantou'></text>
@@ -129,7 +134,7 @@
</button>
<!-- #endif -->
<!-- #ifndef MP -->
<navigator hover-class="none" class="item" url="/pages/customer_list/index">
<navigator hover-class="none" class="item" @click="kefuClick">
<view class="iconfont icon-kefu"></view>
<view>客服</view>
</navigator>
@@ -141,20 +146,20 @@
</view>
<view class="bnt acea-row">
<view class="joinCart bnts" @tap="goProduct">单独购买</view>
<view class="buy bnts" @tap="goCat" v-if='attribute.productSelect.product_stock>0&&attribute.productSelect.quota>0'>
<view class="buy bnts" @tap="goCat" v-if='attribute.productSelect.stock>0&&attribute.productSelect.quota>0'>
立即开团
</view>
<view class="buy bnts bg-color-hui" v-if='attribute.productSelect.quota <= 0 || attribute.productSelect.product_stock <= 0'>
<view class="buy bnts bg-color-hui" v-if='attribute.productSelect.quota <= 0 || attribute.productSelect.stock <= 0'>
已售罄
</view>
</view>
</view>
</view>
<shareRedPackets :sharePacket="sharePacket" @listenerActionSheet="listenerActionSheet" @closeChange="closeChange"></shareRedPackets>
<!-- 分享按钮 -->
<view class="generate-posters acea-row row-middle" :class="posters ? 'on' : ''">
<!-- #ifndef MP -->
<button class="item" hover-class='none' v-if="weixinStatus === true" @click="setShareInfoStatus">
<button class="item" hover-class='none' v-if="weixinStatus === true" @click="H5ShareBox = true">
<view class="iconfont icon-weixin3"></view>
<view class="">发送给朋友</view>
</button>
@@ -170,10 +175,12 @@
<view class="">生成海报</view>
</button>
</view>
<view class="mask" v-if="posters" @click="listenerActionClose"></view>
<view class="mask" v-if="posters" @click="closePosters"></view>
<view class="mask" v-if="canvasStatus" @click="listenerActionClose"></view>
<!-- <view class="mask" v-if="posters" @click="listenerActionClose"></view> -->
<!-- 海报展示 -->
<view class='poster-pop' v-if="posterImageStatus">
<view class='poster-pop' v-if="canvasStatus">
<image src='/static/images/poster-close.png' class='close' @click="posterImageClose"></image>
<image :src='posterImage'></image>
<!-- #ifndef H5 -->
@@ -183,37 +190,52 @@
<view class="keep">长按图片可以保存到手机</view>
<!-- #endif -->
</view>
<view class='mask' v-if="posterImageStatus"></view>
<canvas class="canvas" canvas-id='myCanvas' v-if="canvasStatus"></canvas>
<view class="canvas" v-else>
<canvas style="width:750px;height:1190px;" canvas-id="firstCanvas"></canvas>
<canvas canvas-id="qrcode" :style="{width: `${qrcodeSize}px`, height: `${qrcodeSize}px`}"/>
</view>
<!-- 发送给朋友图片 -->
<view class="share-box" v-if="H5ShareBox">
<image src="/static/images/share-info.png" @click="H5ShareBox = false"></image>
</view>
<!-- <view class='mask' v-if="posterImageStatus"></view>
<canvas class="canvas" canvas-id='myCanvas' v-if="canvasStatus"></canvas> -->
<!-- #ifdef MP -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
<product-window :attr='attribute' :limitNum='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr" @ChangeCartNum="ChangeCartNum" @iptCartNum="iptCartNum"
@attrVal="attrVal"></product-window>
<product-window :attr='attribute' :limitNum='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr" @ChangeCartNum="ChangeCartNum"
@iptCartNum="iptCartNum" @attrVal="attrVal"></product-window>
</view>
</template>
<script>
const app = getApp();
import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js'
import { base64src } from '@/utils/base64src.js'
import {
mapGetters
} from "vuex";
// #ifdef MP
import authorize from '@/components/Authorize';
import {
getQrcode
} from '@/api/api.js';
// #endif
import productConSwiper from '@/components/productConSwiper/index.vue'
import productConSwiper from '@/components/productConSwiper'
import {
toLogin
} from '@/libs/login.js';
import {
getCombinationDetail,
scombinationCode
getCombinationDetail
} from '@/api/activity.js';
import {
postCartAdd,
collectAdd,
collectDel
collectDel,
getReplyList,
getReplyConfig
} from '@/api/store.js';
import {
imageBase64
@@ -223,9 +245,13 @@
import productWindow from '@/components/productWindow/index.vue'
import userEvaluation from '@/components/userEvaluation/index.vue'
import countDown from '@/components/countDown/index.vue'
import { getProductCode } from '@/api/store.js'
import shareRedPackets from '@/components/shareRedPackets';
import {
getProductCode
} from '@/api/store.js'
export default {
components: {
shareRedPackets,
productConSwiper,
// #ifdef MP
authorize,
@@ -236,7 +262,12 @@
userEvaluation,
countDown
},
computed: mapGetters(['isLogin']),
computed: mapGetters({
'isLogin': 'isLogin',
'userData': 'userInfo',
'uid': 'uid',
'chatUrl': 'chatUrl'
}),
data() {
return {
navH: '',
@@ -258,6 +289,7 @@
attr: '请选择',
attrValue: '',
AllIndex: 2,
maxAllIndex: 0,
replyChance: '',
limitNum: 1,
timeer: null,
@@ -273,12 +305,14 @@
lock: false,
scrollTop: 0,
storeInfo: {},
pink_ok_sum: 0,
pinkOkSum: 0,
pink: [],
replyCount: 0,
reply: [],
imgUrls: [],
sharePacket: '',
sharePacket: {
isState: true, //默认不显示
},
tagStyle: {
img: 'width:100%;'
},
@@ -296,10 +330,14 @@
cart_num: '',
isAuto: false, //没有授权的不会自动授权
isShowAuth: false, //是否隐藏授权
AllIndexDefault: 0,
imgTop:'',
qrcodeSize: 600,
H5ShareBox: false, //公众号分享图片
onceNum: 0 //一次可以购买几个
}
},
onLoad(options) {
console.log(options,'options')
let that = this
// #ifdef MP
this.navH = app.globalData.navHeight;
@@ -316,7 +354,7 @@
});
//扫码携带参数处理
// #ifdef MP
if (options.scene) {
let value = this.$util.getUrlParams(decodeURIComponent(options.scene));
if (value.id) options.id = value.id;
@@ -367,6 +405,38 @@
};
},
methods: {
getProductReplyCount: function() {
let that = this;
getReplyConfig(that.storeInfo.productId).then(res => {
that.$set(that, 'replyChance', res.data.replyChance * 100);
that.$set(that, 'replyCount', res.data.sumCount);
});
},
getProductReplyList: function() {
getReplyList(this.storeInfo.productId, {
page: 1,
limit: 3,
type: 0,
}).then(res => {
this.reply = res.data.list;
})
},
kefuClick(){
location.href = this.chatUrl;
},
closePosters:function(){
this.posters = false;
},
closeChange: function() {
this.$set(this.sharePacket, 'isState', true);
},
showAll: function() {
this.AllIndexDefault = this.AllIndex;
this.AllIndex = this.pink.length;
},
hideAll: function() {
this.AllIndex = this.AllIndexDefault;
},
// 授权关闭
authColse: function(e) {
this.isShowAuth = e;
@@ -374,10 +444,18 @@
/**
* 购物车手动填写
*
*/
iptCartNum: function (e) {
this.$set(this.attribute.productSelect,'cart_num',e);
this.$set(this, "cart_num", e);
*/
iptCartNum: function(e) {
if (e > this.onceNum) {
this.$util.Tips({
title: `该商品每次限购${this.onceNum}${this.storeInfo.unitName}`
});
this.$set(this.attribute.productSelect, 'cart_num', this.onceNum);
this.$set(this, "cart_num", this.onceNum);
}else{
this.$set(this.attribute.productSelect, 'cart_num', e);
this.$set(this, "cart_num", e);
}
},
// 返回
returns() {
@@ -391,38 +469,45 @@
uni.setNavigationBarTitle({
title: res.data.storeInfo.title.substring(0, 16)
})
that.imgUrls = res.data.storeInfo.images
that.storeInfo = res.data.storeInfo;
that.pink = res.data.pink;
that.pindAll = res.data.pindAll;
that.reply = res.data.reply ? [res.data.reply] : [];
that.replyCount = res.data.replyCount;
that.itemNew = res.data.pink_ok_list;
that.pink_ok_sum = res.data.pink_ok_sum;
that.replyChance = res.data.replyChance;
that.attribute.productAttr = res.data.productAttr;
that.getProductReplyList();
that.getProductReplyCount();
that.imgUrls = JSON.parse(res.data.storeInfo.images);
that.attribute.productSelect.num = res.data.storeInfo.onceNum;
that.pink = res.data.pink || [];
that.pindAll = res.data.pindAll || [];
// that.reply = res.data.reply ? res.data.reply : [];
that.itemNew = res.data.pinkOkList || [];
that.pinkOkSum = res.data.pinkOkSum;
that.attribute.productAttr = res.data.productAttr || [];
that.productValue = res.data.productValue;
that.PromotionCode = res.data.storeInfo.code_base
that.onceNum = res.data.storeInfo.onceNum;
// that.PromotionCode = res.data.storeInfo.code_base
// #ifdef H5
that.setShare();
that.storeImage = that.storeInfo.image
that.getImageBase64();
that.make();
that.getImageBase64(that.storeImage);
// #endif
// #ifdef MP
that.getQrcode();
that.imgTop = res.data.storeInfo.image;
// #endif
// #ifndef H5
that.downloadFilestoreImage();
// #endif
// that.setProductSelect();
that.DefaultSelect();
// setTimeout(function() {
// that.infoScroll();
// }, 500);
setTimeout(function() {
that.infoScroll();
}, 500);
}).catch(function(err) {
that.$util.Tips({
title:err
},{
tab:3
title: err
}, {
tab: 3
})
})
},
@@ -498,26 +583,25 @@
*
*/
DefaultSelect: function() {
let self = this
let productAttr = self.attribute.productAttr;
let value = [];
for (var key in this.productValue) {
if (this.productValue[key].quota > 0) {
value = this.attribute.productAttr.length ? key.split(",") : [];
for (var key in self.productValue) {
if (self.productValue[key].quota > 0) {
value = self.attribute.productAttr.length ? key.split(",") : [];
break;
}
}
for (let i = 0; i < productAttr.length; i++) {
this.$set(productAttr[i], "index", value[i]);
self.$set(productAttr[i], "index", value[i]);
}
//sort();排序函数:数字-英文-汉字;
let productSelect = self.productValue[value.sort().join(",")];
let productSelect = self.productValue[value.join(",")];
if (productSelect && productAttr.length) {
self.$set(
self.attribute.productSelect,
"store_name",
"storeName",
self.storeInfo.title
);
self.$set(self.attribute.productSelect, "image", productSelect.image);
@@ -525,22 +609,20 @@
self.$set(self.attribute.productSelect, "stock", productSelect.stock);
self.$set(self.attribute.productSelect, "unique", productSelect.unique);
self.$set(self.attribute.productSelect, "quota", productSelect.quota);
self.$set(self.attribute.productSelect, "quota_show", productSelect.quota_show);
self.$set(self.attribute.productSelect, "product_stock", productSelect.product_stock);
self.$set(self.attribute.productSelect, "quotaShow", productSelect.quotaShow);
self.$set(self.attribute.productSelect, "cart_num", 1);
self.$set(self, "attrValue", value.sort().join(","));
self.attrValue = value.sort().join(",")
this.$set(this, "attrValue", value.join(","));
this.$set(this, "attrTxt", "已选择");
} else if (!productSelect && productAttr.length) {
self.$set(
self.attribute.productSelect,
"store_name",
"storeName",
self.storeInfo.title
);
self.$set(self.attribute.productSelect, "image", self.storeInfo.image);
self.$set(self.attribute.productSelect, "price", self.storeInfo.price);
self.$set(self.attribute.productSelect, "quota", 0);
self.$set(self.attribute.productSelect, "quota_show", 0);
self.$set(self.attribute.productSelect, "product_stock", 0);
self.$set(self.attribute.productSelect, "quotaShow", 0);
self.$set(self.attribute.productSelect, "stock", 0);
self.$set(self.attribute.productSelect, "unique", "");
self.$set(self.attribute.productSelect, "cart_num", 0);
@@ -549,14 +631,14 @@
} else if (!productSelect && !productAttr.length) {
self.$set(
self.attribute.productSelect,
"store_name",
"storeName",
self.storeInfo.title
);
self.$set(self.attribute.productSelect, "image", self.storeInfo.image);
self.$set(self.attribute.productSelect, "price", self.storeInfo.price);
self.$set(self.attribute.productSelect, "stock", self.storeInfo.stock);
self.$set(self.attribute.productSelect, "quota", 0);
self.$set(self.attribute.productSelect, "product_stock", 0);
self.$set(self.attribute.productSelect, "stock", 0);
self.$set(
self.attribute.productSelect,
"unique",
@@ -574,7 +656,7 @@
heightArr = [];
for (var i = 0; i < that.navList.length; i++) { //productList
//获取元素所在位置
var query = wx.createSelectorQuery().in(this);
var query = uni.createSelectorQuery().in(this);
var idView = "#past" + i;
// if (!that.data.good_list.length && i == 2) {
// var idView = "#past" + 3;
@@ -594,8 +676,8 @@
onLoadFun: function(e) {
this.userInfo = e
app.globalData.openPages = '/pages/activity/goods_combination_details/index?id=' + this.id + '&spid=' + e.uid;
this.downloadFilePromotionCode();
this.combinationDetail();
//this.downloadFilePromotionCode();
},
selecAttr: function() {
this.attribute.cartAttr = true
@@ -612,56 +694,61 @@
//changeValue:是否 加|减
//获取当前变动属性
let productSelect = this.productValue[this.attrValue];
if (this.buyNum === productSelect.quota) {
return this.$util.Tips({title: '您已超出当前商品每人限购数量请浏览其他商品'});
}
if (this.cart_num) {
productSelect.cart_num = this.cart_num;
this.attribute.productSelect.cart_num = this.cart_num;
}
productSelect.cart_num = this.cart_num;
this.attribute.productSelect.cart_num = this.cart_num;
}
//如果没有属性,赋值给商品默认库存
if (productSelect === undefined && !this.attribute.productAttr.length)
productSelect = this.attribute.productSelect;
if (productSelect === undefined && !this.attribute.productAttr.length) productSelect = this.attribute.productSelect;
//无属性值即库存为0不存在加减
if (productSelect === undefined) return;
let stock = productSelect.stock || 0;
let quotaShow = productSelect.quota_show || 0;
let productStock = productSelect.product_stock || 0;
let quota = productSelect.quota || 0;
let num = this.attribute.productSelect;
//设置默认数据
if (productSelect.cart_num == undefined) productSelect.cart_num = 1;
if (changeValue) {
num.cart_num ++;
if(quotaShow >= productStock){
if (num.cart_num > productStock) {
this.$set(this.attribute.productSelect, "cart_num", productStock);
this.$set(this, "cart_num", productStock);
}
}else{
if (num.cart_num > quotaShow) {
this.$set(this.attribute.productSelect, "cart_num", quotaShow);
this.$set(this, "cart_num", quotaShow);
let nums = this.storeInfo.onceNum || 0;
//设置默认数据
if (productSelect.cart_num == undefined) productSelect.cart_num = 1;
if (changeValue) {
if (num.cart_num === this.onceNum) {
return this.$util.Tips({
title: `该商品每次限购${this.onceNum}${this.storeInfo.unitName}`
});
}
num.cart_num++;
let arrMin = [];
arrMin.push(nums);
arrMin.push(quota);
arrMin.push(stock);
let minN = Math.min.apply(null, arrMin);
if (num.cart_num >= minN) {
this.$set(this.attribute.productSelect, "cart_num", minN ? minN : 1);
this.$set(this, "cart_num", minN ? minN : 1);
}
this.$set(this, "cart_num", num.cart_num);
this.$set(this.attribute.productSelect, "cart_num", num.cart_num);
} else {
num.cart_num--;
if (num.cart_num < 1) {
this.$set(this.attribute.productSelect, "cart_num", 1);
this.$set(this, "cart_num", 1);
}
this.$set(this, "cart_num", num.cart_num);
this.$set(this.attribute.productSelect, "cart_num", num.cart_num);
}
this.$set(this, "cart_num", num.cart_num);
this.$set(this.attribute.productSelect, "cart_num", num.cart_num);
} else {
num.cart_num--;
if (num.cart_num < 1) {
this.$set(this.attribute.productSelect, "cart_num", 1);
this.$set(this, "cart_num", 1);
}
this.$set(this, "cart_num", num.cart_num);
this.$set(this.attribute.productSelect, "cart_num", num.cart_num);
}
},
},
attrVal(val) {
this.attribute.productAttr[val.indexw].index = this.attribute.productAttr[val.indexw].attr_values[val.indexn];
this.attribute.productAttr[val.indexw].index = this.attribute.productAttr[val.indexw].attrValues[val.indexn];
},
/**
* 属性变动赋值
*
*/
ChangeAttr: function(res) {
this.$set(this,'cart_num',1);
this.$set(this, 'cart_num', 1);
let productSelect = this.productValue[res];
if (productSelect) {
this.$set(this.attribute.productSelect, "image", productSelect.image);
@@ -670,7 +757,7 @@
this.$set(this.attribute.productSelect, "unique", productSelect.unique);
this.$set(this.attribute.productSelect, "cart_num", 1);
this.$set(this.attribute.productSelect, "quota", productSelect.quota);
this.$set(this.attribute.productSelect, "quota_show", productSelect.quota_show);
this.$set(this.attribute.productSelect, "quotaShow", productSelect.quotaShow);
this.$set(this, "attrValue", res);
this.attrTxt = "已选择"
@@ -681,7 +768,7 @@
this.$set(this.attribute.productSelect, "unique", "");
this.$set(this.attribute.productSelect, "cart_num", 0);
this.$set(this.attribute.productSelect, "quota", 0);
this.$set(this.attribute.productSelect, "quota_show", 0);
this.$set(this.attribute.productSelect, "quotaShow", 0);
this.$set(this, "attrValue", "");
this.attrTxt = "已选择"
}
@@ -689,7 +776,7 @@
// 单独购买
goProduct() {
uni.navigateTo({
url: '/pages/goods_details/index?id=' + this.storeInfo.product_id
url: '/pages/goods_details/index?id=' + this.storeInfo.productId
})
},
// 立即购买
@@ -708,18 +795,16 @@
title: '请选择属性'
});
var data = {
productId: that.storeInfo.product_id,
secKillId: 0,
bargainId: 0,
combinationId: that.id,
cartNum: that.cart_num,
uniqueId: productSelect !== undefined ? productSelect.unique : '',
is_new: 1,
productId: that.storeInfo.productId,
combinationId:parseFloat(that.id),
cartNum: that.cart_num ? this.cart_num : this.attribute.productSelect.cart_num,
productAttrUnique: productSelect !== undefined ? productSelect.id : '',
isNew: true,
};
postCartAdd(data).then(function(res) {
that.isOpen = false
uni.navigateTo({
url: '/pages/users/order_confirm/index?cartId=' + res.data.cartId
url: '/pages/users/order_confirm/index?new=true&cartId=' + res.data.cartId + '&combination=true'
});
}).catch(function(res) {
uni.showToast({
@@ -734,11 +819,11 @@
setCollect: function() {
var that = this;
if (this.storeInfo.userCollect) {
collectDel(this.storeInfo.product_id).then(res => {
collectDel(this.storeInfo.productId).then(res => {
that.storeInfo.userCollect = !that.storeInfo.userCollect
})
} else {
collectAdd(this.storeInfo.product_id).then(res => {
collectAdd(this.storeInfo.productId).then(res => {
that.storeInfo.userCollect = !that.storeInfo.userCollect
})
}
@@ -773,7 +858,7 @@
},
//隐藏海报
posterImageClose: function() {
this.posterImageStatus = false
this.canvasStatus = false
},
//替换安全域名
setDomain: function(url) {
@@ -825,14 +910,11 @@
that.$set(that, 'PromotionCode', '');
});
},
getImageBase64: function() {
getImageBase64: function(images) {
let that = this;
imageBase64(that.storeImage, that.PromotionCode)
.then(res => {
that.storeImage = res.data.image;
that.PromotionCode = res.data.code;
})
.catch(() => {});
imageBase64({url:images}).then(res=>{
that.imgTop = res.data.code
})
},
// 小程序关闭分享弹窗;
goFriend: function() {
@@ -844,59 +926,61 @@
goPoster: function() {
let that = this;
that.posters = false;
that.$set(that, 'canvasStatus', true);
let arr2 = [that.posterbackgd, that.storeImage, that.PromotionCode];
// #ifndef H5
if (that.isDown) return that.$util.Tips({
title: '正在下载海报,请稍后再试!'
});
// #endif
uni.getImageInfo({
src: that.PromotionCode,
fail: function(res) {
return that.$util.Tips({
title: '小程序二维码需要发布正式版后才能获取到'
});
},
success() {
if (arr2[2] == '') {
//海报二维码不存在则从新下载
// #ifndef H5
that.downloadFilePromotionCode(function(msgPromotionCode) {
arr2[2] = msgPromotionCode;
if (arr2[2] == '')
return that.$util.Tips({
title: '海报二维码生成失败!'
});
that.$util.PosterCanvas(arr2, that.storeInfo.title, that.storeInfo.price, function(tempFilePath) {
that.$set(that, 'posterImage', tempFilePath);
that.$set(that, 'posterImageStatus', true);
that.$set(that, 'canvasStatus', false);
that.$set(that, 'actionSheetHidden', !that.actionSheetHidden);
});
});
// #endif
// #ifdef H5
that.$util.PosterCanvas(arr2, that.storeInfo.title, that.storeInfo.price, function(tempFilePath) {
that.$set(that, 'posterImage', tempFilePath);
that.$set(that, 'posterImageStatus', true);
that.$set(that, 'canvasStatus', false);
that.$set(that, 'actionSheetHidden', !that.actionSheetHidden);
});
// #endif
} else {
//生成推广海报
that.$util.PosterCanvas(arr2, that.storeInfo.title, that.storeInfo.price, function(tempFilePath) {
that.$set(that, 'posterImage', tempFilePath);
that.$set(that, 'posterImageStatus', true);
that.$set(that, 'canvasStatus', false);
that.$set(that, 'actionSheetHidden', !that.actionSheetHidden);
});
}
},
});
let arrImagesUrl = '';
let arrImagesUrlTop = '';
uni.downloadFile({
url: that.imgTop, //仅为示例,并非真实的资源
success: (res) => {
arrImagesUrlTop = res.tempFilePath;
let arrImages = [that.posterbackgd, arrImagesUrlTop, that.PromotionCode];
let storeName = that.storeInfo.title;
let price = that.storeInfo.price;
setTimeout(() => {
that.$util.PosterCanvas(arrImages, storeName, price, function(tempFilePath) {
that.posterImage = tempFilePath;
that.canvasStatus = true;
});
}, 200);
}
});
},
// 小程序二维码
getQrcode(){
let that = this;
let data = {
pid: that.uid,
id: that.id,
path: 'pages/activity/goods_combination_details/index'
}
getQrcode(data).then(res=>{
base64src(res.data.code, res => {
that.PromotionCode = res;
});
})
},
// 生成二维码;
make() {
let that = this;
let href = location.href;
let hrefs = href.indexOf("?") === -1 ? href + "?spread=" + uid : href + "&spread=" + that.uid;
uQRCode.make({
canvasId: 'qrcode',
text: hrefs,
size: that.qrcodeSize,
margin: 10,
success: res => {
that.PromotionCode = res;
},
complete: (res) => {
},
fail:res=>{
that.$util.Tips({
title: '海报二维码生成失败!'
});
}
})
},
/*
* 保存到手机相册
*/
@@ -967,11 +1051,6 @@
});
}
},
scroll: function(e) {
var that = this,
scrollY = e.detail.scrollTop;
@@ -1002,12 +1081,34 @@
this.lock = true;
this.scrollTop = index > 0 ? that.topArr[index] - (app.globalData.navHeight / 2) : that.topArr[index]
},
},
//#ifdef MP
onShareAppMessage() {
return {
title: this.storeInfo.title,
path: app.globalData.openPages,
imageUrl: that.storeInfo.image
};
}
//#endif
}
</script>
<style>
<style scoped lang="scss">
.share-box {
z-index: 1000;
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
image {
width: 100%;
height: 100%;
}
}
.generate-posters {
width: 100%;
height: 170rpx;
@@ -1177,6 +1278,8 @@
.product-con .assemble .item .pictxt .pictrue {
width: 80rpx;
height: 80rpx;
background: #f0f0f0;
border-radius: 50%;
}
.product-con .assemble .item .pictxt .pictrue image {
@@ -1197,6 +1300,7 @@
color: #82848f;
margin-top: 5rpx;
}
.product-con .assemble .item .right .spellBnt {
font-size: 24rpx;
color: #fff;
@@ -1342,6 +1446,7 @@
.canvas {
width: 750px;
height: 1190px;
opacity: 0;
}
.poster-pop {

File diff suppressed because it is too large Load Diff

View File

@@ -61,7 +61,7 @@
</view>
<view class='noCommodity' v-if="seckillList.length == 0 && (page != 1 || active== 0)">
<view class='pictrue'>
<image src='/static/images/noShopper.png'></image>
<image src='../../../static/images/noShopper.png'></image>
</view>
</view>
<home></home>

View File

@@ -74,7 +74,7 @@
</button>
<!-- #endif -->
<!-- #ifndef MP -->
<navigator hover-class="none" class="item" url="/pages/customer_list/index">
<navigator hover-class="none" class="item" @click="kefuClick">
<view class="iconfont icon-kefu"></view>
<view>客服</view>
</navigator>
@@ -106,6 +106,7 @@
</view>
</view>
</view>
<shareRedPackets :sharePacket="sharePacket" @listenerActionSheet="listenerActionSheet" @closeChange="closeChange"></shareRedPackets>
<product-window :attr='attribute' :limitNum='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr" @ChangeCartNum="ChangeCartNum"
@attrVal="attrVal" @iptCartNum="iptCartNum"></product-window>
<!-- #ifdef MP -->
@@ -115,7 +116,7 @@
<!-- 分享按钮 -->
<view class="generate-posters acea-row row-middle" :class="posters ? 'on' : ''">
<!-- #ifndef MP -->
<button class="item" hover-class='none' v-if="weixinStatus === true" @click="setShareInfoStatus">
<button class="item" hover-class='none' v-if="weixinStatus === true" @click="H5ShareBox = true">
<view class="iconfont icon-weixin3"></view>
<view class="">发送给朋友</view>
</button>
@@ -149,6 +150,10 @@
<canvas style="width:750px;height:1190px;" canvas-id="firstCanvas"></canvas>
<canvas canvas-id="qrcode" :style="{width: `${qrcodeSize}px`, height: `${qrcodeSize}px`}"/>
</view>
<!-- 发送给朋友图片 -->
<view class="share-box" v-if="H5ShareBox">
<image src="/static/images/share-info.png" @click="H5ShareBox = false"></image>
</view>
<!-- <view class='mask' v-if="canvasStatus"></view> -->
<!--
<canvas class="canvas" canvas-id='qrcode' v-if="canvasStatus"></canvas> -->
@@ -158,6 +163,7 @@
<script>
const app = getApp();
import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js'
import { base64src } from '@/utils/base64src.js'
import {
mapGetters
} from "vuex";
@@ -184,6 +190,7 @@
import parser from "@/components/jyf-parser/jyf-parser";
import home from '@/components/home/index.vue'
import countDown from '@/components/countDown';
import shareRedPackets from '@/components/shareRedPackets';
import {
imageBase64
} from "@/api/public";
@@ -260,10 +267,15 @@
aloneAttrValueId: 0 ,//单规格规格id
imagePath:'',//海报路径
imgTop:'',
H5ShareBox: false, //公众号分享图片
sharePacket: {
isState: true, //默认不显示
},
buyNum: 1
}
},
components: {
shareRedPackets,
productConSwiper,
'productWindow': productWindow,
userEvaluation,
@@ -274,7 +286,7 @@
authorize
// #endif
},
computed: mapGetters(['isLogin','uid']),
computed: mapGetters(['isLogin','uid','chatUrl']),
onLoad(options) {
let that = this
@@ -334,6 +346,12 @@
}
},
methods: {
kefuClick(){
location.href = this.chatUrl;
},
closePosters:function(){
this.posters = false;
},
getProductReplyList: function() {
getReplyList(this.productId, {
page: 1,
@@ -393,6 +411,7 @@
// #endif
// #ifdef MP
that.getQrcode();
that.imgTop = res.data.storeInfo.image
// #endif
// #ifndef H5
that.downloadFilestoreImage();
@@ -534,7 +553,6 @@
//设置默认数据
if (productSelect.cart_num == undefined) productSelect.cart_num = 1;
if (changeValue) {
console.log(this.buyNum);
if (num.cart_num === 1) {
return this.$util.Tips({
title: `该商品每次限购1${this.storeInfo.unitName}`
@@ -854,13 +872,30 @@
goPoster: function() {
let that = this;
that.posters = false;
let arrImages = [that.posterbackgd, that.imgTop, that.PromotionCode];
let storeName = that.storeInfo.storeName;
let price = that.storeInfo.price;
that.$util.PosterCanvas(arrImages, storeName, price, function(tempFilePath) {
that.posterImage = tempFilePath;
that.canvasStatus = true;
});
let arrImagesUrl = '';
let arrImagesUrlTop = '';
uni.downloadFile({
url: that.imgTop, //仅为示例,并非真实的资源
success: (res) => {
arrImagesUrlTop = res.tempFilePath;
let arrImages = [that.posterbackgd, arrImagesUrlTop, that.PromotionCode];
let storeName = that.storeInfo.storeName;
let price = that.storeInfo.price;
setTimeout(() => {
that.$util.PosterCanvas(arrImages, storeName, price, function(tempFilePath) {
that.posterImage = tempFilePath;
that.canvasStatus = true;
});
}, 200);
}
});
// let arrImages = [that.posterbackgd, that.imgTop, that.PromotionCode];
// let storeName = that.storeInfo.storeName;
// let price = that.storeInfo.price;
// that.$util.PosterCanvas(arrImages, storeName, price, function(tempFilePath) {
// that.posterImage = tempFilePath;
// that.canvasStatus = true;
// });
},
// 小程序二维码
getQrcode(){
@@ -868,10 +903,12 @@
let data = {
pid: that.uid,
id: that.id,
path: '/pages/goods_seckill_details/index'
path: 'pages/activity/goods_seckill_details/index'
}
getQrcode(data).then(res=>{
that.PromotionCode = res.data.code;
base64src(res.data.code, res => {
that.PromotionCode = res;
});
})
},
// 生成二维码;
@@ -973,6 +1010,19 @@
</script>
<style scoped lang="scss">
.share-box {
z-index: 1000;
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
image {
width: 100%;
height: 100%;
}
}
.generate-posters {
width: 100%;
height: 170rpx;

View File

@@ -2,15 +2,24 @@
<view>
<view class='poster-poster'>
<view class='tip'><text class='iconfont icon-shuoming'></text>提示点击图片即可保存至手机相册 </view>
<view class='pictrue'>
<!-- <view class='pictrue'>
<image :src='image' mode="widthFix"></image>
</view> -->
<view class='pictrue' v-if="canvasStatus">
<image :src='imagePath'></image>
</view>
<view class="canvas">
<canvas style="width:750px;height:1130px;" canvas-id="firstCanvas" id="firstCanvas"></canvas>
<canvas canvas-id="qrcode" :style="{width: `${qrcodeSize}px`, height: `${qrcodeSize}px`}" style="opacity: 0;"/>
</view>
</view>
</view>
</template>
<script>
import { getBargainPoster, getCombinationPoster } from '../../../api/activity.js';
import { getCombinationPink, getCombinationPoster } from '../../../api/activity.js';
import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js';
import { imageBase64 } from "@/api/public";
export default {
data() {
return {
@@ -24,7 +33,13 @@
type: 0,
id: 0,
image: '',
from:''
from:'',
storeCombination: {},
qrcodeSize: 600,
posterbackgd: '/static/images/canbj.png',
PromotionCode: '',//二维码
canvasStatus: false,
imgTop: '' //商品图base64位
}
},
onLoad(options) {
@@ -64,26 +79,157 @@
getPosterInfo: function() {
var that = this,url = '';
let data = {
id: that.id,
'from': that.from
pinkId: parseFloat(that.id),
from: that.from
};
if (that.type == 1) {
getBargainPoster({
bargainId: that.id,
'from': that.from
}).then(res => {
that.image = res.data.url
}).catch(err => {
console.log(err)
})
} else {
getCombinationPoster(data).then(res => {
that.image = res.data.url
}).catch(err => {
})
this.getCombinationPink();
}
},
//拼团信息
getCombinationPink: function() {
var that = this;
getCombinationPink(this.id)
.then(res => {
this.storeCombination = res.data;
this.getImageBase64(res.data.storeCombination.image);
// #ifdef H5
that.make(res.data.userInfo.uid);
// #endif
})
.catch(err => {
this.$util.Tips({
title: err
});
uni.redirectTo({
success(){},
fail() {
uni.navigateTo({
url: '/pages/index/index',
})
}
})
});
},
getImageBase64:function(images){
let that = this;
imageBase64({url:images}).then(res=>{
that.imgTop = res.data.code
})
},
// 生成二维码;
make(uid) {
let href = location.protocol + '//' + window.location.host + '/pages/activity/goods_combination_status/index?id=' + this.id + "&spread=" + uid;
uQRCode.make({
canvasId: 'qrcode',
text: href,
size: this.qrcodeSize,
margin: 10,
success: res => {
this.PromotionCode = res;
let arrImages = [this.posterbackgd, this.imgTop, this.PromotionCode];
let storeName = this.storeCombination.storeCombination.title;
let price = this.storeCombination.storeCombination.price;
let people = this.storeCombination.storeCombination.people;
let otPrice = this.storeCombination.storeCombination.otPrice;
let count = this.storeCombination.count;
this.PosterCanvas(arrImages, storeName, price, people,otPrice,count);
},
complete: () => {
},
fail:res=>{
this.$util.Tips({
title: '海报二维码生成失败!'
});
}
})
},
// 生成海报
PosterCanvas:function(arrImages, storeName, price, people,otPrice,count){
uni.showLoading({
title: '海报生成中',
mask: true
});
let context = uni.createCanvasContext('firstCanvas')
context.clearRect(0, 0, 0, 0);
let that = this;
uni.getImageInfo({
src: arrImages[0],
success: function (image) {
console.log('啦啦', image)
context.drawImage(arrImages[0], 0, 0, 750, 1190);
context.setFontSize(36);
context.setTextAlign('center');
context.setFillStyle('#282828');
let maxText = 17;
let text = storeName;
let topText = '';
let bottomText = '';
let len = text.length;
if(len>maxText*2){
text = text.slice(0,maxText*2-4)+'......';
topText = text.slice(0,maxText-1);
bottomText = text.slice(maxText-1,len);
}else{
if(len>maxText){
topText = text.slice(0,maxText-1);
bottomText = text.slice(maxText-1,len);
}else{
topText = text;
bottomText = '';
}
}
context.fillText(topText, 750/2, 60);
context.fillText(bottomText, 750/2, 100);
context.drawImage(arrImages[1], 150, 350, 450, 450);
context.save();
context.drawImage(arrImages[2], 300, 950, 140, 140);
context.restore();
context.setFontSize(72);
context.setFillStyle('#fc4141');
context.fillText(price, 220, 210);
context.setFontSize(32);
context.setFillStyle('#FFFFFF');
context.fillText( people+'人团', 538, 198);
context.setFontSize(26);
context.setFillStyle('#3F3F3F');
context.setTextAlign('center');
context.fillText( '原价:¥'+otPrice +' 还差 ' + count + '人 拼团成功', 750 / 2, 275);
context.draw(true,function(){
uni.canvasToTempFilePath({
destWidth: 750,
destHeight: 1190,
canvasId: 'firstCanvas',
fileType: 'jpg',
success: function(res) {
console.log('啦啦222', res)
// 在H5平台下tempFilePath 为 base64
uni.hideLoading();
//successFn && successFn(res.tempFilePath);
that.imagePath = res.tempFilePath;
console.log(that.imagePath)
that.canvasStatus = true;
}
})
})
},
fail: function(err) {
console.log(err)
uni.hideLoading();
that.$util.Tips({
title: '无法获取图片信息'
});
}
})
},
showImage: function() {
var that = this;
let imgArr = this.image.split(',')
@@ -108,7 +254,11 @@
page {
background-color: #d22516 !important;
}
.canvas {
position:fixed;
z-index: -5;
opacity: 0;
}
.poster-poster .tip {
height: 80rpx;
font-size: 26rpx;
@@ -125,7 +275,7 @@
.poster-poster .pictrue {
width: 690rpx;
height: 100%;
height: 1130rpx;
margin: 0 auto 50rpx auto;
}