Explorar el Código

mp: 支持显示赔付比例

joe hace 3 años
padre
commit
b65290aca5

+ 1 - 1
view/xcx/api/api.js

@@ -194,7 +194,7 @@ export function logout() {
 /**
  * 获取订阅消息id
  */
-export function getTemlIds() {
+export function getTplIds() {
     return request.get('wechat/teml_ids', {}, {
         noAuth: true
     })

+ 1 - 0
view/xcx/app.js

@@ -107,6 +107,7 @@ App({
         loginType: 'routine',
         isFixed: false,
         unread: 0, // 未读消息条数
+        show_benefit: false, // 是否显示赔付比例
     },
 
     /**

+ 11 - 8
view/xcx/components/mine/index.js

@@ -8,6 +8,7 @@ import {
     strip,
     tsToStringDate
 } from "../../utils/util"
+import d from '../../utils/d.js';
 
 var app = getApp()
 
@@ -41,7 +42,7 @@ Component({
      */
     methods: {
         show: function () {
-            // console.log('show:', app.globalData.token)
+            d.debug('mine show:', app.globalData.token)
             if (app.globalData.isLog) {
                 // this.setData({
                 //     iShidden: true
@@ -58,6 +59,7 @@ Component({
         },
 
         hide: function () {
+            d.debug('mine hidden')
             if (this.data.stepTimer) {
                 clearInterval(this.data.stepTimer);
             }
@@ -70,9 +72,9 @@ Component({
                 displaying: false,
             })
         },
-
+        // 获取数据 1
         getStatus: function () {
-            // console.log('isLog:', app.globalData.isLog)
+            d.debug('isLog:', app.globalData.isLog)
             if (app.globalData.isLog) {
                 var that = this;
                 getMineStatus().then(res => {
@@ -98,6 +100,7 @@ Component({
             }
         },
 
+        // 获取数据 2
         getHistory: function () {
             if (app.globalData.isLog) {
                 var that = this
@@ -116,7 +119,7 @@ Component({
 
         onLoadFun: function () {
             if (this.data.displaying && app.globalData.isLog) {
-                // console.log("onLoadFun")
+                d.debug("mine onLoadFun")
                 this.getStatus()
                 this.getHistory()
             }
@@ -136,16 +139,16 @@ Component({
 
         setupTimers: function () {
             var that = this
-            if (that.data.syncTimer == null) {
-                that.setData({
+            if (this.data.syncTimer == null) {
+                this.setData({
                     syncTimer: setInterval(() => {
                         that.getStatus()
                     }, 1000 * 60 * 2),
                 })
             }
 
-            if (that.data.stepTimer == null && that.data.step > 0.0) {
-                that.setData({
+            if (this.data.stepTimer == null && this.data.step > 0.0) {
+                this.setData({
                     stepTimer: setInterval(() => {
                         that.clientStep();
                     }, 1000),

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 95 - 61
view/xcx/css/style.wxss


+ 16 - 8
view/xcx/pages/goods_details/index.js

@@ -18,6 +18,7 @@ import {
 } from '../../api/order.js';
 import WxParse from '../../wxParse/wxParse.js';
 import util from '../../utils/util.js';
+import d from '../../utils/d.js';
 import wxh from '../../utils/wxh.js';
 import {
     CACHE_LONGITUDE,
@@ -43,6 +44,7 @@ Page({
             'coupon': false,
             list: [],
         },
+        show_benefit: false,
         attr: '请选择', //属性页面提示
         attrValue: '', //已选属性
         animated: false, //购物车动画
@@ -145,14 +147,15 @@ Page({
      * 登录后加载
      */
     onLoadFun: function (e) {
+        d.debug('details->onLoadFun()')
         this.setData({
             isLog: true
         });
-        this.getCouponList();
+        // this.getCouponList();
         this.getCartCount();
-        this.downloadFilePromotionCode();
+        // this.downloadFilePromotionCode();
         this.getUserInfo();
-        this.get_product_collect();
+        // this.get_product_collect();
     },
 
     ChangCouponsClone: function () {
@@ -353,8 +356,10 @@ Page({
         var that = this;
         this.setData({
             navH: app.globalData.navHeight,
-            fixed: app.globalData.isFixed
+            fixed: app.globalData.isFixed,
+            show_benefit: app.globalData.show_benefit,
         });
+
         //设置商品列表高度
         wx.getSystemInfo({
             success: function (res) {
@@ -466,9 +471,12 @@ Page({
                 navList: navList
             });
             if (app.globalData.isLog) {
-                that.getUserInfo();
+                that.setData({
+                    'storeInfo.userCollect': res.data.storeInfo.userCollect
+                });
+                // that.getUserInfo();
             }
-            that.downloadFilestoreImage();
+            // that.downloadFilestoreImage();
             that.DefaultSelect();
             setTimeout(function () {
                 that.setClientHeight();
@@ -631,7 +639,7 @@ Page({
             }
         }
     },
-    
+
     /**
      * 打开属性插件
      */
@@ -984,7 +992,7 @@ Page({
             }
         })
     },
-    
+
     /**
      * 用户点击分享
      */

+ 14 - 31
view/xcx/pages/goods_details/index.wxml

@@ -2,8 +2,7 @@
     <view class='navbarH' style='height:{{navH}}rpx;'>
         <view class='navbarCon acea-row row-center-wrapper'>
             <view class="header acea-row row-center-wrapper">
-                <view class="item {{navActive === index ? 'on' : ''}}" wx:for="{{navList}}" wx:key='index' bindtap="tap"
-                    data-index="{{index}}" data-id='past{{index}}'>
+                <view class="item {{navActive === index ? 'on' : ''}}" wx:for="{{navList}}" wx:key='index' bindtap="tap" data-index="{{index}}" data-id='past{{index}}'>
                     {{ item }}
                 </view>
             </view>
@@ -22,8 +21,7 @@
 <!-- <view style="height:{{navH+20}}rpx;" wx:if="{{scrollY>200}}"></view> -->
 <!-- style='height:{{scrollY>200?(height+2*navH+20):(height+navH)}}rpx;' -->
 <view class='product-con'>
-    <scroll-view scroll-top="{{scrollTop}}" scroll-y='true' scroll-with-animation="true" style='height:{{height}}px;'
-        bindscroll="scroll">
+    <scroll-view scroll-top="{{scrollTop}}" scroll-y='true' scroll-with-animation="true" style='height:{{height}}px;' bindscroll="scroll">
         <view id="past0">
             <productConSwiper imgUrls="{{storeInfo.slider_image}}" videoline="{{storeInfo.video_link}}">
             </productConSwiper>
@@ -31,6 +29,7 @@
                 <view class='share acea-row row-between row-bottom'>
                     <view class='money font-color'>
                         ¥<text class='num'>{{storeInfo.price}}</text>
+                        <text class='y-money' wx:if="{{show_benefit}}">{{storeInfo.reputation}}</text>
                         <!-- <text class='vip-money' wx:if="{{storeInfo.vip_price && storeInfo.vip_price > 0}}">¥{{storeInfo.vip_price}}</text> -->
                         <!-- <image wx:if="{{storeInfo.vip_price && storeInfo.vip_price > 0}}" src="/images/vip.png"></image> -->
                     </view>
@@ -57,20 +56,15 @@
                     <view class="line1 acea-row">
                         <text decode="{{true}}" space="{{true}}">活&nbsp;&nbsp;&nbsp;动:</text>
                         <view wx:for="{{activity}}" wx:key='index' bindtap="goActivity" data-items='{{item}}'>
-                            <view wx:if="{{item.type === '1'}}"
-                                class="{{index==0?'activity_pin':'' || index==1?'activity_miao':'' || index==2?'activity_kan':''}}">
+                            <view wx:if="{{item.type === '1'}}" class="{{index==0?'activity_pin':'' || index==1?'activity_miao':'' || index==2?'activity_kan':''}}">
                                 <text class="iconfonts iconfont icon-pintuan"></text>
                                 <text class="activity_title"> 参与秒杀</text>
                             </view>
-                            <view
-                                class="{{index==0?'activity_pin':'' || index==1?'activity_miao':'' || index==2?'activity_kan':''}}"
-                                wx:if="{{item.type === '2'}}">
+                            <view class="{{index==0?'activity_pin':'' || index==1?'activity_miao':'' || index==2?'activity_kan':''}}" wx:if="{{item.type === '2'}}">
                                 <text class="iconfonts iconfont icon-shenhezhong"></text>
                                 <text class="activity_title"> 参与砍价</text>
                             </view>
-                            <view
-                                class="{{index==0?'activity_pin':'' || index==1?'activity_miao':'' || index==2?'activity_kan':''}}"
-                                wx:if="{{item.type === '3'}}">
+                            <view class="{{index==0?'activity_pin':'' || index==1?'activity_miao':'' || index==2?'activity_kan':''}}" wx:if="{{item.type === '3'}}">
                                 <text class="iconfonts iconfont icon-kanjia"></text>
                                 <text class="activity_title"> 参与拼团</text>
                             </view>
@@ -128,21 +122,15 @@
                 <image src="/images/ling.png"></image>
             </view>
             <view class="slider-banner banner">
-                <swiper indicator-dots="true" autoplay="{{autoplay}}" circular="{{circular}}" interval="{{interval}}"
-                    duration="{{duration}}" indicator-color="#999" indicator-active-color="#e93323"
-                    style="height:{{clientHeight+'px'}}">
+                <swiper indicator-dots="true" autoplay="{{autoplay}}" circular="{{circular}}" interval="{{interval}}" duration="{{duration}}" indicator-color="#999" indicator-active-color="#e93323" style="height:{{clientHeight+'px'}}">
                     <swiper-item wx:for="{{good_list}}" wx:for-item='item' wx:for-index='indexw' wx:key='index'>
                         <view class="list acea-row row-middle" id="list{{indexw}}">
-                            <view class="item" wx:for="{{item.list}}" wx:key='index' wx:for-item='val'
-                                bindtap="goDetail" data-items='{{val}}'>
+                            <view class="item" wx:for="{{item.list}}" wx:key='index' wx:for-item='val' bindtap="goDetail" data-items='{{val}}'>
                                 <view class="pictrue">
                                     <image src="{{val.image}}"></image>
-                                    <text class="pictrue_log pictrue_log_class"
-                                        wx:if="{{val.activity && val.activity.type ==='1'}}">秒杀</text>
-                                    <text class="pictrue_log pictrue_log_class"
-                                        wx:if="{{val.activity && val.activity.type === '2'}}">砍价</text>
-                                    <text class="pictrue_log pictrue_log_class"
-                                        wx:if="{{val.activity && val.activity.type === '3'}}">拼团</text>
+                                    <text class="pictrue_log pictrue_log_class" wx:if="{{val.activity && val.activity.type ==='1'}}">秒杀</text>
+                                    <text class="pictrue_log pictrue_log_class" wx:if="{{val.activity && val.activity.type === '2'}}">砍价</text>
+                                    <text class="pictrue_log pictrue_log_class" wx:if="{{val.activity && val.activity.type === '3'}}">拼团</text>
                                 </view>
                                 <view class="name line1">{{val.store_name}}</view>
                                 <view class="money font-color">¥{{val.price}}</view>
@@ -162,9 +150,7 @@
         <view style='height:120rpx;'></view>
     </scroll-view>
     <view class='{{ fixed ? "fixed" : ""}} footer acea-row row-between-wrapper'>
-        <button open-type="contact" hover-class='none' class='item ' send-message-title="{{storeInfo.store_name}}"
-            send-message-img="{{storeInfo.image}}" send-message-path="/pages/goods_details/index?id={{storeInfo.id}}"
-            show-message-card>
+        <button open-type="contact" hover-class='none' class='item ' send-message-title="{{storeInfo.store_name}}" send-message-img="{{storeInfo.image}}" send-message-path="/pages/goods_details/index?id={{storeInfo.id}}" show-message-card>
             <view class='iconfont icon-kefu'></view>
             <view>客服</view>
         </button>
@@ -173,8 +159,7 @@
             <view class='iconfont icon-shoucang' wx:else></view>
             <view>收藏</view>
         </view>
-        <navigator open-type='switchTab' class="animated item {{animated==true?'bounceIn':''}}"
-            url='/pages/order_addcart/order_addcart'>
+        <navigator open-type='switchTab' class="animated item {{animated==true?'bounceIn':''}}" url='/pages/order_addcart/order_addcart'>
             <view class='iconfont icon-gouwuche1'>
                 <text class='num bg-color'>{{CartCount || 0}}</text>
             </view>
@@ -223,9 +208,7 @@
 <view class='mask' wx:if="{{posterImageStatus}}"></view>
 <canvas class="canvas" canvas-id='myCanvas' wx:if="{{canvasStatus}}"></canvas>
 <!-- 组件 -->
-<product-window iSplus='{{iSplus}}' attribute='{{attribute}}' productAttr="{{productAttr}}"
-    productSelect="{{productSelect}}" bind:myevent="onMyEvent" bind:ChangeAttr="ChangeAttr"
-    bind:ChangeCartNum="ChangeCartNum" id='product-window' bind:iptCartNum="iptCartNum"></product-window>
+<product-window iSplus='{{iSplus}}' attribute='{{attribute}}' productAttr="{{productAttr}}" productSelect="{{productSelect}}" bind:myevent="onMyEvent" bind:ChangeAttr="ChangeAttr" bind:ChangeCartNum="ChangeCartNum" id='product-window' bind:iptCartNum="iptCartNum"></product-window>
 <coupon-list-window coupon='{{coupon}}' bind:ChangCouponsClone="ChangCouponsClone" bind:ChangCoupons="ChangCoupons">
 </coupon-list-window>
 <authorize bind:onLoadFun="onLoadFun" isAuto="{{isAuto}}" iShidden="{{iShidden}}"></authorize>

+ 4 - 0
view/xcx/pages/goods_details/index.wxss

@@ -107,6 +107,10 @@
     right: -10rpx;
 }
 
+.reputation {
+    float: right;
+}
+
 .product-con .footer .bnt {
     width: 444rpx;
     height: 76rpx;

+ 19 - 16
view/xcx/pages/index/index.js

@@ -3,7 +3,7 @@ import wxh from '../../utils/wxh.js';
 import {
     getIndexData,
     getCoupons,
-    getTemlIds,
+    getTplIds,
     getLiveList,
     getNotifications
 } from '../../api/api.js';
@@ -41,6 +41,7 @@ Page({
         logoUrl: '', // 左上方 logo
         prodCates: [], // 分类列表/活动列表 (目前只有一个,就是“活动”)
         banner: [], // 顶部 banner
+        show_benefit: false, // 是否显示赔付比率
         itemNew: [], // 跑马灯列表
         menus: [],
         getCouponList: [], //@deprecated 
@@ -75,7 +76,7 @@ Page({
             'class': '5'
         },
         window: false, // 是否显示优惠券窗口
-        iShiddenTip: false, // 是否显示提示
+        hideTip: false, // 是否显示提示
         isAuto: true, // 是否自动授权;
         iShidden: true, // 是否隐藏;
         isGoIndex: false, // 是否返回首页;
@@ -111,7 +112,7 @@ Page({
     closeTip: function () {
         wx.setStorageSync('msg_key', true);
         this.setData({
-            iShiddenTip: true
+            hideTip: true
         })
     },
 
@@ -162,17 +163,17 @@ Page({
         }
         if (wx.getStorageSync('msg_key')) {
             this.setData({
-                iShiddenTip: true
+                hideTip: true
             });
         }
-        this.getTemlIds();
+        this.getTplIds();
         this.getLiveList();
     },
 
-    getTemlIds() {
+    getTplIds() {
         let messageTmplIds = wx.getStorageSync(CACHE_SUBSCRIBE_MESSAGE);
         if (!messageTmplIds) {
-            getTemlIds().then(res => {
+            getTplIds().then(res => {
                 if (res.data) {
                     wx.setStorageSync(CACHE_SUBSCRIBE_MESSAGE, JSON.stringify(res.data));
                 }
@@ -250,6 +251,7 @@ Page({
         getIndexData().then(res => {
             that.setData({
                 banner: res.data.banner,
+                show_benefit: res.data.show_benefit,
                 menus: res.data.menus,
                 activity: res.data.activity,
                 lovely: res.data.lovely,
@@ -260,7 +262,7 @@ Page({
                 logoUrl: res.data.logoUrl,
                 couponList: res.data.couponList,
             });
-
+            app.globalData.show_benefit = res.data.show_benefit;
             app.setUnread(res.data.notice);
         })
     },
@@ -358,16 +360,19 @@ Page({
             return
         }
 
+        this.setData({
+            activeTabIndex: tabIndex,
+        })
+
         if (this.data.prodCates.children[tabIndex - 1].id === CATE_BLACKHOLE_ID) {
             // 黑洞
             let mine = null
             if (this.data.cpnMine == null) {
                 mine = this.selectComponent('#mine')
+                this.setData({
+                    cpnMine: mine,
+                })
             }
-            this.setData({
-                activeTabIndex: tabIndex,
-                cpnMine: mine,
-            })
 
             var _ = this.data.cpnMine && this.data.cpnMine.show()
             return
@@ -375,10 +380,6 @@ Page({
 
         var _ = this.data.cpnMine && this.data.cpnMine.hide()
 
-        this.setData({
-            activeTabIndex: tabIndex
-        })
-
         // 首屏
         if (this.data.prodCates.children[tabIndex - 1].page <= 1) {
             this.get_product_list(tabIndex);
@@ -437,6 +438,7 @@ Page({
                     activity: prod.activity,
                     store_name: prod.store_name,
                     price: prod.price,
+                    reputation: prod.reputation,
                     vip_price: prod.vip_price,
                     sales: prod.sales,
                     isShow: (counter / 2 - act.aboveShowRowIndex) <= 2 * this.data.rowCacheNum, // 是否显示
@@ -452,6 +454,7 @@ Page({
                 [`prodCates.children[${cindex}].products`]: products,
                 [`prodCates.children[${cindex}].page`]: act.page + 1
             });
+            d.debug(that.data.prodCates)
         }).catch(err => {
             d.error(err)
             that.setData({

+ 2 - 1
view/xcx/pages/index/index.wxml

@@ -1,6 +1,6 @@
 <navbar parameter='{{parameter}}' logoUrl="{{logoUrl}}"></navbar>
 <view class="indexs">
-    <view class="indexTip" style="top:{{navH+13}}rpx" hidden="{{iShiddenTip}}">
+    <view class="indexTip" style="top:{{navH+13}}rpx" hidden="{{hideTip}}">
         <view class="tip acea-row row-between-wrapper">
             <view class="text">点击“<image src="/images/spot.png"></image>”添加到我的小程序, 微信首页下拉即可访问美天旺。</view>
             <view class="iconfont icon-guanbi1" bindtap="closeTip"></view>
@@ -417,6 +417,7 @@
                     <view bindtap="goDetailType" data-items='{{productItem}}' class="item" wx:for="{{item.products}}" wx:for-item="productItem" wx:key='index' wx:if="{{productItem.isShow}}">
                         <view class="pictrue">
                             <image src="{{productItem.image}}"></image>
+                            <text class="picture_plugin pictrue_log_class" wx:if="{{show_benefit}}">{{productItem.reputation}}</text>
                             <text class="pictrue_log_medium pictrue_log_class" wx:if="{{productItem.activity && productItem.activity.type ==='1'}}">秒杀</text>
                             <text class="pictrue_log_medium pictrue_log_class" wx:if="{{productItem.activity && productItem.activity.type === '2'}}">砍价</text>
                             <text class="pictrue_log_medium pictrue_log_class" wx:if="{{productItem.activity && productItem.activity.type === '3'}}">拼团</text>

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio