Commit ab004f4f985d8368a6a8cbe33f5a748f7ced8192

Authored by yvan.ni
1 parent 136c6bae

1, 商品, 活动分享的代码

components/share/share.js
1 1 Component({
2 2 /*** 页面的初始数据***/
3 3 data: {
  4 + type:0,// 0默认情况发送好友和海报 1只有发送好友
4 5 },
5   -
6 6 methods: {
7 7 cancel() {
8 8 this.triggerEvent('cancel',{},{bubbles: true});
  9 + },
  10 + share_img(){
  11 + this.triggerEvent('share_img',{},{bubbles: true});
  12 + },
  13 + set_type(type){
  14 + this.setData({type:type})
9 15 }
  16 +
10 17 }
11 18 })
12 19 \ No newline at end of file
... ...
components/share/share.wxml
1 1 <view class="container" hidden="{{hiddenShare}}">
2 2 <view class="container-wrap animated slideInUp">
3   - <view class="flex">
4   - <view class="btn">
5   - <view class="icon-container bg-green"><view class="iconfont icon-weixin"></view></view>
6   - <view class="title">发送给好友</view>
7   - </view>
8   - <view class="btn">
9   - <view class="icon-container bg-red"><view class="iconfont icon-pic"></view></view>
10   - <view class="title">生成海报分享</view>
11   - </view>
  3 + <view class="flex">
  4 + <block wx:if="{{type==0}}">
  5 + <button open-type="share" class="btn">
  6 + <view class="icon-container bg-green"><view class="iconfont icon-weixin"></view></view>
  7 + <view class="title">发送给好友</view>
  8 + </button>
  9 + <view class="btn" bindtap="share_img">
  10 + <view class="icon-container bg-red"><view class="iconfont icon-pic"></view></view>
  11 + <view class="title">生成海报分享</view>
  12 + </view>
  13 + </block>
  14 + <block wx:else>
  15 + <button open-type="share" class="btn" style="width: 100%;">
  16 + <view class="icon-container bg-green"><view class="iconfont icon-weixin"></view></view>
  17 + <view class="title">发送给好友</view>
  18 + </button>
  19 + </block>
12 20 </view>
13 21 <view class="btn-cancel" bindtap="cancel">取消</view>
14 22 </view>
... ...
components/share/share.wxss
... ... @@ -34,6 +34,7 @@
34 34 left: 0;
35 35 top: 0;
36 36 background-color: rgba(0,0,0,.5);
  37 + z-index: 100;
37 38 }
38 39 .container-wrap {
39 40 background-color: white;
... ... @@ -139,4 +140,12 @@
139 140 .slideInUp {
140 141 -webkit-animation-name: slideInUp;
141 142 animation-name: slideInUp
  143 +}
  144 +
  145 +button{
  146 + border: none;
  147 +}
  148 +
  149 +button::after {
  150 + border: none;
142 151 }
143 152 \ No newline at end of file
... ...
packageA/pages/activity_share/activity_share.js
1 1 // packageA//pages/goods_share/goods_share.js
  2 +var app=getApp(),oo = app.globalData.setting,os=oo,ut = require("../../../utils/util.js");
  3 +var regeneratorRuntime = require('../../../utils/runtime.js');
2 4 Page({
3   -
4 5 /**
5 6 * 页面的初始数据
6 7 */
... ... @@ -17,106 +18,228 @@ Page({
17 18 active1: false,
18 19 // 控制佣金
19 20 active2: false,
  21 + url:oo.imghost,
20 22 //popup
21 23 hiddenPopup: true,
  24 +
  25 + list:[],
  26 + is_load:0, //是否正在加载
  27 + is_no_data:0, //没有数据
  28 + is_no_more:0, //没有更多数据
  29 + key_str:'',
  30 + pattern:0, //分成的方式
  31 + currentPage:1, //当前的页码
  32 +
  33 + canvasHidden: 1, //-- 隐藏画布 --
  34 + dis_switch:0, //-- 分销开关 --
  35 + pattern:0, //-- 分成的方式 --
  36 + share_hidden:1, //-- 分享的按钮隐藏 --
  37 + share_good:null, //--- 要分享的商品 ---
  38 +
  39 + timer:0,
  40 + hui_active:null, //优惠活动分享
  41 +
  42 + //点击活动详情的时候的响应
  43 + list2:[],
  44 + is_load2:0,
  45 + is_no_data2:0, //没有数据
  46 + is_no_more2:0, //没有更多数据
  47 + currentPage2:1, //页码
  48 + prom_goods:null, //优惠活动的条件
  49 +
22 50 },
23 51  
24 52 /**
25 53 * 生命周期函数--监听页面加载
26 54 */
27 55 onLoad: function (options) {
28   -
29   - },
30   -
31   - /**
32   - * 生命周期函数--监听页面初次渲染完成
33   - */
34   - onReady: function () {
35   -
  56 + var th=this;
  57 + //接受有没有导购的参数
  58 + var first_leader=options.first_leader;
  59 + if(first_leader){
  60 + //-- user_id代过来免登陆 --
  61 + getApp().globalData.user_id=first_leader;
  62 + getApp().getUserFir();
  63 + }
  64 +
  65 + this.requestGoodsList();
  66 + //-- 自定义海报 --
  67 + getApp().request.promiseGet("/api/weshop/goods/poster/page",{
  68 + data:{store_id:os.stoid, type:1, is_use:1 }
  69 + }).then(res=>{
  70 + if(res.data.code==0){
  71 +
  72 + var poster_data=res.data.data.pageData[0];
  73 + var json_str=poster_data.jsonStr;
  74 +
  75 + if(json_str){
  76 + var json_data=JSON.parse(json_str);
  77 + if(json_data.bg_img){
  78 +
  79 + //-- 把图片那到本地 --
  80 + wx.getImageInfo({
  81 + src:json_data.bg_img,
  82 + success: function(res) {
  83 + var path= res.path;
  84 + th.setData({share_b_img:path})
  85 + },
  86 + fail: function(res) {}
  87 + });
  88 + }
  89 +
  90 + th.setData({poster:json_data})
  91 +
  92 + }
  93 + }
  94 + })
  95 +
  96 + //获取分销的配置
  97 + getApp().request.promiseGet("/api/weshop/storeDistribut/get/"+oo.stoid,{}).then(res=>{
  98 + if(res.data.code==0){
  99 + th.setData({dis_switch:res.data.data.switch,pattern:res.data.data.pattern});
  100 + }
  101 + })
  102 +
  103 + //获取用户设备信息,屏幕宽度
  104 + wx.getSystemInfo({
  105 + success: res => {
  106 + th.setData({
  107 + screenWidth: res.screenWidth
  108 + })
  109 + }
  110 + });
  111 +
  112 + //-- ---秒杀和拼团都要有定时器---
  113 + if(!options.currentIndex || options.currentIndex<=1){
  114 + //设置全局定时器
  115 + th.data.timer=setInterval(function () {
  116 + th.countDown();
  117 + },1000);
  118 + }
36 119 },
37 120  
38 121 /**
39 122 * 生命周期函数--监听页面显示
40 123 */
41   - onShow: function () {
42   -
43   - },
44   -
  124 + onShow: function () {},
45 125 /**
46 126 * 生命周期函数--监听页面隐藏
47 127 */
48 128 onHide: function () {
49   -
50   - },
51   -
52   - /**
53   - * 生命周期函数--监听页面卸载
54   - */
55   - onUnload: function () {
56   -
  129 + //--清理定时器--
  130 + clearInterval(this.timer);
57 131 },
58   -
59   - /**
60   - * 页面相关事件处理函数--监听用户下拉动作
61   - */
62   - // onPullDownRefresh: function () {
63   -
64   - // },
65   -
66   - /**
  132 + /**e
67 133 * 页面上拉触底事件的处理函数
68 134 */
69   - onReachBottom: function () {
70   -
71   - },
  135 + onReachBottom: function () {},
72 136  
73 137 /**
74 138 * 用户点击右上角分享
75 139 */
76 140 onShareAppMessage: function () {
77   -
  141 + var th = this;
  142 + //礼包的转发
  143 + if(th.data.currentIndex==3){
  144 + var lbid=th.data.hui_active.lbId;
  145 + var url="pages/giftpack/giftpacklist/giftpacklist?lbId="+lbid+"&isBuy=1";
  146 + if(getApp().globalData.user_id){
  147 + url+="&first_leader="+getApp().globalData.user_id;
  148 + }
  149 + var img=this.data.share_img;
  150 + var title=th.data.hui_active.giftTitle;
  151 +
  152 + var ob={
  153 + title:title,
  154 + path:url,
  155 + imageUrl: img,
  156 + };
  157 + th.setData({share_hidden:1});
  158 + return ob;
  159 +
  160 + }else{
  161 + //---秒杀,拼团,促销---
  162 + var item=this.data.share_good;
  163 + if(item){
  164 + var price = item.shop_price;
  165 + var title= item.goods_name;
  166 + var img=this.data.url+item.original_img;
  167 + var url="/pages/goods/goodsInfo/goodsInfo?goods_id=" + th.data.gid;
  168 + if(getApp().globalData.user_id){
  169 + url+="&first_leader="+getApp().globalData.user_id;
  170 + }
  171 + var ob={
  172 + title: price + "元 " +title,
  173 + path:url,
  174 + imageUrl: img,
  175 + };
  176 + th.setData({share_hidden:1,share_good:null});
  177 + return ob;
  178 + }else{
  179 + var url="/pages/index/index/index";
  180 + if(getApp().globalData.user_id){
  181 + url+="?first_leader="+getApp().globalData.user_id;
  182 + }
  183 + var hui_active=this.data.hui_active;
  184 + var title=hui_active.name;
  185 + if(!title) title=hui_active.main_goods_name;
  186 + if(!title) title=hui_active.giftTitle;
  187 +
  188 + var ob={
  189 + title: title,
  190 + path:url,
  191 + };
  192 + th.setData({share_hidden:1,share_good:null});
  193 + return ob;
  194 + }
  195 + }
  196 +
78 197 },
79 198  
80   - // 点击价格排序
81   - sort1() {
82   - if(this.data.active2) {
  199 +
  200 + //-- 点击tab --
  201 + clickTab(e) {
  202 + var th=this;
  203 + if(this.data.currentIndex!=e.target.dataset.index){
83 204 this.setData({
84   - active2: !this.data.active2
  205 + currentIndex: e.target.dataset.index,is_no_data:0,is_no_more:0,list:[],
85 206 });
86   - };
87   - this.setData({
88   - active1: !this.data.active1
89   - });
90   -
  207 + this.data.is_load=0;
  208 + this.data.currentPage=1;
  209 + this.requestGoodsList();
  210 + if(e.target.dataset.index<=1){
  211 + //设置全局定时器
  212 + this.data.timer=setInterval(function () {
  213 + th.countDown();
  214 + },1000);
  215 + }else{
  216 + clearInterval(this.timer);
  217 + }
  218 + }
91 219 },
92   - // 点击佣金排序
93   - sort2() {
94   - if(this.data.active1) {
  220 +
  221 + //-- 点击促销页tab --
  222 + clickTab2(e) {
  223 + if(this.data.currentIndex2!=e.target.dataset.index){
95 224 this.setData({
96   - active1: !this.data.active1
  225 + currentIndex2: e.target.dataset.index,is_no_data:0,is_no_more:0,list:[],
97 226 });
98   - };
99   - this.setData({
100   - active2: !this.data.active2
101   - });
102   - },
103   - // 点击tab
104   - clickTab(e) {
105   - this.setData({
106   - currentIndex: e.target.dataset.index,
107   - });
108   - },
109   - // 点击促销页tab
110   - clickTab2(e) {
111   - this.setData({
112   - currentIndex2: e.target.dataset.index,
113   - });
  227 + this.data.is_load=0;
  228 + this.data.currentPage=1;
  229 + this.requestGoodsList();
  230 + }
  231 +
114 232 },
115   - // 点击秒杀和拼单底部tab
116   - clickTab3(e) {
117   - this.setData({
118   - currentIndex3: e.target.dataset.index,
119   - });
  233 + //-- 点击秒杀和拼单底部tab,火热进行和即将开始 --
  234 + clickTab3(e) {
  235 + if(this.data.currentIndex3!=e.target.dataset.index){
  236 + this.setData({
  237 + currentIndex3: e.target.dataset.index,is_no_data:0,is_no_more:0,list:[],
  238 + });
  239 + this.data.is_load=0;
  240 + this.data.currentPage=1;
  241 + this.requestGoodsList();
  242 + }
120 243 },
121 244 // 关闭弹出层
122 245 closePopup() {
... ... @@ -124,10 +247,782 @@ Page({
124 247 hiddenPopup: true
125 248 });
126 249 },
127   - // 显示弹出层
128   - showPopup() {
129   - this.setData({
130   - hiddenPopup: false
131   - });
  250 +
  251 + //--- 显示弹出层 ---
  252 + showPopup(e) {
  253 + var th=this;
  254 + var index=e.currentTarget.dataset.index;
  255 + var hui_active=this.data.list[index];
  256 +
  257 + //---搭配促销--
  258 + this.setData({hui_active: hui_active});
  259 + ////---搭配促销--
  260 + if(this.data.currentIndex2==2){
  261 + this.get_prom_goods();
  262 + }else{
  263 + //-- 获取搭配购的从商品的信息 --
  264 + getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + hui_active.main_goods_id,{}).then(res=>{
  265 + if(res.data.code==0){
  266 + var info=res.data.data
  267 + th.setData({['hui_active.ginfo']:info});
  268 + }
  269 + })
  270 + this.get_colloction();
  271 + }
  272 + this.setData({hiddenPopup:false});
  273 +
  274 + },
  275 +
  276 + get_colloction: async function(){
  277 + var list=null;
  278 + //-- 获取搭配购的从商品的信息 --
  279 + await app.request.promiseGet("/api/weshop/goods/getGoodsPromList/"+oo.stoid+"/"+this.data.hui_active.main_goods_id+"/2",{}).then(res=>{
  280 + if(res.data.code==0){
  281 + list=res.data.data.collocationList;
  282 + }
  283 + })
  284 + if(list){
  285 + for(var i in list){
  286 + await app.request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + list[i].goods_id,{}).then(res=>{
  287 + if(res.data.code==0){
  288 + var info=res.data.data
  289 + list[i].shop_price=info.shop_price;
  290 + }
  291 + })
  292 + }
  293 + }
  294 + this.setData({list2:list});//把数据弄到前台
  295 +
  296 + },
  297 + //-- 获取优惠商品的活动 --
  298 + get_prom_goods:function(){
  299 + var list=null;
  300 + var th=this;
  301 + var prom_goods=null;
  302 + var hui_active=this.data.hui_active;
  303 +
  304 + //-- 获取优惠活动的详情信息 --
  305 + app.request.promiseGet("/api/weshop/promgoodslist/getPromGoodsInfo/"+hui_active.id,{}).then(res=>{
  306 + if(res.data.code==0){
  307 + prom_goods=res.data.data;
  308 + th.setData({prom_goods:prom_goods});
  309 + }
  310 + })
  311 + //-- 指定商品参与,才有商品列表分 --
  312 + if(hui_active.good_object==1){
  313 + this.request_prom_goods();
  314 + }
  315 +
  316 + },
  317 +
  318 + //-- -------获取商品列表--------
  319 + requestGoodsList:function(){
  320 + var th=this;
  321 + if(th.data.is_load) return false; //-- 正在加载
  322 + if(th.data.is_no_data) return false; //-- 没有数据
  323 + if(th.data.is_no_more) return false; //-- 没有更多
  324 + th.data.is_load=1;
  325 + var url="";
  326 + var req_data={
  327 + page:this.data.currentPage,
  328 + store_id:oo.stoid,
  329 + }
  330 +
  331 + switch(th.data.currentIndex){
  332 + case 0: //--秒杀--
  333 + url="/api/ms/flash_sale/spikepage";
  334 + if(th.data.currentIndex3==0){
  335 + url+="?timetype=1"; //火热进行中
  336 + }else{
  337 + url+="?timetype=0"; //即将开始
  338 + }
  339 + req_data.is_show=1;
  340 + req_data.is_end=0;
  341 +
  342 + if(th.data.key_str && th.data.key_str.trim()){
  343 + req_data.key_str=th.data.key_str.trim();
  344 + }
  345 + break;
  346 + case 1: //--拼团--
  347 + url="/api/weshop/teamlist/pageteam";
  348 + if(th.data.currentIndex3==0){
  349 + url+="/1"; //火热进行中
  350 + }else{
  351 + url+="/0"; //即将开始
  352 + }
  353 + req_data.is_show=1;
  354 + req_data.is_end=0;
  355 +
  356 + if(th.data.key_str && th.data.key_str.trim()){
  357 + req_data.key_str=th.data.key_str.trim();
  358 + }
  359 + break;
  360 + case 2: //--促销--
  361 + if(th.data.currentIndex2==0){
  362 + url="//api/weshop/promorder/page";
  363 + if(th.data.key_str && th.data.key_str.trim()){
  364 + req_data.name=th.data.key_str.trim();
  365 + }
  366 + }else if(th.data.currentIndex2==1){
  367 + url="/api/weshop/prom/collocation/pageCollocationGoods";
  368 + if(th.data.key_str && th.data.key_str.trim()){
  369 + req_data.name=th.data.key_str.trim();
  370 + }
  371 + }else{
  372 + url="/api/weshop/promgoods/page";
  373 + if(th.data.key_str && th.data.key_str.trim()){
  374 + req_data.name=th.data.key_str.trim();
  375 + }
  376 + }
  377 + break;
  378 + case 3: //专享礼包
  379 + url='/api/weshop/marketing/giftbag/pageMd';
  380 + if(th.data.key_str && th.data.key_str.trim()){
  381 + req_data.key_str=th.data.key_str.trim();
  382 + }
  383 + break;
  384 + }
  385 +
  386 + if(this.data.key_str && this.data.key_str.trim()){
  387 + var str=this.data.key_str.trim();
  388 + req_data.key_str=str;
  389 + }
  390 + //-- ---调用接口----
  391 + app.request.promiseGet(url,{data:req_data,isShowLoading:1}).then(res=>{
  392 + th.data.is_load=0;
  393 + if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){
  394 + th.data.currentPage++;
  395 + var data=res.data.data.pageData;
  396 + if(res.data.data.page*10>res.data.data.total){th.setData({is_no_more:1});}
  397 + var list=th.data.list;
  398 + list=list.concat(data);
  399 + th.setData({list:list});
  400 + }else{
  401 + if(th.data.currentPage==1){
  402 + th.setData({is_no_data:1});
  403 + }
  404 + }
  405 + })
  406 + },
  407 +
  408 + //-- -------获取活动详情的商品的列表--------
  409 + request_prom_goods:function(){
  410 + var th=this;
  411 + if(th.data.is_load2) return false; //-- 正在加载
  412 + if(th.data.is_no_data2) return false; //-- 没有数据
  413 + if(th.data.is_no_more2) return false; //-- 没有更多
  414 + th.data.is_load2=1;
  415 +
  416 + var req_data={
  417 + page:th.data.currentPage2
  418 + }
  419 + app.request.promiseGet("/api/weshop/goods/page?store_id="+oo.stoid+"&prom_type=3&prom_id="+th.data.hui_active.id,{
  420 + data:req_data,isShowLoading:1
  421 + }).then(res=>{
  422 + th.data.is_load2=0;
  423 + if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){
  424 + th.data.currentPage2++;
  425 + var data=res.data.data.pageData;
  426 + if(res.data.data.page*10>res.data.data.total){th.setData({is_no_more2:1});}
  427 + var list=th.data.list2;
  428 + list=list.concat(data);
  429 + th.setData({list2:list});
  430 + }else{
  431 + if(th.data.currentPage==1){
  432 + th.setData({is_no_data2:1});
  433 + }
  434 + }
  435 + })
  436 + },
  437 +
  438 + //--- 获取卡类列表 ---
  439 + getPlusCardType: function (func) {
  440 + var storid = oo.stoid;
  441 + var th = this;
  442 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
  443 + var plusCard = res.data.data;
  444 + var arr = [1219, 2089, 3031];
  445 + var new_arr = new Array();
  446 + var card_name_map=new Map();
  447 + var user = getApp().globalData.userInfo;
  448 + for (var i = 0; i < plusCard.length; i++) {
  449 + if ((user.card_field==null || user.card_field=="") && (plusCard[i].IsStopBuy==true)) {
  450 + continue;
  451 + }
  452 + var name="card"+plusCard[i].CorrPrice.toLowerCase();
  453 + card_name_map.set(name,plusCard[i].CardName);
  454 + new_arr.push(plusCard[i]);
  455 + }
  456 +
  457 + var ob={"card_list":new_arr,"name_map":card_name_map};
  458 + func(ob);
  459 + })
  460 + },
  461 +
  462 +
  463 + //---图片失败,默认图片---
  464 + bind_bnerr2: function (e) {
  465 + var _errImg = e.target.dataset.errorimg;
  466 + var _errObj = {};
  467 + _errObj[_errImg] ="/miniapp/images/default_g_img.gif";
  468 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  469 + },
  470 + //-- ---更多加载----
  471 + refresh:function(){
  472 + this.requestGoodsList();
  473 + },
  474 +
  475 + //--定义的保存图片方法,分享团---
  476 + saveImageToPhotosAlbum: function() {
  477 + //--先判断会员状态--
  478 + var user_info = getApp().globalData.userInfo;
  479 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  480 + //getApp().my_warnning("请先登录",0,this);
  481 + wx.navigateTo({ url: '/pages/togoin/togoin', })
  482 + return false;
  483 + }
  484 + //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团
  485 + var type = 0;
  486 + wx.showLoading({
  487 + title: '生成中...',
  488 + })
  489 + var that = this, th = that;
  490 + //设置画板显示,才能开始绘图,并关闭底部按钮
  491 + that.setData({
  492 + canvasHidden: false,share_hidden:1
  493 + })
  494 +
  495 + var app = getApp();
  496 + var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
  497 + var scene = th.data.gid+"";
  498 + var user_id=getApp().globalData.user_id?getApp().globalData.user_id:0;
  499 + if(user_id>0){
  500 + scene+="_"+user_id;
  501 + }
  502 +
  503 + ///二微码
  504 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
  505 + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo";
  506 +
  507 + //读取文件成功则OK--
  508 + wx.getImageInfo({
  509 + src: path3,
  510 + success: function(res) {
  511 + //回调写法
  512 + th.get_head_temp(th.get_goods_temp, function() {
  513 + var vpath = res.path;
  514 + var context = wx.createCanvasContext('share');
  515 + //先画背景
  516 + var pg_path = "../../../images/share/share_bg.png";
  517 +
  518 + //-- 如果有自定义海报的时候,判断背景的图片 --
  519 + if(th.data.share_b_img){
  520 + pg_path=th.data.share_b_img;
  521 + }
  522 + context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
  523 +
  524 + //-- 是自定义海报的情况下 --
  525 + if(th.data.poster && parseInt(th.data.poster.style)==2){
  526 + //在线上分享人的情况下
  527 + if(parseInt(th.data.poster.show_headpic)){
  528 + //获取坐标
  529 + var x=parseFloat(th.data.poster.head_x)*2;
  530 + var y=parseFloat(th.data.poster.head_y)*2;
  531 + var x1=(x+90) *unit;
  532 + var y1=(y+50) *unit;
  533 + //--昵称---
  534 + context.setFontSize(24 * unit)
  535 + context.setFillStyle("black")
  536 + context.fillText(app.globalData.userInfo.nickname, x1, y1);
  537 + var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit;
  538 + //强烈推荐 改许程
  539 + var tj_path = "../../../images/share/q_tj.png";
  540 + context.drawImage(tj_path, x1 + width, y1-22*unit, 85 * unit, 30 * unit);
  541 + context.setFontSize(16 * unit)
  542 + context.setLineJoin('round'); //交点设置成圆角
  543 + context.setFillStyle("white")
  544 + context.fillText('强烈推荐', x1 + width+8*unit, y1-1*unit);
  545 + }
  546 + }else{
  547 + //--昵称---
  548 + context.setFontSize(24 * unit)
  549 + context.setFillStyle("black")
  550 + context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit);
  551 + var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit;
  552 + //强烈推荐 改许程
  553 + var tj_path = "../../../images/share/q_tj.png";
  554 + context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit);
  555 + context.setFontSize(16 * unit)
  556 + context.setLineJoin('round'); //交点设置成圆角
  557 + context.setFillStyle("white")
  558 + context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 76 * unit);
  559 + }
  560 +
  561 +
  562 + //---产品名称---
  563 + //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
  564 + context.setFillStyle("black");
  565 + context.setFontSize(21.3 * unit)
  566 + th.draw_Text(context, th.data.share_good.goods_name,
  567 + 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit);
  568 + //------产品的价格-------
  569 + context.setFontSize(23 * unit)
  570 + context.setFillStyle("red")
  571 + context.fillText("¥", 416 * unit, 185 * unit);
  572 + context.setFontSize(31 * unit)
  573 + var pri0 = th.data.share_good.shop_price;
  574 + if (th.data.prom_act)
  575 + pri0 = th.data.prom_act.price;
  576 +
  577 + pri0 = parseFloat(pri0).toFixed(2);
  578 + context.fillText(pri0, 438 * unit, 185 * unit);
  579 + //---市场价划掉---
  580 + context.setFillStyle("gray")
  581 + context.setFontSize(22 * unit)
  582 + context.fillText("¥" + th.data.share_good.market_price, 426 * unit, 213 * unit);
  583 + context.setStrokeStyle('gray')
  584 + context.setLineWidth(1 * unit)
  585 + context.moveTo(426 * unit, 206 * unit)
  586 + context.lineTo(510 * unit, 206 * unit)
  587 + context.stroke();
  588 + //---中间大图---
  589 + context.drawImage(th.data.share_goods_img, 68 * unit, 242 * unit, 410 * unit, 410 * unit);
  590 + //-------大图后面就不一样了-----------
  591 + switch (type) {
  592 + case 0: //普通商品的展示
  593 + //中间的几个字
  594 + if(th.data.poster && parseInt(th.data.poster.style)==2 ){
  595 + if(parseInt(th.data.poster.show_quality)){
  596 + var g_path = "../../../images/share/s_gou.png";
  597 + context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
  598 + context.setFillStyle("red")
  599 + context.setFontSize(18 * unit)
  600 + context.fillText("正品保证", 84 * unit, 690 * unit);
  601 +
  602 + context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
  603 + context.setFillStyle("red")
  604 + context.setFontSize(18 * unit)
  605 + context.fillText("纯实体店", 246 * unit, 690 * unit);
  606 +
  607 + context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
  608 + context.setFillStyle("red")
  609 + context.setFontSize(18 * unit)
  610 + context.fillText("官方验证", 420 * unit, 690 * unit);
  611 + }
  612 +
  613 + }else{
  614 + var g_path = "../../../images/share/s_gou.png";
  615 + context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
  616 + context.setFillStyle("red")
  617 + context.setFontSize(18 * unit)
  618 + context.fillText("正品保证", 84 * unit, 690 * unit);
  619 +
  620 + context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
  621 + context.setFillStyle("red")
  622 + context.setFontSize(18 * unit)
  623 + context.fillText("纯实体店", 246 * unit, 690 * unit);
  624 +
  625 + context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
  626 + context.setFillStyle("red")
  627 + context.setFontSize(18 * unit)
  628 + context.fillText("官方验证", 420 * unit, 690 * unit);
  629 + }
  630 +
  631 + //---画线---
  632 + context.setLineWidth(1 * unit)
  633 + context.moveTo(32 * unit, 710 * unit)
  634 + context.lineTo(520 * unit, 710 * unit)
  635 + context.stroke();
  636 + //---文字---
  637 + context.setFillStyle("black")
  638 + context.setFontSize(22 * unit)
  639 + // 原来start --->
  640 + context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit);
  641 + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 826 * unit);
  642 +
  643 + //---二维吗图---
  644 + //-- 自定义海报 --
  645 + if(th.data.poster){
  646 + var erm_x= parseFloat(th.data.poster.ewm_x)*2;
  647 + var erm_y= parseFloat(th.data.poster.ewm_y)*2;
  648 + context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
  649 + }else{
  650 + //---二维吗图---
  651 + context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
  652 + }
  653 +
  654 + break;
  655 + case 1: //秒杀商品的展示
  656 + //---画线---
  657 + context.setLineWidth(1 * unit)
  658 + context.moveTo(32 * unit, 670 * unit)
  659 + context.lineTo(520 * unit, 670 * unit)
  660 + context.stroke();
  661 +
  662 + //画秒杀的图片
  663 + var miaos_path = '../../../images/share/miao_share.png';
  664 + context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit);
  665 +
  666 + //---文字---
  667 + context.setFontSize(22 * unit)
  668 + context.setFillStyle("black")
  669 + context.fillText("特惠好物,限时秒杀", 40 * unit, 806 * unit);
  670 + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit);
  671 + //---二维吗图---
  672 + //-- 自定义海报 --
  673 + if(th.data.poster){
  674 + var erm_x= parseFloat(th.data.poster.ewm_x)*2;
  675 + var erm_y= parseFloat(th.data.poster.ewm_y)*2;
  676 + context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
  677 + }else{
  678 + //---二维吗图---
  679 + context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
  680 + }
  681 + break;
  682 +
  683 + case 2: //会员团和商家团的展示
  684 + //---画线---
  685 + context.setLineWidth(1 * unit)
  686 + context.moveTo(32 * unit, 670 * unit)
  687 + context.lineTo(520 * unit, 670 * unit)
  688 + context.stroke();
  689 + //---文字---
  690 + context.setFontSize(22 * unit)
  691 + context.font = 'normal bold';
  692 + context.setFillStyle("black")
  693 + context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit);
  694 +
  695 + //绘制成团图片
  696 + var ct_img = "../../../images/share/ct_num.png";
  697 + context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit);
  698 + var ct_num = th.data.prom_act.ct_num;
  699 + context.setFontSize(14 * unit)
  700 + context.font = 'normal';
  701 + context.setFillStyle("red")
  702 + if (ct_num < 10) {
  703 + context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit);
  704 + } else {
  705 + context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit);
  706 + }
  707 + context.setFontSize(22 * unit)
  708 + context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit);
  709 + context.setFillStyle("gray")
  710 + context.fillText("快来和我一起拼团吧!", 40 * unit, 826 * unit);
  711 + context.setFillStyle("black")
  712 + context.font = 'normal bold 18px sans-serif';
  713 + context.setFontSize(21.3 * unit)
  714 + context.fillText("长按识别二维码,立即参团", 40 * unit, 856 * unit);
  715 + //---二维吗图---
  716 + //-- 自定义海报 --
  717 + if(th.data.poster){
  718 + var erm_x= parseFloat(th.data.poster.ewm_x)*2;
  719 + var erm_y= parseFloat(th.data.poster.ewm_y)*2;
  720 + context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
  721 + }else{
  722 + //---二维吗图---
  723 + context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
  724 + }
  725 + break
  726 + case 3: //阶梯团的展示
  727 + //---画线---
  728 + context.setLineWidth(1 * unit)
  729 + context.moveTo(32 * unit, 670 * unit)
  730 + context.lineTo(520 * unit, 670 * unit)
  731 + context.stroke();
  732 + //---文字---
  733 + context.setFontSize(22 * unit)
  734 + context.font = 'normal bold';
  735 + context.setFillStyle("black")
  736 + context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit);
  737 + //---绘制中间阶梯的价格---
  738 + var list = th.data.prom_act.ct_rylist;
  739 + for (var i = 0; i < list.length; i++) {
  740 + var item = list[i];
  741 + var wi = i * 90 * unit;
  742 + context.font = 'normal';
  743 + context.setFontSize(16 * unit)
  744 + context.setFillStyle("red")
  745 + context.fillText("¥", 40 * unit + wi, 756 * unit);
  746 + context.setFontSize(22 * unit)
  747 + var pri = parseFloat(item.price).toFixed(2);
  748 + context.fillText(pri, 56 * unit + wi, 756 * unit);
  749 + context.setFillStyle("gray")
  750 + context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit);
  751 + }
  752 + //----------------下面部分----------------
  753 + context.setFillStyle("gray")
  754 + context.fillText("快来和我一起拼团吧!", 40 * unit, 830 * unit);
  755 + context.setFillStyle("black")
  756 + context.font = 'normal bold 18px sans-serif';
  757 + context.setFontSize(22 * unit)
  758 + context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit);
  759 +
  760 + //-- 自定义海报 --
  761 + if(th.data.poster){
  762 + var erm_x= parseFloat(th.data.poster.ewm_x)*2;
  763 + var erm_y= parseFloat(th.data.poster.ewm_y)*2;
  764 + context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
  765 + }else{
  766 + //---二维吗图---
  767 + context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
  768 + }
  769 + break
  770 + }
  771 +
  772 +
  773 + //--- 如果是自定义海报的时候 ---
  774 + if(th.data.poster && parseInt(th.data.poster.style)==2){
  775 + //如果显示会员信息的话
  776 + if(parseInt(th.data.poster.show_headpic)){
  777 + //获取坐标
  778 + var x= parseFloat(th.data.poster.head_x)*2;
  779 + var y=parseFloat(th.data.poster.head_y)*2;
  780 + //---绘制圆形要放在最后----
  781 + context.save();
  782 + context.beginPath();
  783 + var h_x = x* unit;
  784 + var h_y = y * unit;
  785 + var h_r = 40 * unit;
  786 + var cx = h_x + h_r;
  787 + var cy = h_y + h_r;
  788 + context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
  789 + context.closePath();
  790 + context.fill();
  791 + context.clip();
  792 + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
  793 + context.restore();
  794 + }
  795 +
  796 + }else{
  797 + //---绘制圆形要放在最后----
  798 + context.save();
  799 + context.beginPath();
  800 + var h_x = 60 * unit;
  801 + var h_y = 24 * unit;
  802 + var h_r = 40 * unit;
  803 + var cx = h_x + h_r;
  804 + var cy = h_y + h_r;
  805 + context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
  806 + context.closePath();
  807 + context.fill();
  808 + context.clip();
  809 + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
  810 + context.restore();
  811 + }
  812 +
  813 +
  814 + //把画板内容绘制成图片,并回调 画板图片路径
  815 + context.draw(false, function() {
  816 + setTimeout(function() {
  817 + wx.canvasToTempFilePath({
  818 + x: 0,
  819 + y: 0,
  820 + width: 750,
  821 + height: 1217,
  822 + destWidth: 1.2 * 750 * 750 / that.data.screenWidth,
  823 + destHeight: 1.2 * 1217 * 750 / that.data.screenWidth,
  824 + canvasId: 'share',
  825 + success: function(res) {
  826 + that.setData({
  827 + shareImgPath: res.tempFilePath,
  828 + canvasHidden: true
  829 + })
  830 + if (!res.tempFilePath) {
  831 + wx.showModal({
  832 + title: '提示',
  833 + content: '图片绘制中,请稍后重试',
  834 + showCancel: false
  835 + })
  836 + return false;
  837 + }
  838 + wx.previewImage({
  839 + //将图片预览出来
  840 + urls: [that.data.shareImgPath]
  841 + });
  842 + //-- 将商品清空 --
  843 + th.setData({share_good:null});
  844 +
  845 + wx.hideLoading();
  846 + }
  847 + })
  848 + }, 500)
  849 +
  850 + });
  851 + });
  852 + }
  853 + });
  854 +
  855 + },
  856 + //---点击分享优惠活动---
  857 + share_index:function(e){
  858 + var index=e.currentTarget.dataset.index;
  859 + var item=this.data.list[index];
  860 + this.setData({share_hidden:0,hui_active:item});
  861 +
  862 + var com = this.selectComponent("#share_button"); //组件的id
  863 + com.set_type(1);
  864 + },
  865 + //---点击分享商品---
  866 + share_good:function(e){
  867 + var index=e.currentTarget.dataset.index;
  868 + var item=this.data.list[index];
  869 + this.setData({share_hidden:0,share_good:item});
  870 +
  871 + var com = this.selectComponent("#share_button"); //组件的id
  872 + com.set_type(0);
  873 + },
  874 +
  875 + //----活动详情里面的分享---
  876 + share_good2:function(e){
  877 + var index=e.currentTarget.dataset.index;
  878 + var item=this.data.list2[index];
  879 + this.setData({share_hidden:0,share_good:item});
  880 + var com = this.selectComponent("#share_button"); //组件的id
  881 + com.set_type(0);
  882 + },
  883 +
  884 + //-----详情里面的分享-------
  885 + share_detail:function(e){
  886 + var com = this.selectComponent("#share_button"); //组件的id
  887 + com.set_type(0);
  888 +
  889 + var idx=e.currentTarget.dataset.index;
  890 + var item=this.data.list2[index];
  891 + this.setData({share_hidden:0,share_good:item});
  892 + },
  893 +
  894 + cancel:function(){
  895 + this.setData({share_hidden:1});
  896 + },
  897 +
  898 + //--获取头像的本地缓存,回调写法--
  899 + get_head_temp: function(tt, func) {
  900 + var ee = this;
  901 + if (ee.data.share_head) {
  902 + tt(func);
  903 + return false;
  904 + }
  905 + //---获取分享图片的本地地址,头像和商品图片----
  906 + var path2 = getApp().globalData.userInfo.head_pic;
  907 + if (path2 == "") {
  908 + ee.data.share_head = "../../../images/share/hui_hear_pic.png";
  909 + tt(func);
  910 + } else {
  911 + path2 = path2.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
  912 + path2 = path2.replace("https://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
  913 + wx.getImageInfo({
  914 + src: path2,
  915 + success: function(res) {
  916 + //res.path是网络图片的本地地址
  917 + ee.data.share_head = res.path;
  918 + tt(func);
  919 + },
  920 + fail: function(res) {
  921 + ee.data.share_head = "../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的
  922 + tt(func);
  923 + }
  924 + });
  925 + }
  926 + },
  927 + //--获取商品图片的本地缓存,回调写法--
  928 + get_goods_temp: function(tt) {
  929 + var ee = this;
  930 + //获取商品是分享图信息
  931 + wx.getImageInfo({
  932 + src: ee.data.url+ee.data.share_good.original_img,
  933 + success: function(res) {
  934 + //res.path是网络图片的本地地址
  935 + ee.data.share_goods_img = res.path;
  936 + tt();
  937 + },
  938 + fail: function(res) {
  939 + ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
  940 + tt();
  941 + }
  942 + });
  943 + },
  944 +
  945 + //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
  946 + draw_Text: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) {
  947 + var lineWidth = 0;
  948 + var lastSubStrIndex = 0; //每次开始截取的字符串的索引
  949 + var han = 0;
  950 + for (let i = 0; i < str.length; i++) {
  951 + if (han == 2) return;
  952 + //lineWidth += ctx.measureText(str[i]).width;
  953 + lineWidth += ut.measureText(str[i], 21.3 * unit);
  954 + if (lineWidth > canvasWidth) {
  955 + han++;
  956 +
  957 + if (han == 2)
  958 + ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分
  959 + else
  960 + ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight);
  961 +
  962 + initHeight += 22; //22为字体的高度
  963 + lineWidth = 0;
  964 + lastSubStrIndex = i;
  965 + titleHeight += 20;
  966 + }
  967 + if (i == str.length - 1) { //绘制剩余部分
  968 + ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight);
  969 + }
  970 + }
  971 + },
  972 +
  973 + //---小于10的格式化函数----
  974 + timeFormat(param) {
  975 + return param < 10 ? '0' + param : param;
132 976 },
  977 +
  978 + //----倒计时函数-----
  979 + countDown() {
  980 + if(!this.data.timer) return false;
  981 + var th=this;
  982 + // 获取当前时间,同时得到活动结束时间数组
  983 + let newTime =ut.gettimestamp();
  984 + var endTimeList = this.data.list;
  985 + if(endTimeList==null) return null
  986 + // 对结束时间进行处理渲染到页面
  987 + for (var i = 0; i < endTimeList.length;i++){
  988 + var o = endTimeList[i];
  989 + var endTime = o.end_time;
  990 + let obj = null;
  991 + // 如果活动未结束,对时间进行处理
  992 + if (endTime - newTime > 0){
  993 + let time = (endTime - newTime);
  994 + // 获取天、时、分、秒
  995 + let day = parseInt(time / (60 * 60 * 24));
  996 + let hou = parseInt(time % (60 * 60 * 24) / 3600);
  997 + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
  998 + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
  999 + obj = {
  1000 + day: this.timeFormat(day), hou: this.timeFormat(hou), min: this.timeFormat(min), sec: this.timeFormat(sec), hide: 1
  1001 + }
  1002 + }else{
  1003 + //活动已结束,全部设置为'00'
  1004 + obj = { day: '00', hou: '00', min: '00', sec: '00' }
  1005 + }
  1006 + var txt ="list["+i+"].djs";
  1007 + th.setData({ [txt]: obj});
  1008 + }
  1009 + },
  1010 +
  1011 + //-------搜索的相关功能------
  1012 + set_search_value:function(e){
  1013 + var key_str=e.detail.value;
  1014 + if(key_str) key_str=key_str.trim();
  1015 + this.setData({key_str:key_str});
  1016 +
  1017 + },
  1018 + search_data:function(){
  1019 + this.setData({
  1020 + is_no_data:0,is_no_more:0,list:[],
  1021 + });
  1022 + this.data.is_load=0;
  1023 + this.data.currentPage=1;
  1024 + this.requestGoodsList();
  1025 + }
  1026 +
  1027 +
133 1028 })
134 1029 \ No newline at end of file
... ...
packageA/pages/activity_share/activity_share.json
1 1 {
  2 + "navigationBarTitleText": "活动分享",
2 3 "usingComponents": {
3   - "nodata": "/components/nodata/nodata"
  4 + "nodata": "/components/nodata/nodata",
  5 + "share_button": "/components/share/share"
4 6 },
5 7 "enablePullDownRefresh": false
6 8 }
7 9 \ No newline at end of file
... ...
packageA/pages/activity_share/activity_share.wxml
  1 +<wxs module="g_filter" src="g_filter.wxs"></wxs>
1 2 <view class="container">
2 3 <!-- 搜索框 -->
3 4 <view class="search-container">
4   - <view class="input-container"><input class="search" type="text" placeholder="请输入您想查找的商品信息"/></view>
5   - <view class="btn-search">搜索</view>
  5 + <view class="input-container"><input bindinput="set_search_value" class="search" type="text" placeholder="请输入您想查找的商品信息"/></view>
  6 + <view bindtap="search_data" class="btn-search">搜索</view>
6 7 </view>
7 8  
8 9 <!-- 列表 -->
... ... @@ -23,40 +24,50 @@
23 24 <scroll-view
24 25 class="list {{currentIndex == 2?'active1':''}} {{currentIndex == 3?'active2':''}}"
25 26 scroll-y="true"
  27 + bindscrolltolower="refresh"
26 28 scroll-anchoring
27 29 refresher-enabled>
28   -
29   - <!-- 暂无数据 -->
30   - <nodata nodataContainer="nodata">暂无数据</nodata>
31   -
  30 +
  31 + <block wx:for="{{list}}">
  32 +
32 33 <!-- 拼单和秒杀 -->
33 34 <block wx:if="{{currentIndex == 0 || currentIndex == 1}}">
34 35 <view class class="list-item">
35   - <view class="img-container"></view>
  36 + <view class="img-container">
  37 + <image src="{{url+item.original_img}}" style="width: 100%; height: 100%;"
  38 + binderror="bind_bnerr2" lazy-load="true"
  39 + data-errorimg="list[{{index}}].original_img"></image>
  40 +
  41 + </view>
36 42 <view class="details">
37   - <view class="fs28 name ellipsis-2">商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称</view>
  43 + <view class="fs28 name ellipsis-2">{{item.title}}</view>
38 44 <view>
39 45 <!-- 点击秒杀时显示 -->
40 46 <view class="flex ai-center pdtb8" wx:if="{{currentIndex == 0}}">
41 47 <view class="progress-container">
42   - <progress class="progress" percent="50" border-radius="6" stroke-width="14" activeColor="#FE6867" backgroundColor="#ccc"></progress>
43   - <text class="percent fs20">剩余100%</text>
  48 + <progress class="progress" percent="{{100*(item.goods_num-item.buy_num)/item.goods_num}}" border-radius="6" stroke-width="14" activeColor="#FE6867" backgroundColor="#ccc"></progress>
  49 + <text class="percent fs20">剩余{{g_filter.toFix(100*(item.goods_num-item.buy_num)/item.goods_num,2) }}%</text>
44 50 </view>
45   - <view class="fs22 gray">已抢0件</view>
  51 + <view class="fs22 gray">已抢{{item.buy_num}}件</view>
46 52 </view>
47 53 <!-- 点击拼单时显示 -->
48 54 <view class="flex pdtb6" wx:if="{{currentIndex == 1}}">
49   - <view class="group-num">已拼0份</view>
  55 + <view class="group-num">已拼{{item.buy_num}}份</view>
50 56 <view class="group-type">1人团</view>
51 57 </view>
52 58 <!-- 公共项 -->
53   - <view class="fs22 red">剩余:51天21时37分34秒</view>
  59 + <view class="fs22 red">剩余:
  60 + <text class='tui-conutdown-box'> {{item.djs.day}}</text>天
  61 + <text class='tui-conutdown-box'>{{item.djs.hou}}</text>时
  62 + <text class='tui-conutdown-box'>{{item.djs.min}}</text>分
  63 + <text class='tui-conutdown-box tui-countdown-bg'>{{item.djs.sec}}</text>秒
  64 + </view>
54 65 </view>
55 66 <view class="red flex ai-center">
56   - <view>¥200.00</view>
57   - <view class="retail">零售价:¥76.00</view>
  67 + <view>¥{{item.price}}</view>
  68 + <view class="retail">零售价:¥{{item.market_price}}</view>
58 69 </view>
59   - <view class="t-r fs28"><text class="btn-share">分享</text></view>
  70 + <view bindtap="share_good" data-index="{{index}}" class="t-r fs28"><text class="btn-share">分享</text></view>
60 71 </view>
61 72 </view>
62 73 </block>
... ... @@ -68,21 +79,26 @@
68 79 <view class="subTab-item">
69 80 <view class="bdr-b">
70 81 <view class="flex">
71   - <view class="badge">折</view>
72   - <view class="ellipsis-1">促销活动名称名称名称名称名称名称名称名称名称名称</view>
  82 + <view wx:if="{{currentIndex2==1 && item.type==0}}" class="badge">折</view>
  83 + <view wx:if="{{currentIndex2==1 && item.type==1}}" class="badge">减</view>
  84 + <view wx:if="{{currentIndex2==1}}" class="badge">配</view>
  85 + <view wx:if="{{currentIndex2==2}}" class="badge">惠</view>
  86 + <view wx:if="{{currentIndex2==1}}" class="ellipsis-1">{{item.main_goods_name}}</view>
  87 + <view wx:else class="ellipsis-1">{{item.name}}</view>
73 88 </view>
74   - <view class="pdv10 fs28">促销时间:2020-09-28 16:00 到 2020-09-28 16:00</view>
  89 + <view class="pdv10 fs28">促销时间:{{g_filter.format_time(item.start_time,1)}} 到 {{g_filter.format_time(item.end_time,1)}}</view>
75 90 </view>
76   - <view class="flex-space-between" wx:if="{{currentIndex == 2 && currentIndex2 == 0}}">
  91 + <view class="flex-space-between" wx:if="{{currentIndex2 == 0}}">
77 92 <view class="fs28">
78   - <view class="pdv10">需购买金额:¥400</view>
79   - <view>折扣:90</view>
  93 + <view class="pdv10">需购买金额:¥{{g_filter.toFix(item.money,2)}}</view>
  94 + <view wx:if="{{item.type==0}}">折扣:{{item.expression}}(%)</view>
  95 + <view wx:if="{{item.type==1}}">优惠金额:{{g_filter.toFix(item.expression,2)}}</view>
80 96 </view>
81   - <view class="btn-container"><text class="btn-share">分享</text></view>
  97 + <view bindtap="share_index" data-index="{{index}}" class="btn-container"><text class="btn-share">分享</text></view>
82 98 </view>
83   - <view class="flex-equality pdt20" wx:if="{{currentIndex == 2 && currentIndex2 !== 0}}">
84   - <view class="btn-container" bindtap="showPopup"><text class="btn-share">活动详情</text></view>
85   - <view class="btn-container"><text class="btn-share w164">分享</text></view>
  99 + <view class="flex-equality pdt20" wx:else>
  100 + <view bindtap="showPopup" data-index="{{index}}" class="btn-container" ><text class="btn-share">活动详情</text></view>
  101 + <view bindtap="share_index" data-index="{{index}}" class="btn-container"><text class="btn-share w164">分享</text></view>
86 102 </view>
87 103 </view>
88 104 </view>
... ... @@ -92,18 +108,29 @@
92 108 <!-- 专享礼包 -->
93 109 <block wx:if="{{currentIndex == 3}}">
94 110 <view class class="list-item">
95   - <view class="img-container"></view>
  111 + <view class="img-container">
  112 + <image src="{{url+item.lbUrl}}" style="width: 100%; height: 100%;"
  113 + binderror="bind_bnerr2" lazy-load="true"
  114 + data-errorimg="list[{{index}}].lbUrl"></image>
  115 + </view>
96 116 <view class="details">
97   - <view class="ellipsis-2 fs28 name">商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称</view>
98   - <view class="pdt14 red">¥200.00/10积分</view>
99   - <view class="fs22 line-through gray">零售价:¥76.00</view>
100   - <view class="fs22">已售:<text class="red">3</text></view>
101   - <view class="t-r fs28"><view class="btn-share">分享</view></view>
  117 + <view class="ellipsis-2 fs28 name">{{item.giftTitle}}</view>
  118 + <view class="pdt14 red">
  119 + <tex wx:if="{{item.payMoney}}">¥{{g_filter.toFix(item.payMoney,2)}}</tex>
  120 + <text wx:if="{{item.payMoney && item.payIntegral}}">/</text>
  121 + <text wx:if="{{item.payIntegral}}">{{item.payIntegral}}积分</text>
  122 + </view>
  123 + <view class="fs22 line-through gray">零售价:¥{{item.giftPosPrice}}</view>
  124 + <!-- <view class="fs22">已售:<text class="red">3</text></view> -->
  125 + <view bindtap="share_index" data-index="{{index}}" class="t-r fs28"><view class="btn-share">分享</view></view>
102 126 </view>
103 127 </view>
104 128 </block>
105 129  
106   - <view class="no-more t-c">- 已全部加载 -</view>
  130 + </block><!--for的闭合 -->
  131 + <view style="height: 1rpx;"></view>
  132 + <nodata wx:if="{{list.length==0}}" nodataContainer="nodata">暂无数据</nodata>
  133 + <view wx:if="{{is_no_more}}" class="no-more t-c">- 已全部加载 -</view>
107 134 </scroll-view>
108 135 </view>
109 136  
... ... @@ -126,9 +153,9 @@
126 153 <block wx:if="{{currentIndex2 == 1}}">
127 154 <view class="pdv20 dash-b fs28">
128 155 <view class="popup-title2">必买商品</view>
129   - <view class="popup-title3">商品编号:1000234478</view>
130   - <view class="popup-title3">商品名称:欧诗漫护手霜(条码)</view>
131   - <view class="popup-title3 red">手店价:¥500</view>
  156 + <view class="popup-title3">商品编号:{{hui_active.goods_sn}}</view>
  157 + <view class="popup-title3">{{hui_active.main_goods_name}}</view>
  158 + <view class="popup-title3 red">手店价:¥{{g_filter.toFix(hui_active.ginfo.shop_price,2)}}</view>
132 159 </view>
133 160 <view class="pdv20">
134 161 <view class="popup-title2 fs28">搭配商品</view>
... ... @@ -140,77 +167,35 @@
140 167 <view class="w25">搭配价</view>
141 168 </view>
142 169 <view class="popup-list t-c">
143   - <view class="flex ai-center pdb10">
144   - <view class="w25">1</view>
145   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
146   - <view class="w25">¥50.00</view>
147   - <view class="w25 red">¥50.00</view>
148   - </view>
149   - <view class="flex ai-center pdb10">
150   - <view class="w25">1</view>
151   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
152   - <view class="w25">¥50.00</view>
153   - <view class="w25 red">¥50.00</view>
154   - </view>
155   - <view class="flex ai-center pdb10">
156   - <view class="w25">1</view>
157   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
158   - <view class="w25">¥50.00</view>
159   - <view class="w25 red">¥50.00</view>
160   - </view>
161   - <view class="flex ai-center pdb10">
162   - <view class="w25">1</view>
163   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
164   - <view class="w25">¥50.00</view>
165   - <view class="w25 red">¥50.00</view>
166   - </view>
167   - <view class="flex ai-center pdb10">
168   - <view class="w25">1</view>
169   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
170   - <view class="w25">¥50.00</view>
171   - <view class="w25 red">¥50.00</view>
172   - </view>
173   - <view class="flex ai-center pdb10">
174   - <view class="w25">1</view>
175   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
176   - <view class="w25">¥50.00</view>
177   - <view class="w25 red">¥50.00</view>
178   - </view>
179   - <view class="flex ai-center pdb10">
180   - <view class="w25">1</view>
181   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
182   - <view class="w25">¥50.00</view>
183   - <view class="w25 red">¥50.00</view>
184   - </view>
185   - <view class="flex ai-center pdb10">
186   - <view class="w25">1</view>
187   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
188   - <view class="w25">¥50.00</view>
189   - <view class="w25 red">¥50.00</view>
190   - </view>
191   - <view class="flex ai-center pdb10">
192   - <view class="w25">1</view>
193   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
194   - <view class="w25">¥50.00</view>
195   - <view class="w25 red">¥50.00</view>
196   - </view>
197   - <view class="flex ai-center pdb10">
198   - <view class="w25">1</view>
199   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
200   - <view class="w25">¥50.00</view>
201   - <view class="w25 red">¥50.00</view>
202   - </view>
  170 + <block wx:for="{{list2}}">
  171 + <view class="flex ai-center pdb10">
  172 + <view class="w25">{{index+1}}</view>
  173 + <view class="w25 ellipsis-2">{{item.goods_name}}</view>
  174 + <view class="w25">¥{{g_filter.toFix(item.shop_price,2)}}</view>
  175 + <view class="w25 red">¥{{g_filter.toFix(item.price,2)}}</view>
  176 + </view>
  177 + </block>
  178 +
203 179 </view>
204 180 </view>
205 181 </view>
206 182 </block>
  183 +
207 184 <!-- 优惠促销 -->
208 185 <block wx:if="{{currentIndex2 == 2}}">
209 186 <view class="pdv20 dash-b">
210 187 <view class="popup-title2 fs28">参与对象</view>
211 188 <view class="flex ai-center t-c fs28 pdv20">
212   - <view class="w50"><radio disabled/>全部商品</view>
213   - <view class="w50"><radio checked="true" disabled/>指定商品</view>
  189 + <view class="w50">
  190 + <radio wx:if="{{hui_active.good_object==0}}" checked="true" disabled/>
  191 + <radio wx:else disabled/>
  192 + 全部商品
  193 + </view>
  194 + <view class="w50">
  195 + <radio wx:if="{{hui_active.good_object==1}}" checked="true" disabled/>
  196 + <radio wx:else disabled/>
  197 + 指定商品
  198 + </view>
214 199 </view>
215 200 <view class="fs28">
216 201 <view class="flex t-c bold pdv10">
... ... @@ -219,75 +204,48 @@
219 204 <view class="w25">手店价</view>
220 205 <view class="w25">操作</view>
221 206 </view>
222   - <view class="t-c">
223   - <view class="flex ai-center pdb10">
224   - <view class="w25">1</view>
225   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
226   - <view class="w25">¥50/¥40</view>
227   - <view class="w25"><text class="btn-share">分享</text></view>
228   - </view>
229   - <view class="flex ai-center pdb10">
230   - <view class="w25">1</view>
231   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
232   - <view class="w25">¥50/¥40</view>
233   - <view class="w25"><text class="btn-share">分享</text></view>
234   - </view>
235   - <view class="flex ai-center pdb10">
236   - <view class="w25">1</view>
237   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
238   - <view class="w25">¥50/¥40</view>
239   - <view class="w25"><text class="btn-share">分享</text></view>
240   - </view>
241   - <view class="flex ai-center pdb10">
242   - <view class="w25">1</view>
243   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
244   - <view class="w25">¥50/¥40</view>
245   - <view class="w25"><text class="btn-share">分享</text></view>
246   - </view>
247   - <view class="flex ai-center pdb10">
248   - <view class="w25">1</view>
249   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
250   - <view class="w25">¥50/¥40</view>
251   - <view class="w25"><text class="btn-share">分享</text></view>
252   - </view>
253   - <view class="flex ai-center pdb10">
254   - <view class="w25">1</view>
255   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
256   - <view class="w25">¥50/¥40</view>
257   - <view class="w25"><text class="btn-share">分享</text></view>
258   - </view>
259   - <view class="flex ai-center pdb10">
260   - <view class="w25">1</view>
261   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
262   - <view class="w25">¥50/¥40</view>
263   - <view class="w25"><text class="btn-share">分享</text></view>
264   - </view>
265   - <view class="flex ai-center pdb10">
266   - <view class="w25">1</view>
267   - <view class="w25 ellipsis-2">欧式满护手霜手霜手霜手霜手霜手霜</view>
268   - <view class="w25">¥50/¥40</view>
269   - <view class="w25"><text class="btn-share">分享</text></view>
270   - </view>
  207 + <view class="t-c">
  208 + <block wx:for="{{list2}}">
  209 + <view class="flex ai-center pdb10">
  210 + <view class="w25">{{index+1}}</view>
  211 + <view class="w25 ellipsis-2">{{item.goods_name}}</view>
  212 + <view class="w25">¥{{item.shop_price}}</view>
  213 + <view bindtap="share_good2" data-index="{{index}}" class="w25"><text class="btn-share">分享</text></view>
  214 + </view>
  215 + </block>
271 216 </view>
272 217 </view>
273 218 </view>
274 219 <view class="pdv20">
275 220 <view class="popup-title2 fs28">活动详情</view>
276   - <view class="fs28">
277   - <view class="pdv10">需购买:50元/件</view>
278   - <view class="pdl20">
279   - <view class="flex pdb20">
280   - <view class="w50"><radio disabled/>减现金 <text class="red">-100</text></view>
281   - <view class="w50"><radio checked="true" disabled/>打折 <text class="red">90%</text></view>
282   - </view>
283   - <view class="flex pdb20">
284   - <view class="w50"><radio disabled/>包邮</view>
285   - <view class="w50"><radio disabled/>积分 <text class="red">90</text></view>
  221 + <view class="fs28">
  222 + <block wx:for="{{prom_goods}}">
  223 + <view class="pdv10">需购买:{{item.condition}}
  224 + <text wx:if="{{item.prom_type==0}}">元</text>
  225 + <text wx:else>件</text>
286 226 </view>
287   - <view class="pdb20"><radio disabled/>优惠券</view>
288   - <view class="pdb20"><radio disabled/>赠品</view>
289   - <view><radio disabled/>礼包</view>
290   - </view>
  227 + <view class="pdl20">
  228 + <view class="flex pdb20">
  229 + <view class="w50" wx:if="{{item.money}}"><radio checked="true" disabled/>减现金 <text class="red">-{{item.money}}</text></view>
  230 + <view class="w50" wx:if="{{item.sale}}"><radio checked="true" disabled/>打折 <text class="red">{{item.sale}}%</text></view>
  231 + </view>
  232 + <view class="flex pdb20">
  233 + <view class="w50"><radio wx:if="{{item.past}}" checked="true" disabled/><radio wx:else disabled/>包邮</view>
  234 + <view class="w50">
  235 + <block wx:if="{{item.intValue}}">
  236 + <radio disabled/>积分 <text class="red">{{item.intValue}}</text>
  237 + </block>
  238 + <block wx:else>
  239 + <radio disabled/>积分
  240 + </block>
  241 + </view>
  242 + </view>
  243 + <view class="pdb20"><radio wx:if="{{item.couponId}}" checked="true" disabled/> <radio wx:else disabled/>优惠券</view>
  244 + <view class="pdb20"><radio wx:if="{{item.gift_id}}" checked="true" disabled/> <radio wx:else disabled/>赠品</view>
  245 + <view><radio wx:if="{{item.lb_id}}" checked="true" disabled/> <radio wx:else disabled/>礼包</view>
  246 + </view>
  247 + </block>
  248 +
291 249 </view>
292 250 </view>
293 251 </block>
... ... @@ -297,3 +255,7 @@
297 255 </view>
298 256 </view>
299 257  
  258 +<!--二维码显示页面-->
  259 +<canvas canvas-id='share' style='width:750rpx;height:1217rpx;' wx:if='{{!canvasHidden}}'></canvas>
  260 +<!-- 分享控件,底部弹出 -->
  261 +<share_button id="share_button" bind:cancel="cancel" bind:share_img="saveImageToPhotosAlbum" wx:if="{{!share_hidden}}"></share_button>
... ...
packageA/pages/activity_share/activity_share.wxss
... ... @@ -111,10 +111,7 @@ page {
111 111 justify-content: center;
112 112 }
113 113 .img-container:after {
114   - font-family: iconfont;
115   - content: '\e8c1';
116   - color: #bbb;
117   - font-size: 80rpx;
  114 +
118 115 }
119 116 .details {
120 117 flex: 1;
... ...
packageA/pages/activity_share/g_filter.wxs 0 → 100644
  1 +var g_filters = {
  2 + //-- 判断是不是有等级价 --
  3 + is_has_rank:function(rank_switch,item){
  4 + if(!rank_switch) return false;
  5 + if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true}
  6 + return false;
  7 + },
  8 +
  9 + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 --
  10 + get_card_price:function(goods,all_card,type){
  11 + var price1=parseFloat(goods['cardprice1']);
  12 + var price2=parseFloat(goods['cardprice2']);
  13 + var price3=parseFloat(goods['cardprice3']);
  14 + if(!all_card){
  15 + if(type==0) return 0;
  16 + return "";
  17 + }
  18 +
  19 + var arr=[];
  20 + var min_price= 0;
  21 + var min_name="";
  22 +
  23 + var min_price=null;
  24 + var min_name=null;
  25 + //---设置对应的价格名字----
  26 + for(var i=0;i<3;i++) {
  27 + var vl=all_card[i];
  28 + if(!vl) continue;
  29 + if(vl['CorrPrice']=="Price1" && price1>0)
  30 + {
  31 + if(min_price==null) {
  32 + min_price=price1;min_name=vl['CardName'];
  33 + }
  34 + else if(price1<min_price) {
  35 + min_price=price1;min_name=vl['CardName'];
  36 + }
  37 + }
  38 + if(vl['CorrPrice']=="Price2" && price2>0)
  39 + {
  40 + if(min_price==null) {
  41 + min_price=price2;min_name=vl['CardName'];
  42 + }
  43 + else if(price2<min_price) {
  44 + min_price=price2;min_name=vl['CardName'];
  45 + }
  46 + }
  47 +
  48 + if(vl['CorrPrice']=="Price3" && price3>0)
  49 + {
  50 + if(min_price==null) {
  51 + min_price=price3;min_name=vl['CardName'];
  52 + }
  53 + else if(price3<min_price) {
  54 + min_price=price3;min_name=vl['CardName'];
  55 + }
  56 + }
  57 +
  58 + }
  59 + if(min_price==null){
  60 + if(type==0) return 0;
  61 + return "";
  62 + }
  63 +
  64 + //if(type==0) return arr.length;
  65 + //--进行排序,升序---
  66 + /*---
  67 + arr.sort(function(a,b){
  68 + if (a.price < b.price) {
  69 + return -1;
  70 + } else if (a.fee == b.fee) {
  71 + return 0;
  72 + } else {
  73 + return 1;
  74 + }
  75 + })--*/
  76 + //-- 获取最下价钱,和相应的卡的名称 --
  77 + if(type==0) return min_price.toFixed(2);
  78 + if(min_name.length>4) min_name=min_name.substring(0, 8);
  79 + return min_name;
  80 + },
  81 +
  82 + toFix: function (val, count) {
  83 + val = parseFloat(val);
  84 + return val.toFixed(count)
  85 + },
  86 + format_time: function (ts, isFull) {
  87 + // 如果数值位数为1,则补0
  88 + function appendZero(obj) {
  89 + if (obj < 10) {
  90 + return "0" + "" + obj;
  91 + } else {
  92 + return obj;
  93 + }
  94 + };
  95 +
  96 + if (ts == null || ts == undefined || ts == '') return "";
  97 + var d = getDate(ts * 1000)
  98 + var fm = [d.getFullYear(), d.getMonth() + 1, d.getDate()].join('-');
  99 + var md = (d.getMonth() + 1) + '月' + d.getDate() + '日';
  100 + if (isFull == 1)
  101 + fm = fm + ' ' + [d.getHours(), d.getMinutes(), d.getSeconds()].join(':');
  102 + if (isFull == 2) {
  103 + fm = md + ' ' + [appendZero(d.getHours()), appendZero(d.getMinutes())].join(':');
  104 + }
  105 + return fm;
  106 + },
  107 +
  108 +}
  109 +module.exports = {
  110 + is_has_rank:g_filters.is_has_rank,
  111 + get_card_price:g_filters.get_card_price,
  112 + toFix:g_filters.toFix,
  113 + format_time:g_filters.format_time,
  114 +}
0 115 \ No newline at end of file
... ...
packageA/pages/goods_share/g_filter.wxs 0 → 100644
  1 +var g_filters = {
  2 + //-- 判断是不是有等级价 --
  3 + is_has_rank:function(rank_switch,item){
  4 + if(!rank_switch) return false;
  5 + if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true}
  6 + return false;
  7 + },
  8 +
  9 + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 --
  10 + get_card_price:function(goods,all_card,type){
  11 + var price1=parseFloat(goods['cardprice1']);
  12 + var price2=parseFloat(goods['cardprice2']);
  13 + var price3=parseFloat(goods['cardprice3']);
  14 + if(!all_card){
  15 + if(type==0) return 0;
  16 + return "";
  17 + }
  18 +
  19 + var arr=[];
  20 + var min_price= 0;
  21 + var min_name="";
  22 +
  23 + var min_price=null;
  24 + var min_name=null;
  25 + //---设置对应的价格名字----
  26 + for(var i=0;i<3;i++) {
  27 + var vl=all_card[i];
  28 + if(!vl) continue;
  29 + if(vl['CorrPrice']=="Price1" && price1>0)
  30 + {
  31 + if(min_price==null) {
  32 + min_price=price1;min_name=vl['CardName'];
  33 + }
  34 + else if(price1<min_price) {
  35 + min_price=price1;min_name=vl['CardName'];
  36 + }
  37 + }
  38 + if(vl['CorrPrice']=="Price2" && price2>0)
  39 + {
  40 + if(min_price==null) {
  41 + min_price=price2;min_name=vl['CardName'];
  42 + }
  43 + else if(price2<min_price) {
  44 + min_price=price2;min_name=vl['CardName'];
  45 + }
  46 + }
  47 +
  48 + if(vl['CorrPrice']=="Price3" && price3>0)
  49 + {
  50 + if(min_price==null) {
  51 + min_price=price3;min_name=vl['CardName'];
  52 + }
  53 + else if(price3<min_price) {
  54 + min_price=price3;min_name=vl['CardName'];
  55 + }
  56 + }
  57 +
  58 + }
  59 + if(min_price==null){
  60 + if(type==0) return 0;
  61 + return "";
  62 + }
  63 +
  64 + //if(type==0) return arr.length;
  65 + //--进行排序,升序---
  66 + /*---
  67 + arr.sort(function(a,b){
  68 + if (a.price < b.price) {
  69 + return -1;
  70 + } else if (a.fee == b.fee) {
  71 + return 0;
  72 + } else {
  73 + return 1;
  74 + }
  75 + })--*/
  76 + //-- 获取最下价钱,和相应的卡的名称 --
  77 + if(type==0) return min_price.toFixed(2);
  78 + if(min_name.length>4) min_name=min_name.substring(0, 8);
  79 + return min_name;
  80 + },
  81 +}
  82 +module.exports = {
  83 + is_has_rank:g_filters.is_has_rank,
  84 + get_card_price:g_filters.get_card_price,
  85 +}
0 86 \ No newline at end of file
... ...
packageA/pages/goods_share/goods_share.js
1 1 // packageA//pages/goods_share/goods_share.js
  2 +var app=getApp(),oo = app.globalData.setting,os=oo,ut = require("../../../utils/util.js");
2 3 Page({
3   -
4 4 /**
5 5 * 页面的初始数据
6 6 */
... ... @@ -9,62 +9,145 @@ Page({
9 9 active1: false,
10 10 // 控制佣金
11 11 active2: false,
  12 + url:oo.imghost,
  13 + orderField:'sales_sum',
  14 + orderType:'desc',
  15 + list:[],
  16 + is_load:0, //是否正在加载
  17 + is_no_data:0, //没有数据
  18 + is_no_more:0, //没有更多数据
  19 + key_str:'',
  20 + pattern:0, //分成的方式
  21 + currentPage:1, //当前的页码
  22 +
  23 + canvasHidden: 1, //-- 隐藏画布 --
  24 + dis_switch:0, //-- 分销开关 --
  25 + pattern:0, //-- 分成的方式 --
  26 + share_hidden:1, //-- 分享的按钮隐藏 --
  27 + share_good:null //--- 要分享的商品 ---
12 28 },
13   -
14 29 /**
15 30 * 生命周期函数--监听页面加载
16 31 */
17 32 onLoad: function (options) {
18   -
  33 + var th=this;
  34 + //接受有没有导购的参数
  35 + var first_leader=options.first_leader;
  36 + if(first_leader){
  37 + //-- user_id代过来免登陆 --
  38 + getApp().globalData.user_id=first_leader;
  39 + getApp().getUserFir();
  40 + }
  41 + this.requestGoodsList();
  42 +
  43 + //-- 自定义海报 --
  44 + getApp().request.promiseGet("/api/weshop/goods/poster/page",{
  45 + data:{store_id:os.stoid, type:1, is_use:1 }
  46 + }).then(res=>{
  47 + if(res.data.code==0){
  48 +
  49 + var poster_data=res.data.data.pageData[0];
  50 + var json_str=poster_data.jsonStr;
  51 +
  52 + if(json_str){
  53 + var json_data=JSON.parse(json_str);
  54 + if(json_data.bg_img){
  55 +
  56 + //-- 把图片那到本地 --
  57 + wx.getImageInfo({
  58 + src:json_data.bg_img,
  59 + success: function(res) {
  60 + var path= res.path;
  61 + th.setData({share_b_img:path})
  62 + },
  63 + fail: function(res) {}
  64 + });
  65 + }
  66 +
  67 + th.setData({poster:json_data})
  68 +
  69 + }
  70 + }
  71 + })
  72 +
  73 + //获取分销的配置
  74 + getApp().request.promiseGet("/api/weshop/storeDistribut/get/"+oo.stoid,{}).then(res=>{
  75 + if(res.data.code==0){
  76 + th.setData({dis_switch:res.data.data.switch,pattern:res.data.data.pattern});
  77 + }
  78 + })
  79 + //获取用户设备信息,屏幕宽度
  80 + wx.getSystemInfo({
  81 + success: res => {
  82 + th.setData({
  83 + screenWidth: res.screenWidth
  84 + })
  85 + }
  86 + });
  87 +
19 88 },
20 89  
21   - /**
22   - * 生命周期函数--监听页面初次渲染完成
23   - */
24   - onReady: function () {
25   -
26   - },
27   -
28   - /**
29   - * 生命周期函数--监听页面显示
30   - */
  90 + /*** 生命周期函数--监听页面显示***/
31 91 onShow: function () {
32   -
  92 + var th=this;
  93 + getApp().getConfig2(function(rs){
  94 + //计算等级价相关
  95 + var swithc_list=rs.switch_list;
  96 + var sw_arr=JSON.parse(swithc_list);
  97 + //---如果后台又开等级卡的开关---
  98 + if(sw_arr.rank_switch && sw_arr.rank_switch=="2"){
  99 + th.setData({rank_switch:true});
  100 + var user=getApp().globalData.userInfo;
  101 + var ti=setInterval(function(){
  102 + if(!user) return false;
  103 + clearInterval(ti);
  104 + //---回调卡的列表---
  105 + th.getPlusCardType(function(ob){
  106 + th.setData({card_list:ob.card_list});
  107 + if(user.card_field ){
  108 + var str = user['card_expiredate'].replace(/-/g, '/');
  109 + var end = new Date(str);
  110 + end = Date.parse(end) / 1000;
  111 + var now = ut.gettimestamp();
  112 + //--- 判断是等级会员,且在有效期范围内 ---
  113 + if(user.card_field && now<end){
  114 + var card_name=ob.name_map.get(user.card_field);
  115 + // if(card_name.length>4) card_name=card_name.substring(0,4);
  116 + th.setData({card_field:user.card_field,card_name:card_name,card_list:ob.card_list});
  117 + }
  118 + }
  119 + })
  120 + },500)
  121 + }
  122 + });
33 123 },
34 124  
35 125 /**
36 126 * 生命周期函数--监听页面隐藏
37 127 */
38   - onHide: function () {
39   -
40   - },
41   -
42   - /**
43   - * 生命周期函数--监听页面卸载
44   - */
45   - onUnload: function () {
46   -
47   - },
48   -
49   - /**
50   - * 页面相关事件处理函数--监听用户下拉动作
51   - */
52   - // onPullDownRefresh: function () {
53   -
54   - // },
55   -
56   - /**
57   - * 页面上拉触底事件的处理函数
58   - */
59   - onReachBottom: function () {
60   -
61   - },
62   -
63   - /**
  128 + onHide: function () {},
  129 + /**e
64 130 * 用户点击右上角分享
65 131 */
66 132 onShareAppMessage: function () {
67   -
  133 + var th = this;
  134 + var item=this.data.share_good;
  135 + var price = item.shop_price;
  136 + var title= item.goods_name;
  137 + var img=this.data.url+item.original_img;
  138 +
  139 + var url="/pages/goods/goodsInfo/goodsInfo?goods_id=" + th.data.gid;
  140 + if(getApp().globalData.user_id){
  141 + url+="&first_leader="+getApp().globalData.user_id;
  142 + }
  143 + var ob={
  144 + title: price + "元 " +title,
  145 + path:url,
  146 + imageUrl: img,
  147 + };
  148 + th.setData({share_hidden:1});
  149 + return ob;
  150 +
68 151 },
69 152  
70 153 // 点击价格排序
... ... @@ -73,11 +156,22 @@ Page({
73 156 this.setData({
74 157 active2: !this.data.active2
75 158 });
76   - };
77   - this.setData({
78   - active1: !this.data.active1
79   - });
80   -
  159 + };
  160 + if(this.data.orderField!="shop_price"){
  161 + this.setData({
  162 + active1: 1,orderField:'shop_price',orderType:'asc',is_no_data:0,is_no_more:0,list:[],
  163 + });
  164 + }else{
  165 +
  166 + var ty=this.data.orderType=='asc'?'desc':'asc';
  167 + this.setData({
  168 + orderType:ty,is_no_data:0,is_no_more:0,list:[],
  169 + });
  170 + }
  171 + this.data.is_load=0;
  172 + this.data.currentPage=1;
  173 + this.requestGoodsList();
  174 +
81 175 },
82 176 // 点击佣金排序
83 177 sort2() {
... ... @@ -85,9 +179,612 @@ Page({
85 179 this.setData({
86 180 active1: !this.data.active1
87 181 });
88   - };
89   - this.setData({
90   - active2: !this.data.active2
91   - });
  182 + };
  183 + if(this.data.orderField!="commission"){
  184 +
  185 + if(this.data.pattern==0){
  186 + this.setData({
  187 + active2: 1,orderField:'commission',orderType:'asc',is_no_data:0,is_no_more:0,list:[],
  188 + });
  189 + }else{
  190 + this.setData({
  191 + active2: 1,orderField:'(fir_rate+sec_rate+thi_rate)',orderType:'asc',is_no_data:0,is_no_more:0,list:[],
  192 + });
  193 + }
  194 +
  195 +
  196 + }else{
  197 + this.setData({
  198 + orderType: (this.data.orderType=='asc'?'desc':'asc'),is_no_data:0,is_no_more:0,list:[],
  199 + });
  200 + }
  201 + this.data.is_load=0;
  202 + this.data.currentPage=1;
  203 + this.requestGoodsList();
92 204 },
  205 +
  206 + //-- ----销量----
  207 + sale_sort(){
  208 + if(this.data.orderField!="sales_sum"){
  209 + this.setData({
  210 + active1: 0,active2:0,orderType:'desc',is_no_data:0,is_no_more:0,orderField:'sales_sum',list:[],
  211 + });
  212 + this.data.is_load=0;
  213 + this.data.currentPage=1;
  214 + this.requestGoodsList();
  215 + }
  216 + },
  217 +
  218 + //-- ---最新---
  219 + new_sort:function(){
  220 + if(this.data.orderField!="is_new"){
  221 + this.setData({
  222 + active1: 0,active2:0,orderType:'desc',is_no_data:0,is_no_more:0,orderField:'is_new',list:[],
  223 + });
  224 + this.data.is_load=0;
  225 + this.data.currentPage=1;
  226 + this.requestGoodsList();
  227 + }
  228 + },
  229 +
  230 + requestGoodsList:function(){
  231 + var th=this;
  232 + if(th.data.is_load) return false; //-- 正在加载
  233 + if(th.data.is_no_data) return false; //-- 没有数据
  234 + if(th.data.is_no_more) return false; //-- 没有更多
  235 + th.data.is_load=1;
  236 +
  237 + var url="/api/weshop/goods/page";
  238 + var req_data={
  239 + page:this.data.currentPage,
  240 + is_mainshow:1,
  241 + isonsale:1,
  242 + store_id:oo.stoid,
  243 + orderField:this.data.orderField,
  244 + orderType:this.data.orderType,
  245 + }
  246 + if(this.data.key_str && this.data.key_str.trim()){
  247 + var str=this.data.key_str.trim();
  248 + req_data.key_str=str;
  249 + }
  250 + //-- ---调用接口----
  251 + app.request.promiseGet(url,{data:req_data,isShowLoading:1}).then(res=>{
  252 + th.data.is_load=0;
  253 + if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){
  254 + th.data.currentPage++;
  255 + var data=res.data.data.pageData;
  256 + if(res.data.data.page*10>res.data.data.total){th.setData({is_no_more:1});}
  257 + var list=th.data.list;
  258 + list=list.concat(data);
  259 + th.setData({list:list});
  260 + }else{
  261 + if(th.data.currentPage==1){
  262 + th.setData({is_no_data:1});
  263 + }
  264 + }
  265 + })
  266 + },
  267 +
  268 +
  269 + //--- 获取卡类列表 ---
  270 + getPlusCardType: function (func) {
  271 + var storid = oo.stoid;
  272 + var th = this;
  273 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
  274 + var plusCard = res.data.data;
  275 + var arr = [1219, 2089, 3031];
  276 + var new_arr = new Array();
  277 + var card_name_map=new Map();
  278 + var user = getApp().globalData.userInfo;
  279 + for (var i = 0; i < plusCard.length; i++) {
  280 + if ((user.card_field==null || user.card_field=="") && (plusCard[i].IsStopBuy==true)) {
  281 + continue;
  282 + }
  283 + var name="card"+plusCard[i].CorrPrice.toLowerCase();
  284 + card_name_map.set(name,plusCard[i].CardName);
  285 + new_arr.push(plusCard[i]);
  286 + }
  287 +
  288 + var ob={"card_list":new_arr,"name_map":card_name_map};
  289 + func(ob);
  290 + })
  291 + },
  292 +
  293 +
  294 + //---图片失败,默认图片---
  295 + bind_bnerr2: function (e) {
  296 + var _errImg = e.target.dataset.errorimg;
  297 + var _errObj = {};
  298 + _errObj[_errImg] ="/miniapp/images/default_g_img.gif";
  299 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  300 + },
  301 + //-- ---更多加载----
  302 + refresh:function(){
  303 + this.requestGoodsList();
  304 + },
  305 +
  306 + //--定义的保存图片方法,分享团---
  307 + saveImageToPhotosAlbum: function() {
  308 + //--先判断会员状态--
  309 + var user_info = getApp().globalData.userInfo;
  310 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  311 + //getApp().my_warnning("请先登录",0,this);
  312 + wx.navigateTo({ url: '/pages/togoin/togoin', })
  313 + return false;
  314 + }
  315 + //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团
  316 + var type = 0;
  317 + wx.showLoading({
  318 + title: '生成中...',
  319 + })
  320 + var that = this, th = that;
  321 + //设置画板显示,才能开始绘图
  322 + that.setData({
  323 + canvasHidden: false,share_hidden:1
  324 + })
  325 +
  326 + var app = getApp();
  327 + var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
  328 + var scene = th.data.gid+"";
  329 + var user_id=getApp().globalData.user_id?getApp().globalData.user_id:0;
  330 + if(user_id>0){
  331 + scene+="_"+user_id;
  332 + }
  333 +
  334 + ///二微码
  335 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
  336 + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo";
  337 +
  338 + //读取文件成功则OK--
  339 + wx.getImageInfo({
  340 + src: path3,
  341 + success: function(res) {
  342 + //回调写法
  343 + th.get_head_temp(th.get_goods_temp, function() {
  344 + var vpath = res.path;
  345 + var context = wx.createCanvasContext('share');
  346 + //先画背景
  347 + var pg_path = "../../../images/share/share_bg.png";
  348 +
  349 + //-- 如果有自定义海报的时候,判断背景的图片 --
  350 + if(th.data.share_b_img){
  351 + pg_path=th.data.share_b_img;
  352 + }
  353 + context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
  354 +
  355 + //-- 是自定义海报的情况下 --
  356 + if(th.data.poster && parseInt(th.data.poster.style)==2){
  357 + //在线上分享人的情况下
  358 + if(parseInt(th.data.poster.show_headpic)){
  359 + //获取坐标
  360 + var x=parseFloat(th.data.poster.head_x)*2;
  361 + var y=parseFloat(th.data.poster.head_y)*2;
  362 + var x1=(x+90) *unit;
  363 + var y1=(y+50) *unit;
  364 + //--昵称---
  365 + context.setFontSize(24 * unit)
  366 + context.setFillStyle("black")
  367 + context.fillText(app.globalData.userInfo.nickname, x1, y1);
  368 + var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit;
  369 + //强烈推荐 改许程
  370 + var tj_path = "../../../images/share/q_tj.png";
  371 + context.drawImage(tj_path, x1 + width, y1-22*unit, 85 * unit, 30 * unit);
  372 + context.setFontSize(16 * unit)
  373 + context.setLineJoin('round'); //交点设置成圆角
  374 + context.setFillStyle("white")
  375 + context.fillText('强烈推荐', x1 + width+8*unit, y1-1*unit);
  376 + }
  377 + }else{
  378 + //--昵称---
  379 + context.setFontSize(24 * unit)
  380 + context.setFillStyle("black")
  381 + context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit);
  382 + var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit;
  383 + //强烈推荐 改许程
  384 + var tj_path = "../../../images/share/q_tj.png";
  385 + context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit);
  386 + context.setFontSize(16 * unit)
  387 + context.setLineJoin('round'); //交点设置成圆角
  388 + context.setFillStyle("white")
  389 + context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 76 * unit);
  390 + }
  391 +
  392 +
  393 + //---产品名称---
  394 + //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
  395 + context.setFillStyle("black");
  396 + context.setFontSize(21.3 * unit)
  397 + th.draw_Text(context, th.data.share_good.goods_name,
  398 + 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit);
  399 + //------产品的价格-------
  400 + context.setFontSize(23 * unit)
  401 + context.setFillStyle("red")
  402 + context.fillText("¥", 416 * unit, 185 * unit);
  403 + context.setFontSize(31 * unit)
  404 + var pri0 = th.data.share_good.shop_price;
  405 + if (th.data.prom_act)
  406 + pri0 = th.data.prom_act.price;
  407 +
  408 + pri0 = parseFloat(pri0).toFixed(2);
  409 + context.fillText(pri0, 438 * unit, 185 * unit);
  410 + //---市场价划掉---
  411 + context.setFillStyle("gray")
  412 + context.setFontSize(22 * unit)
  413 + context.fillText("¥" + th.data.share_good.market_price, 426 * unit, 213 * unit);
  414 + context.setStrokeStyle('gray')
  415 + context.setLineWidth(1 * unit)
  416 + context.moveTo(426 * unit, 206 * unit)
  417 + context.lineTo(510 * unit, 206 * unit)
  418 + context.stroke();
  419 + //---中间大图---
  420 + context.drawImage(th.data.share_goods_img, 68 * unit, 242 * unit, 410 * unit, 410 * unit);
  421 + //-------大图后面就不一样了-----------
  422 + switch (type) {
  423 + case 0: //普通商品的展示
  424 + //中间的几个字
  425 + if(th.data.poster && parseInt(th.data.poster.style)==2 ){
  426 + if(parseInt(th.data.poster.show_quality)){
  427 + var g_path = "../../../images/share/s_gou.png";
  428 + context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
  429 + context.setFillStyle("red")
  430 + context.setFontSize(18 * unit)
  431 + context.fillText("正品保证", 84 * unit, 690 * unit);
  432 +
  433 + context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
  434 + context.setFillStyle("red")
  435 + context.setFontSize(18 * unit)
  436 + context.fillText("纯实体店", 246 * unit, 690 * unit);
  437 +
  438 + context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
  439 + context.setFillStyle("red")
  440 + context.setFontSize(18 * unit)
  441 + context.fillText("官方验证", 420 * unit, 690 * unit);
  442 + }
  443 +
  444 + }else{
  445 + var g_path = "../../../images/share/s_gou.png";
  446 + context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
  447 + context.setFillStyle("red")
  448 + context.setFontSize(18 * unit)
  449 + context.fillText("正品保证", 84 * unit, 690 * unit);
  450 +
  451 + context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
  452 + context.setFillStyle("red")
  453 + context.setFontSize(18 * unit)
  454 + context.fillText("纯实体店", 246 * unit, 690 * unit);
  455 +
  456 + context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
  457 + context.setFillStyle("red")
  458 + context.setFontSize(18 * unit)
  459 + context.fillText("官方验证", 420 * unit, 690 * unit);
  460 + }
  461 +
  462 + //---画线---
  463 + context.setLineWidth(1 * unit)
  464 + context.moveTo(32 * unit, 710 * unit)
  465 + context.lineTo(520 * unit, 710 * unit)
  466 + context.stroke();
  467 + //---文字---
  468 + context.setFillStyle("black")
  469 + context.setFontSize(22 * unit)
  470 + // 原来start --->
  471 + context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit);
  472 + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 826 * unit);
  473 +
  474 + //---二维吗图---
  475 + //-- 自定义海报 --
  476 + if(th.data.poster){
  477 + var erm_x= parseFloat(th.data.poster.ewm_x)*2;
  478 + var erm_y= parseFloat(th.data.poster.ewm_y)*2;
  479 + context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
  480 + }else{
  481 + //---二维吗图---
  482 + context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
  483 + }
  484 +
  485 + break;
  486 + case 1: //秒杀商品的展示
  487 + //---画线---
  488 + context.setLineWidth(1 * unit)
  489 + context.moveTo(32 * unit, 670 * unit)
  490 + context.lineTo(520 * unit, 670 * unit)
  491 + context.stroke();
  492 +
  493 + //画秒杀的图片
  494 + var miaos_path = '../../../images/share/miao_share.png';
  495 + context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit);
  496 +
  497 + //---文字---
  498 + context.setFontSize(22 * unit)
  499 + context.setFillStyle("black")
  500 + context.fillText("特惠好物,限时秒杀", 40 * unit, 806 * unit);
  501 + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit);
  502 + //---二维吗图---
  503 + //-- 自定义海报 --
  504 + if(th.data.poster){
  505 + var erm_x= parseFloat(th.data.poster.ewm_x)*2;
  506 + var erm_y= parseFloat(th.data.poster.ewm_y)*2;
  507 + context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
  508 + }else{
  509 + //---二维吗图---
  510 + context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
  511 + }
  512 +
  513 +
  514 + break;
  515 +
  516 + case 2: //会员团和商家团的展示
  517 + //---画线---
  518 + context.setLineWidth(1 * unit)
  519 + context.moveTo(32 * unit, 670 * unit)
  520 + context.lineTo(520 * unit, 670 * unit)
  521 + context.stroke();
  522 + //---文字---
  523 + context.setFontSize(22 * unit)
  524 + context.font = 'normal bold';
  525 + context.setFillStyle("black")
  526 + context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit);
  527 +
  528 + //绘制成团图片
  529 + var ct_img = "../../../images/share/ct_num.png";
  530 + context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit);
  531 + var ct_num = th.data.prom_act.ct_num;
  532 + context.setFontSize(14 * unit)
  533 + context.font = 'normal';
  534 + context.setFillStyle("red")
  535 + if (ct_num < 10) {
  536 + context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit);
  537 + } else {
  538 + context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit);
  539 + }
  540 + context.setFontSize(22 * unit)
  541 + context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit);
  542 + context.setFillStyle("gray")
  543 + context.fillText("快来和我一起拼团吧!", 40 * unit, 826 * unit);
  544 + context.setFillStyle("black")
  545 + context.font = 'normal bold 18px sans-serif';
  546 + context.setFontSize(21.3 * unit)
  547 + context.fillText("长按识别二维码,立即参团", 40 * unit, 856 * unit);
  548 + //---二维吗图---
  549 + //-- 自定义海报 --
  550 + if(th.data.poster){
  551 + var erm_x= parseFloat(th.data.poster.ewm_x)*2;
  552 + var erm_y= parseFloat(th.data.poster.ewm_y)*2;
  553 + context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
  554 + }else{
  555 + //---二维吗图---
  556 + context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
  557 + }
  558 + break
  559 + case 3: //阶梯团的展示
  560 + //---画线---
  561 + context.setLineWidth(1 * unit)
  562 + context.moveTo(32 * unit, 670 * unit)
  563 + context.lineTo(520 * unit, 670 * unit)
  564 + context.stroke();
  565 + //---文字---
  566 + context.setFontSize(22 * unit)
  567 + context.font = 'normal bold';
  568 + context.setFillStyle("black")
  569 + context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit);
  570 + //---绘制中间阶梯的价格---
  571 + var list = th.data.prom_act.ct_rylist;
  572 + for (var i = 0; i < list.length; i++) {
  573 + var item = list[i];
  574 + var wi = i * 90 * unit;
  575 + context.font = 'normal';
  576 + context.setFontSize(16 * unit)
  577 + context.setFillStyle("red")
  578 + context.fillText("¥", 40 * unit + wi, 756 * unit);
  579 + context.setFontSize(22 * unit)
  580 + var pri = parseFloat(item.price).toFixed(2);
  581 + context.fillText(pri, 56 * unit + wi, 756 * unit);
  582 + context.setFillStyle("gray")
  583 + context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit);
  584 + }
  585 + //----------------下面部分----------------
  586 + context.setFillStyle("gray")
  587 + context.fillText("快来和我一起拼团吧!", 40 * unit, 830 * unit);
  588 + context.setFillStyle("black")
  589 + context.font = 'normal bold 18px sans-serif';
  590 + context.setFontSize(22 * unit)
  591 + context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit);
  592 +
  593 + //-- 自定义海报 --
  594 + if(th.data.poster){
  595 + var erm_x= parseFloat(th.data.poster.ewm_x)*2;
  596 + var erm_y= parseFloat(th.data.poster.ewm_y)*2;
  597 + context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
  598 + }else{
  599 + //---二维吗图---
  600 + context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
  601 + }
  602 + break
  603 + }
  604 +
  605 +
  606 + //--- 如果是自定义海报的时候 ---
  607 + if(th.data.poster && parseInt(th.data.poster.style)==2){
  608 + //如果显示会员信息的话
  609 + if(parseInt(th.data.poster.show_headpic)){
  610 + //获取坐标
  611 + var x= parseFloat(th.data.poster.head_x)*2;
  612 + var y=parseFloat(th.data.poster.head_y)*2;
  613 + //---绘制圆形要放在最后----
  614 + context.save();
  615 + context.beginPath();
  616 + var h_x = x* unit;
  617 + var h_y = y * unit;
  618 + var h_r = 40 * unit;
  619 + var cx = h_x + h_r;
  620 + var cy = h_y + h_r;
  621 + context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
  622 + context.closePath();
  623 + context.fill();
  624 + context.clip();
  625 + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
  626 + context.restore();
  627 + }
  628 +
  629 + }else{
  630 + //---绘制圆形要放在最后----
  631 + context.save();
  632 + context.beginPath();
  633 + var h_x = 60 * unit;
  634 + var h_y = 24 * unit;
  635 + var h_r = 40 * unit;
  636 + var cx = h_x + h_r;
  637 + var cy = h_y + h_r;
  638 + context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
  639 + context.closePath();
  640 + context.fill();
  641 + context.clip();
  642 + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
  643 + context.restore();
  644 + }
  645 +
  646 +
  647 + //把画板内容绘制成图片,并回调 画板图片路径
  648 + context.draw(false, function() {
  649 + setTimeout(function() {
  650 + wx.canvasToTempFilePath({
  651 + x: 0,
  652 + y: 0,
  653 + width: 750,
  654 + height: 1217,
  655 + destWidth: 1.2 * 750 * 750 / that.data.screenWidth,
  656 + destHeight: 1.2 * 1217 * 750 / that.data.screenWidth,
  657 + canvasId: 'share',
  658 + success: function(res) {
  659 + that.setData({
  660 + shareImgPath: res.tempFilePath,
  661 + canvasHidden: true
  662 + })
  663 + if (!res.tempFilePath) {
  664 + wx.showModal({
  665 + title: '提示',
  666 + content: '图片绘制中,请稍后重试',
  667 + showCancel: false
  668 + })
  669 + return false;
  670 + }
  671 + wx.previewImage({
  672 + //将图片预览出来
  673 + urls: [that.data.shareImgPath]
  674 + });
  675 + wx.hideLoading();
  676 + }
  677 + })
  678 + }, 500)
  679 +
  680 + });
  681 + });
  682 + }
  683 + });
  684 +
  685 + },
  686 +
  687 + //点击分享商品
  688 + share_good:function(e){
  689 + var index=e.currentTarget.dataset.index;
  690 + var item=this.data.list[index];
  691 + this.setData({share_hidden:0,share_good:item});
  692 + },
  693 +
  694 + cancel:function(){
  695 + this.setData({share_hidden:1});
  696 + },
  697 +
  698 + //--获取头像的本地缓存,回调写法--
  699 + get_head_temp: function(tt, func) {
  700 + var ee = this;
  701 + if (ee.data.share_head) {
  702 + tt(func);
  703 + return false;
  704 + }
  705 + //---获取分享图片的本地地址,头像和商品图片----
  706 + var path2 = getApp().globalData.userInfo.head_pic;
  707 + if (path2 == "") {
  708 + ee.data.share_head = "../../../images/share/hui_hear_pic.png";
  709 + tt(func);
  710 + } else {
  711 + path2 = path2.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
  712 + path2 = path2.replace("https://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
  713 + wx.getImageInfo({
  714 + src: path2,
  715 + success: function(res) {
  716 + //res.path是网络图片的本地地址
  717 + ee.data.share_head = res.path;
  718 + tt(func);
  719 + },
  720 + fail: function(res) {
  721 + ee.data.share_head = "../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的
  722 + tt(func);
  723 + }
  724 + });
  725 + }
  726 + },
  727 + //--获取商品图片的本地缓存,回调写法--
  728 + get_goods_temp: function(tt) {
  729 + var ee = this;
  730 + //获取商品是分享图信息
  731 + wx.getImageInfo({
  732 + src: ee.data.url+ee.data.share_good.original_img,
  733 + success: function(res) {
  734 + //res.path是网络图片的本地地址
  735 + ee.data.share_goods_img = res.path;
  736 + tt();
  737 + },
  738 + fail: function(res) {
  739 + ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
  740 + tt();
  741 + }
  742 + });
  743 + },
  744 +
  745 + //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
  746 + draw_Text: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) {
  747 + var lineWidth = 0;
  748 + var lastSubStrIndex = 0; //每次开始截取的字符串的索引
  749 + var han = 0;
  750 + for (let i = 0; i < str.length; i++) {
  751 + if (han == 2) return;
  752 + //lineWidth += ctx.measureText(str[i]).width;
  753 + lineWidth += ut.measureText(str[i], 21.3 * unit);
  754 + if (lineWidth > canvasWidth) {
  755 + han++;
  756 +
  757 + if (han == 2)
  758 + ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分
  759 + else
  760 + ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight);
  761 +
  762 + initHeight += 22; //22为字体的高度
  763 + lineWidth = 0;
  764 + lastSubStrIndex = i;
  765 + titleHeight += 20;
  766 + }
  767 + if (i == str.length - 1) { //绘制剩余部分
  768 + ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight);
  769 + }
  770 + }
  771 + },
  772 +
  773 + //-------搜索的相关功能------
  774 + set_search_value:function(e){
  775 + var key_str=e.detail.value;
  776 + if(key_str) key_str=key_str.trim();
  777 + this.setData({key_str:key_str});
  778 +
  779 + },
  780 + search_data:function(){
  781 + this.setData({
  782 + is_no_data:0,is_no_more:0,list:[],
  783 + });
  784 + this.data.is_load=0;
  785 + this.data.currentPage=1;
  786 + this.requestGoodsList();
  787 + }
  788 +
  789 +
93 790 })
94 791 \ No newline at end of file
... ...
packageA/pages/goods_share/goods_share.json
1 1 {
  2 + "navigationBarTitleText": "商品分享",
2 3 "usingComponents": {
3   - "nodata": "/components/nodata/nodata"
  4 + "nodata": "/components/nodata/nodata",
  5 + "share_button": "/components/share/share"
4 6 },
5 7 "enablePullDownRefresh": false
6 8 }
7 9 \ No newline at end of file
... ...
packageA/pages/goods_share/goods_share.wxml
  1 +<wxs module="g_filter" src="g_filter.wxs"></wxs>
1 2 <view class="container">
2 3 <!-- 搜索框 -->
3 4 <view class="search-container">
4   - <view class="input-container"><input class="search" type="text" placeholder="请输入您想查找的商品信息"/></view>
5   - <view class="btn-search">搜索</view>
  5 + <view class="input-container"><input bindinput="set_search_value" class="search" type="text" placeholder="请输入您想查找的商品信息"/></view>
  6 + <view bindtap="search_data" class="btn-search">搜索</view>
6 7 </view>
7 8 <!-- 列表 -->
8 9 <view class="list-container">
9 10 <!-- 标题 -->
10 11 <view class="title">
11   - <view class="title-item">销量</view>
12   - <view class="title-item" bindtap="sort1">价格<text class="iconfont {{active1?'icon-shang':'icon-xia'}}"></text></view>
13   - <view class="title-item" bindtap="sort2">佣金<text class="iconfont {{active2?'icon-shang':'icon-xia'}}"></text></view>
14   - <view class="title-item">最新</view>
  12 + <view class="title-item" bindtap="sale_sort">销量</view>
  13 + <view class="title-item" bindtap="sort1">价格<text class="iconfont {{orderType=='asc'?'icon-shang':'icon-xia'}}"></text></view>
  14 + <view class="title-item" bindtap="sort2">佣金<text class="iconfont {{orderType=='asc'?'icon-shang':'icon-xia'}}"></text></view>
  15 + <view class="title-item" bindtap='new_sort'>最新</view>
15 16 </view>
16 17 <!-- 列表项 -->
17 18 <scroll-view
18 19 class="list"
19 20 scroll-y="true"
  21 + bindscrolltolower="refresh"
20 22 scroll-anchoring
21   - refresher-enabled>
22   - <nodata nodataContainer="nodata">暂无数据</nodata>
  23 + refresher-enabled>
  24 + <block wx:for="{{list}}">
23 25 <view class class="list-item">
24   - <view class="img-container"></view>
  26 + <view class="img-container">
  27 + <image src="{{url+item.original_img}}" style="width: 100%; height: 100%;"
  28 + binderror="bind_bnerr2" lazy-load="true"
  29 + data-errorimg="list[{{index}}].original_img"></image>
  30 + </view>
25 31 <view class="details">
26   - <view class="ellipsis-2 fs28 name">商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称</view>
27   - <view class="red pdt14">¥200.00</view>
  32 + <view class="ellipsis-2 fs28 name">{{item.goods_name}}</view>
  33 + <view class="red pdt14">¥{{item.shop_price}}
  34 + <!-- 如果有等级卡的话 -->
  35 + <block wx:if="{{g_filter.is_has_rank(rank_switch,item)}}">
  36 + <!-- 当会员是等级卡的时候,且卡有钱的时候 -->
  37 + <block wx:if="{{card_field && item[card_field]>0}}">
  38 + <text class="plus_show">PLUS</text>¥{{item[card_field]}}
  39 + </block>
  40 + <!-- 当会员不是等级卡的时候,且卡有钱的时候 -->
  41 + <block wx:if="{{!card_field && g_filter.get_card_price(item,card_list,0)>0}}">
  42 + <text class="plus_show">PLUS</text>¥{{g_filter.get_card_price(item,card_list,0)}}
  43 + </block>
  44 + </block>
  45 + </view>
  46 +
28 47 <view class="flex jc_sb fs24 pdt14">
29   - <view class="gray">已售:<text class="red">3</text></view>
30   - <view class="gray">分成金额:<text class="red">¥21</text></view>
  48 + <view class="gray">已售:<text class="red">{{item.sales_sum}}</text></view>
  49 + <view class="gray">分成金额:
  50 + <text wx:if="{{!pattern}}" class="red">¥{{item.commission}}</text>
  51 + <text wx:else class="red">¥{{item.fir_rate+item.sec_rate+item.thi_rate}}</text>
  52 + </view>
  53 + </view>
  54 + <view bindtap="share_good" data-index="{{index}}" class="t-r fs28 pdt14">
  55 + <view class="btn-share">分享</view>
31 56 </view>
32   - <view class="t-r fs28 pdt14"><view class="btn-share">分享</view></view>
33 57 </view>
34 58 </view>
35   - <view class="no-more t-c">- 已全部加载 -</view>
  59 + </block>
  60 + <nodata wx:if="{{list.length==0}}" nodataContainer="nodata">暂无数据</nodata>
  61 + <view wx:if="{{is_no_more}}" class="no-more t-c">- 已全部加载 -</view>
36 62 </scroll-view>
37 63 </view>
38 64 </view>
  65 +
  66 +<!--二维码显示页面-->
  67 +<canvas canvas-id='share' style='width:750rpx;height:1217rpx;' wx:if='{{!canvasHidden}}'></canvas>
  68 +<!-- 分享控件,底部弹出 -->
  69 +<share_button id="share_button" bind:cancel="cancel" bind:share_img="saveImageToPhotosAlbum" wx:if="{{!share_hidden}}"></share_button>
... ...
packageA/pages/goods_share/goods_share.wxss
... ... @@ -74,10 +74,10 @@ page {
74 74 justify-content: center;
75 75 }
76 76 .img-container:after {
77   - font-family: iconfont;
  77 + /* font-family: iconfont;
78 78 content: '\e8c1';
79 79 color: #bbb;
80   - font-size: 80rpx;
  80 + font-size: 80rpx; */
81 81 }
82 82 .details {
83 83 flex: 1;
... ... @@ -107,3 +107,12 @@ page {
107 107 .name {
108 108 height: 76rpx;
109 109 }
  110 +
  111 +.plus_show{
  112 + background-color: #FE6867;
  113 + color: #fff;
  114 + padding: 3rpx 5rpx;
  115 + border-radius:8rpx ;
  116 + margin-left: 10rpx;
  117 + margin-right: 5rpx;
  118 +}
... ...
pages/giftpack/giftpacklist/giftpacklist.js
... ... @@ -37,18 +37,31 @@ Page({
37 37 getGiftID: options.lbId,
38 38 orderSn: options.orderSn
39 39 })
  40 +
  41 + //-- 获取分享人的ID --
  42 + var first_leader=options.first_leader;
  43 + if(first_leader){
  44 + //-- user_id代过来免登陆 --
  45 + getApp().globalData.user_id=first_leader;
  46 + getApp().getUserFir();
  47 + //调用接口判断是不是会员
  48 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+oo.stoid+"/"+first_leader,{}).then(res=>{
  49 + if(res.data.code==0){
  50 + getApp().globalData.guide_id=res.data.data.id;
  51 + }
  52 + })
  53 + }
40 54  
41 55 th.close();
42 56 },
43   - onShow: function() {
44   -
  57 +
  58 + onShow: function() {
45 59 //--先判断会员状态--
46 60 var user_info = getApp().globalData.userInfo;
47 61 if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
48 62 getApp().goto('/pages/togoin/togoin');
49 63 return false;
50 64 }
51   -
52 65 if (this.data.isBuy == 0) {
53 66 this.GetMyGiftList();
54 67 } else {
... ...
pages/index/index/index.js
... ... @@ -72,14 +72,26 @@ Page({
72 72 max_sw_height: 0, //banner的最大高度
73 73 is_disgraceful: 0, //是否显示新人广告
74 74 new_image: "", //新人有礼弹窗图片
75   - new_nav: "", //新人页面跳转地址
76   -
77   - w_holiday_pop:0,
78   -
79   - },
80   -
81   - onLoad: async function() {
82   - var th = this;
  75 + new_nav: "", //新人页面跳转地址
  76 + w_holiday_pop:0,
  77 +
  78 + },
  79 +
  80 + onLoad: async function(tt) {
  81 + var th = this;
  82 + var first_leader=tt.first_leader;
  83 + if(first_leader){
  84 + //-- user_id代过来免登陆 --
  85 + getApp().globalData.user_id=first_leader;
  86 + getApp().getUserFir();
  87 + //调用接口判断是不是会员
  88 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+oo.stoid+"/"+first_leader,{}).then(res=>{
  89 + if(res.data.code==0){
  90 + getApp().globalData.guide_id=res.data.data.id;
  91 + }
  92 + })
  93 + }
  94 +
83 95 //看一下商家是否开通了权益
84 96 //--初始化是否有打勾--
85 97 getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", {
... ... @@ -859,7 +871,14 @@ Page({
859 871 if(!url || url=='') return;
860 872 if(url[0]!='/') url='/'+url;
861 873 getApp().goto(url);
862   - }
  874 + },
  875 +
  876 + //----跳转到搭配购买----
  877 + go_test:function () {
  878 + wx.navigateTo({ url: "/packageA/pages/goods_share/goods_share", })
  879 + },
  880 +
  881 +
863 882  
864 883  
865 884  
... ...
pages/index/index/index.wxml
... ... @@ -3,6 +3,8 @@
3 3 <!--普通界面-->
4 4 <wxs module="filter" src="../../../utils/filter.wxs"></wxs>
5 5 <view class="container rel" wx:if="{{ishow}}">
  6 +
  7 +
6 8 <block wx:if="{{banner}}">
7 9 <image class="xc-top-img abs" src="{{url}}/miniapp/images/top-img.png"></image>
8 10 </block>
... ... @@ -84,7 +86,7 @@
84 86 <view class="flex-vertical">
85 87 <image class="xc-hook" src="{{url}}/miniapp/images/index/youxuan.png">
86 88 </image>
87   - <text class="yellow-co fs26 margin-left">人工优先</text>
  89 + <text bindtap='go_test' class="yellow-co fs26 margin-left" data-url="../../../packageA/pages/prom_list/prom_list">人工优先</text>
88 90 </view>
89 91  
90 92  
... ...
pages/user/index/index.js
... ... @@ -57,24 +57,30 @@ Page({
57 57 /**
58 58 * 生命周期函数--监听页面加载
59 59 */
60   - onLoad: function(options) {
  60 + onLoad: function(options) {
61 61 var th=this;
  62 + //-- 读取会员中心按钮列表 --
  63 + getApp().request.promiseGet("/api/weshop/userTool/page", {
  64 + }).then(res => {
  65 + if(res.data.code==0 ){
  66 + var d_list=res.data.data.pageData;
  67 + th.setData({user_tool:d_list});
  68 + }
  69 + })
62 70 this.birthday();
63   - getApp().request.promiseGet("/api/weshop/ad/list?pid=401&store_id=" + os.stoid, {
  71 + getApp().request.promiseGet("/api/weshop/ad/page?pid=401&store_id=" + os.stoid, {
64 72 data: {
65 73 enabled: 1
66 74 }
67 75 }).then(res => {
68 76 if(res.data.code==0 && res.data.data){
69   - var item=res.data.data[0];
70   - if (item && item.ad_code)
  77 + var item=res.data.data.pageData[0];
  78 + if (item && item.ad_code)
71 79 th.setData({ad_img:item.ad_code})
72 80 }
73   - })
74   -
  81 + })
75 82 app.getUserFir();
76   -
77   -
  83 +
78 84 },
79 85  
80 86 /**
... ... @@ -122,9 +128,7 @@ Page({
122 128 }
123 129 }
124 130 });
125   -
126   -
127   -
  131 +
128 132 /*-----统计-----*/
129 133 rq.get("/api/weshop/order/waitlist", {
130 134 data: {
... ... @@ -298,8 +302,10 @@ Page({
298 302 getApp().getConfig2(function(e) {
299 303 var t_swi = e.switch_list;
300 304 if (t_swi) t_swi = JSON.parse(t_swi)
301   - if(t_swi){
302   - th.setData({sys_switch:t_swi})
  305 + if(t_swi){
  306 + var user_tool=[];
  307 + if(t_swi.usertool) user_tool=JSON.parse(t_swi.usertool);
  308 + th.setData({sys_switch:t_swi,c_list:user_tool});
303 309 }
304 310  
305 311  
... ...
pages/user/index/index.wxml
1 1 <!-- <import src="../../tabbar/tabbar.wxml" />
2 2 <template is="tabBar" data="{{tabBar}}" /> -->
3   -
  3 +<wxs src="filter.wxs" module="util"></wxs>
4 4 <view class="xc-page" style="margin-bottom:{{isIpx ? '168rpx' : '100rpx'}}">
5 5 <view class="xc-user">
6 6 <view class="xc-head rel">
... ... @@ -199,73 +199,59 @@
199 199 <view class="xc-project-frame">
200 200 <!-- 跳转页面 -->
201 201 <view class="center_v" style="display: flex;flex-wrap: wrap;align-items: center;">
202   - <view class="item t-c" data-url="/pages/team/team_ping/team_ping" bindtap="goto">
203   - <image class="xc-center-img " src="{{iurl}}/miniapp/images/pindan.png"></image>
204   - <view class="fs26">我的拼单</view>
205   - </view>
206   - <view class="item t-c" data-url="/pages/activity/seckill_list/seckill_list" bindtap="goto">
207   - <image class="xc-center-img " src="{{iurl}}/miniapp/images/miaosha.png"></image>
208   - <view class="fs26">秒杀活动</view>
209   - </view>
210   - <view class="item t-c" bindtap="go_qy" wx:if="{{qy_list!=null && is_init && gradeId}}">
211   - <image class="xc-center-img " src="{{iurl}}/miniapp/images/quanyi2.png"></image>
212   - <view class="fs26">我的权益</view>
213   - </view>
214   -
215   - <button class="item t-c" wx:if="{{sys_switch.weapp_customertype}}" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
216   - <image class="xc-center-img " src="{{iurl}}/miniapp/images/kefu.png"></image>
217   - <view class="fs26">联系客服</view>
218   - </button>
219   -
220   - <view class="item t-c" bindtap="contactService" wx:else>
221   - <image class="xc-center-img " src="{{iurl}}/miniapp/images/kefu.png"></image>
222   - <view class="fs26">联系客服</view>
223   - </view>
224   -
225   -
226   -
227   -
228   - <view class="item t-c" data-url="/pages/user/cardinfo/cardinfo" bindtap="goto" wx:if="{{is_dengji==1}}">
229   - <image class="xc-center-img " src="{{iurl}}/miniapp/images/plus/privilege_o.png"></image>
230   - <view class="fs26">plus会员</view>
231   - </view>
232   -
233   - <view class="item t-c" data-url="/pages/user/collect_list/collect_list" bindtap="goto">
234   - <image class="xc-center-img " src="{{iurl}}/miniapp/images/collections.png"></image>
235   - <view class="fs26">收藏夹</view>
236   - </view>
237   -
238   - <view class="item t-c" data-url="/pages/user/comment/comment" bindtap="goto">
239   - <image class="xc-center-img " src="{{iurl}}/miniapp/images/evaluate.png"></image>
240   - <view class="fs26">我的评价</view>
241   - </view>
242   -
243   - <view class="item t-c" data-url="/pages/user/address_list/address_list" bindtap="goto">
244   - <image class="xc-center-img " src="{{iurl}}/miniapp/images/add2.png"></image>
245   - <view class="four-level-word">我的地址</view>
246   - </view>
247   -
248   - <!-- 收入卡包 -->
249   - <view class="item t-c" bindtap="addcard" wx:if="{{add_card_data}}">
250   - <image class="xc-center-img " src="{{iurl}}//miniapp/images/wx_cardbag.png"></image>
251   - <view class="four-level-word">收入卡包</view>
252   - </view>
253   -
254   - <view class="item t-c" data-url="/pages/user/my_service/i_service" bindtap="goto_nav" >
255   - <image class="xc-center-img " src="{{iurl}}/miniapp/images/yyservice/myservice.png"></image>
256   - <view class="four-level-word">我的服务</view>
257   - </view>
258   - <view class="item t-c" data-url="/pages/giftpack/mygiftpack/mygiftpack" bindtap="goto_nav">
259   - <image class="xc-center-img " src="{{iurl}}/miniapp/images//user/wdlb.png"></image>
260   - <view class="four-level-word">专享礼包</view>
261   - </view>
262   - <block wx:if="{{is_assistance==1}}">
263   - <view class="item t-c" data-url="/pages/user/assistance/assistance" bindtap="goto_nav">
264   - <image class="xc-center-img " src="{{iurl}}/miniapp/images/friendhelp/icon-zl.png"></image>
265   - <view class="four-level-word">助力活动</view>
266   - </view>
267   - </block>
268   -
  202 + <!-- 循环使用自定义菜单,显示和掩藏 -->
  203 + <block wx:for="{{user_tool}}">
  204 + <!-- 判断系统配置中有没有把菜单关闭 -->
  205 + <block wx:if="{{!util.is_close(item.name,c_list)}}">
  206 + <!-- 有链接地址的时候 -->
  207 + <block wx:if="{{item.weappurl}}">
  208 + <block wx:if="{{item.name=='PLUS会员'}}">
  209 + <view class="item t-c" data-url="{{item.weappurl}}" bindtap="goto" wx:if="{{is_dengji==1}}">
  210 + <image class="xc-center-img " src="{{iurl+item.icoimg}}"></image>
  211 + <view class="fs26">PLUS会员</view>
  212 + </view>
  213 + </block>
  214 + <block wx:elif="{{item.name=='助力活动'}}">
  215 + <view class="item t-c" data-url="/pages/user/assistance/assistance" bindtap="goto_nav" wx:if="{{is_assistance==1}}">
  216 + <image class="xc-center-img " src="{{iurl}}/miniapp/images/friendhelp/icon-zl.png"></image>
  217 + <view class="four-level-word">助力活动</view>
  218 + </view>
  219 + </block>
  220 + <block wx:else>
  221 + <view class="item t-c" data-url="{{item.weappurl}}" bindtap="goto_nav">
  222 + <image class="xc-center-img " src="{{iurl+item.icoimg}}"></image>
  223 + <view class="fs26">{{item.name}}</view>
  224 + </view>
  225 + </block>
  226 + </block>
  227 + <!-- 没有链接地址的时候 -->
  228 + <block wx:else>
  229 + <block wx:if="{{item.name=='我的权益'}}">
  230 + <view class="item t-c" bindtap="go_qy" wx:if="{{qy_list!=null && is_init && gradeId}}">
  231 + <image class="xc-center-img " src="{{iurl+item.icoimg}}"></image>
  232 + <view class="fs26">我的权益</view>
  233 + </view>
  234 + </block>
  235 + <block wx:elif="{{item.name=='联系客服'}}">
  236 + <button class="item t-c" wx:if="{{sys_switch.weapp_customertype}}" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
  237 + <image class="xc-center-img " src="{{iurl+item.icoimg}}"></image>
  238 + <view class="fs26">联系客服</view>
  239 + </button>
  240 + <view class="item t-c" bindtap="contactService" wx:else>
  241 + <image class="xc-center-img " src="{{iurl+item.icoimg}}"></image>
  242 + <view class="fs26">联系客服</view>
  243 + </view>
  244 +
  245 + </block>
  246 + <block wx:elif="{{item.name=='收入卡包'}}">
  247 + <view class="item t-c" bindtap="addcard" wx:if="{{add_card_data}}">
  248 + <image class="xc-center-img " src="{{iurl+item.icoimg}}"></image>
  249 + <view class="four-level-word">收入卡包</view>
  250 + </view>
  251 + </block>
  252 + </block>
  253 + </block>
  254 + </block>
269 255 </view>
270 256  
271 257 </view>
... ...