Commit ba7c976d940ac7eaa3258321201fe8fbd2241758

Authored by yvan.ni
1 parent 9352fc9f

组件的优化

components/com_top_nav/com_top_nav.js
@@ -23,7 +23,7 @@ Component({ @@ -23,7 +23,7 @@ Component({
23 }, 23 },
24 ready: function() { 24 ready: function() {
25 let height= getApp().globalData.navBarHeight; 25 let height= getApp().globalData.navBarHeight;
26 - let menuInfo = getApp().globalData.menuInfo; 26 + let menuInfo = getApp().globalData.menuInfo || {height:0};
27 let user_no=''; 27 let user_no='';
28 if(getApp().globalData.userInfo){ 28 if(getApp().globalData.userInfo){
29 user_no=getApp().globalData.userInfo.erpvipno 29 user_no=getApp().globalData.userInfo.erpvipno
components/diy_user_info/diy_user_info.js
@@ -6,22 +6,34 @@ var r=s; @@ -6,22 +6,34 @@ var r=s;
6 Component({ 6 Component({
7 properties: { 7 properties: {
8 object: { 8 object: {
9 - type: Object,  
10 - value: null 9 + type: Object,
  10 + value: null
11 }, 11 },
12 qy_data:{ 12 qy_data:{
13 - type: Object,  
14 - value: null 13 + type: Object,
  14 + value: null
15 }, 15 },
16 pulscardname:{ 16 pulscardname:{
17 - type:String,  
18 - value:"--" 17 + type:String,
  18 + value:"--"
19 }, 19 },
20 rfmName:{ 20 rfmName:{
21 - type:String,  
22 - value:"--" 21 + type:String,
  22 + value:"--"
23 }, 23 },
24 - // 这里定义了innerText属性,属性值可以在组件使用时指定 24 + yuer:{
  25 + type:Number,
  26 + value:0
  27 + },
  28 + byquan:{
  29 + type:Number,
  30 + value:0
  31 + },
  32 + udata:{
  33 + type: Object,
  34 + value: null
  35 + },
  36 +
25 }, 37 },
26 data: { 38 data: {
27 // 这里是一些组件内部数据 39 // 这里是一些组件内部数据
@@ -35,11 +47,9 @@ Component({ @@ -35,11 +47,9 @@ Component({
35 47
36 ready: function() { 48 ready: function() {
37 var th=this; 49 var th=this;
38 -  
39 if(getApp().globalData.userInfo){ 50 if(getApp().globalData.userInfo){
40 this.setData({userInfo:getApp().globalData.userInfo}); 51 this.setData({userInfo:getApp().globalData.userInfo});
41 } 52 }
42 -  
43 /*-------系统是否开通等级卡,会员是等级卡-----*/ 53 /*-------系统是否开通等级卡,会员是等级卡-----*/
44 getApp().getConfig2(function (e) { 54 getApp().getConfig2(function (e) {
45 var t_swi = e.switch_list; 55 var t_swi = e.switch_list;
@@ -60,7 +70,6 @@ Component({ @@ -60,7 +70,6 @@ Component({
60 } 70 }
61 }, 71 },
62 72
63 -  
64 methods: { 73 methods: {
65 //登陆会员 74 //登陆会员
66 login_user(){ 75 login_user(){
components/diy_user_my_rights/diy_user_my_rights.wxss
@@ -95,6 +95,7 @@ @@ -95,6 +95,7 @@
95 .banner-frame { 95 .banner-frame {
96 width: 100%; 96 width: 100%;
97 background: #f2f2f2; 97 background: #f2f2f2;
  98 + padding-top: 20rpx;
98 } 99 }
99 100
100 button::after { 101 button::after {
components/diy_user_order/diy_user_order.js
@@ -5,7 +5,11 @@ Component({ @@ -5,7 +5,11 @@ Component({
5 type: Object, 5 type: Object,
6 value: null 6 value: null
7 }, 7 },
8 - // 这里定义了innerText属性,属性值可以在组件使用时指定 8 + // 统计相关的
  9 + toji:{
  10 + type: Object,
  11 + value: null
  12 + },
9 13
10 }, 14 },
11 data: { 15 data: {
components/diy_user_order/diy_user_order.wxml
@@ -21,14 +21,14 @@ @@ -21,14 +21,14 @@
21 <block wx:if="{{item.show}}"> 21 <block wx:if="{{item.show}}">
22 <block wx:if="{{item.name=='待付款'}}"> 22 <block wx:if="{{item.name=='待付款'}}">
23 <view class="t-c margin-auto rel" bindtap="go_order" data-url="/pages/user/order_list/order_list?type=1"> 23 <view class="t-c margin-auto rel" bindtap="go_order" data-url="/pages/user/order_list/order_list?type=1">
24 - <image mode="heightFix" wx:if="{{object.is_icon}}" class="xc-no-money" src="{{iurl}}/miniapp/images/daifuk.png"></image> 24 + <image mode="heightFix" wx:if="{{object.is_icon}}" class="xc-no-money" src="{{item.src}}"></image>
25 <view class=" xc-word-color four-level-word">待付款</view> 25 <view class=" xc-word-color four-level-word">待付款</view>
26 <text class="order-num" hidden='{{toji.wait_pay>0?"":"true"}}'>{{toji.wait_pay}}</text> 26 <text class="order-num" hidden='{{toji.wait_pay>0?"":"true"}}'>{{toji.wait_pay}}</text>
27 </view> 27 </view>
28 </block> 28 </block>
29 <block wx:if="{{item.name=='待发货'}}"> 29 <block wx:if="{{item.name=='待发货'}}">
30 <view class="t-c margin-auto rel" bindtap="go_order" data-url="/pages/user/order_list/order_list?type=2"> 30 <view class="t-c margin-auto rel" bindtap="go_order" data-url="/pages/user/order_list/order_list?type=2">
31 - <image mode="heightFix" wx:if="{{object.is_icon}}" class="xc-send" src="{{iurl}}/miniapp/images/dfahuo.png?v=1"></image> 31 + <image mode="heightFix" wx:if="{{object.is_icon}}" class="xc-send" src="{{item.src}}"></image>
32 <view class="xc-word-color four-level-word">待发货</view> 32 <view class="xc-word-color four-level-word">待发货</view>
33 <text class="order-num" hidden='{{toji.wait_send>0?"":"true"}}'>{{toji.wait_send}}</text> 33 <text class="order-num" hidden='{{toji.wait_send>0?"":"true"}}'>{{toji.wait_send}}</text>
34 </view> 34 </view>
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 </block> 36 </block>
37 <block wx:if="{{item.name=='待收货'}}"> 37 <block wx:if="{{item.name=='待收货'}}">
38 <view class="t-c margin-auto rel" bindtap="go_order" data-url="/pages/user/order_list/order_list?type=3"> 38 <view class="t-c margin-auto rel" bindtap="go_order" data-url="/pages/user/order_list/order_list?type=3">
39 - <image mode="heightFix" wx:if="{{object.is_icon}}" class="xc-await" src="{{iurl}}/miniapp/images/shouhuo1.png"></image> 39 + <image mode="heightFix" wx:if="{{object.is_icon}}" class="xc-await" src="{{item.src}}"></image>
40 <view class="xc-word-color four-level-word">待收货</view> 40 <view class="xc-word-color four-level-word">待收货</view>
41 <text class="order-num" hidden='{{toji.wait_receive>0?"":"true"}}'>{{toji.wait_receive}}</text> 41 <text class="order-num" hidden='{{toji.wait_receive>0?"":"true"}}'>{{toji.wait_receive}}</text>
42 </view> 42 </view>
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
44 </block> 44 </block>
45 <block wx:if="{{item.name=='待评论'}}"> 45 <block wx:if="{{item.name=='待评论'}}">
46 <view class="t-c margin-auto rel" bindtap="go_order" data-url="/pages/user/order_list/order_list?type=4"> 46 <view class="t-c margin-auto rel" bindtap="go_order" data-url="/pages/user/order_list/order_list?type=4">
47 - <image mode="heightFix" wx:if="{{object.is_icon}}" class="xc-no-money" src="{{iurl}}/miniapp/images/dpr1.png"></image> 47 + <image mode="heightFix" wx:if="{{object.is_icon}}" class="xc-no-money" src="{{item.src}}"></image>
48 <view class="xc-word-color four-level-word">待评论</view> 48 <view class="xc-word-color four-level-word">待评论</view>
49 <text class="order-num" hidden='{{toji.wait_pj>0?"":"true"}}'>{{toji.wait_pj}}</text> 49 <text class="order-num" hidden='{{toji.wait_pj>0?"":"true"}}'>{{toji.wait_pj}}</text>
50 </view> 50 </view>
@@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
52 </block> 52 </block>
53 <block wx:if="{{item.name=='售后/退款'}}"> 53 <block wx:if="{{item.name=='售后/退款'}}">
54 <view class="t-c margin-auto rel" style='margin-left:30rpx;' bindtap="go_order" data-url="/packageF/pages/user/return_goods_list/return_goods_list"> 54 <view class="t-c margin-auto rel" style='margin-left:30rpx;' bindtap="go_order" data-url="/packageF/pages/user/return_goods_list/return_goods_list">
55 - <image mode="heightFix" wx:if="{{object.is_icon}}" class="xc-no-money" src="{{iurl}}/miniapp/images/shouh1.png"></image> 55 + <image mode="heightFix" wx:if="{{object.is_icon}}" class="xc-no-money" src="{{item.src}}"></image>
56 <view style='height:36rpx;'> </view> 56 <view style='height:36rpx;'> </view>
57 <view class="xc-word-color four-level-word abs">售后/退款</view> 57 <view class="xc-word-color four-level-word abs">售后/退款</view>
58 </view> 58 </view>
components/diy_user_order/diy_user_order.wxss
1 @import '../../app.wxss'; 1 @import '../../app.wxss';
2 .xc-after-sale { 2 .xc-after-sale {
3 width: 100%; 3 width: 100%;
4 - border-bottom: 10px solid #f2f2f2;  
5 } 4 }
6 .xc-after-sale-left { 5 .xc-after-sale-left {
7 width: 96%; 6 width: 96%;
@@ -10,7 +9,6 @@ @@ -10,7 +9,6 @@
10 margin-bottom: 25rpx; 9 margin-bottom: 25rpx;
11 } 10 }
12 11
13 -  
14 .xc-equity-title { 12 .xc-equity-title {
15 width: 100%; 13 width: 100%;
16 height: 79rpx; 14 height: 79rpx;
components/diy_user_tools_services/diy_user_tools_services.js
@@ -14,18 +14,25 @@ Component({ @@ -14,18 +14,25 @@ Component({
14 type: Object, 14 type: Object,
15 value: null 15 value: null
16 }, 16 },
  17 + qy_data: {
  18 + type: Object,
  19 + value: null
  20 + },
17 // 这里定义了innerText属性,属性值可以在组件使用时指定 21 // 这里定义了innerText属性,属性值可以在组件使用时指定
18 //-- 是不是初始化了 -- 22 //-- 是不是初始化了 --
19 is_dengji:{ 23 is_dengji:{
20 type:Number, 24 type:Number,
21 value:0 25 value:0
22 }, 26 },
23 -  
24 //-- 是不是有助力活动 -- 27 //-- 是不是有助力活动 --
25 is_assistance:{ 28 is_assistance:{
26 type:Number, 29 type:Number,
27 value:0 30 value:0
28 }, 31 },
  32 + enableMeiye:{
  33 + type:Number,
  34 + value:0
  35 + }
29 }, 36 },
30 37
31 data: { 38 data: {
components/diy_user_tools_services/diy_user_tools_services.wxml
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 </view> 26 </view>
27 </block> 27 </block>
28 <block wx:elif="{{item.name=='我的权益'}}"> 28 <block wx:elif="{{item.name=='我的权益'}}">
29 - <view class="item t-c" bindtap="go_qy" wx:if="{{qy_list!=null && is_init && gradeId}}"> 29 + <view class="item t-c" bindtap="go_qy" wx:if="{{qy_data && qy_data.qy_list!=null && qy_data.is_init && qy_data.gradeId}}">
30 <image wx:if="{{object.is_icon}}" class="xc-center-img" src="{{iurl+item.icoimg}}"></image> 30 <image wx:if="{{object.is_icon}}" class="xc-center-img" src="{{iurl+item.icoimg}}"></image>
31 <view class="fs26">我的权益</view> 31 <view class="fs26">我的权益</view>
32 </view> 32 </view>
packageG/pages/user_template/index.js
@@ -20,7 +20,13 @@ Page({ @@ -20,7 +20,13 @@ Page({
20 udata: {}, 20 udata: {},
21 21
22 is_assistance: 0, //助力活动 22 is_assistance: 0, //助力活动
23 - b_gift:null // 23 + b_gift:null, //生日礼包
  24 + toji: null, //统计相关
  25 +
  26 + userInfo:null,
  27 + enableMeiye:null,
  28 +
  29 + is_show_recommend:false,
24 }, 30 },
25 31
26 onLoad: function (e) { 32 onLoad: function (e) {
@@ -41,9 +47,12 @@ Page({ @@ -41,9 +47,12 @@ Page({
41 }) 47 })
42 } 48 }
43 49
44 - if (!getApp().globalData.userInfo) {  
45 - getApp().goto('/packageE/pages/togoin/togoin');  
46 - } 50 + //判断有没有登陆
  51 + setTimeout(() =>{
  52 + if (!getApp().globalData.userInfo) {
  53 + getApp().goto('/packageE/pages/togoin/togoin');
  54 + }
  55 + },1000)
47 56
48 }, 57 },
49 58
@@ -51,6 +60,23 @@ Page({ @@ -51,6 +60,23 @@ Page({
51 getApp().check_can_share(); 60 getApp().check_can_share();
52 var th = this; 61 var th = this;
53 62
  63 + if(!th.data.userInfo){
  64 + this.data.userInfo =getApp().globalData.userInfo;
  65 + }
  66 +
  67 + /*-----统计-----*/
  68 + getApp().request.get("/api/weshop/order/waitlist", {
  69 + isShowLoading: 0,
  70 + data: {
  71 + user_id: getApp().globalData.user_id,isdel:0
  72 + },
  73 + success: function (su) {
  74 + th.setData({
  75 + toji: su.data.data,
  76 + });
  77 + }
  78 + })
  79 +
54 /*-------系统是否开通等级卡,会员是等级卡-----*/ 80 /*-------系统是否开通等级卡,会员是等级卡-----*/
55 getApp().getConfig2(function (e) { 81 getApp().getConfig2(function (e) {
56 var t_swi = e.switch_list; 82 var t_swi = e.switch_list;
@@ -204,6 +230,7 @@ Page({ @@ -204,6 +230,7 @@ Page({
204 } 230 }
205 } 231 }
206 }) 232 })
  233 +
207 this.puls_user(); 234 this.puls_user();
208 this.getVison(); 235 this.getVison();
209 236
@@ -219,7 +246,6 @@ Page({ @@ -219,7 +246,6 @@ Page({
219 udata: data, 246 udata: data,
220 }); 247 });
221 } 248 }
222 -  
223 } 249 }
224 }) 250 })
225 251
@@ -262,6 +288,16 @@ Page({ @@ -262,6 +288,16 @@ Page({
262 } 288 }
263 }); 289 });
264 290
  291 +
  292 + // 判断是否开启美业
  293 + getApp().promiseGet('/api/weshop/store/getTabSys/' + os.stoid, {}).then(res => {
  294 + if (res.data.code == 0) {
  295 + th.setData({
  296 + enableMeiye: res.data.data.EnableMeiye,
  297 + });
  298 + };
  299 + });
  300 +
265 //判断一下是不是助力活动 301 //判断一下是不是助力活动
266 this.is_assistance(); 302 this.is_assistance();
267 //获取工具 303 //获取工具
@@ -269,10 +305,22 @@ Page({ @@ -269,10 +305,22 @@ Page({
269 //获取一下生日相关 305 //获取一下生日相关
270 this.birthday(); 306 this.birthday();
271 307
272 -  
273 //获取自定义模板 308 //获取自定义模板
274 await this.init_load(); 309 await this.init_load();
275 310
  311 + //自定义组件一定要等到页面加载完了,才来调用selectComponnent
  312 + setTimeout(function () {
  313 +
  314 + th.setData({ is_show_recommend:true })
  315 + if (getApp().globalData.user_id) getApp().requestCardNum(th);
  316 + var goods_list = th.selectComponent("#goods_recommend"); //组件的id
  317 +
  318 + if(goods_list){
  319 + goods_list.init();
  320 + goods_list.get_list();
  321 + }
  322 +
  323 + }, 1000)
276 324
277 }, 325 },
278 326
@@ -314,30 +362,34 @@ Page({ @@ -314,30 +362,34 @@ Page({
314 title: temp_data.page_title, 362 title: temp_data.page_title,
315 }); 363 });
316 var t_arr = JSON.parse(temp_data.json_str); 364 var t_arr = JSON.parse(temp_data.json_str);
317 - th.setData({ 365 +
  366 + let obj={
318 share_title: temp_data.page_title, 367 share_title: temp_data.page_title,
319 template_arr: t_arr, 368 template_arr: t_arr,
320 isTemplate: 1, 369 isTemplate: 1,
321 bgcolor_t: temp_data.bkcolor 370 bgcolor_t: temp_data.bkcolor
322 - }); 371 + };
  372 +
323 setTimeout(() => { 373 setTimeout(() => {
324 th.newGoodsGroup() 374 th.newGoodsGroup()
325 }, 1000) 375 }, 1000)
326 376
327 //---如果有设定顶部的颜色的时候-- 377 //---如果有设定顶部的颜色的时候--
328 if (temp_data.top_color && temp_data.top_color != 'null') { 378 if (temp_data.top_color && temp_data.top_color != 'null') {
329 -  
330 var top_w_color = "#ffffff"; 379 var top_w_color = "#ffffff";
331 - if (temp_data.top_word_color && temp_data.top_word_color == 'black') {  
332 - top_w_color = "#000000"; 380 + if (temp_data.top_word_color) {
  381 + top_w_color = temp_data.top_word_color
333 } 382 }
334 -  
335 wx.setNavigationBarColor({ 383 wx.setNavigationBarColor({
336 frontColor: top_w_color, // 必写项 384 frontColor: top_w_color, // 必写项
337 backgroundColor: temp_data.top_color, // 必写项 385 backgroundColor: temp_data.top_color, // 必写项
338 }) 386 })
  387 + obj.topwColor=top_w_color;
  388 + obj.topbgColor=temp_data.top_color;
339 } 389 }
340 390
  391 + th.setData(obj);
  392 +
341 } 393 }
342 }) 394 })
343 }, 395 },
packageG/pages/user_template/index.json
@@ -8,8 +8,12 @@ @@ -8,8 +8,12 @@
8 "diy_user_order":"/components/diy_user_order/diy_user_order", 8 "diy_user_order":"/components/diy_user_order/diy_user_order",
9 "diy_user_my_rights":"/components/diy_user_my_rights/diy_user_my_rights", 9 "diy_user_my_rights":"/components/diy_user_my_rights/diy_user_my_rights",
10 "diy_user_tools_services":"/components/diy_user_tools_services/diy_user_tools_services", 10 "diy_user_tools_services":"/components/diy_user_tools_services/diy_user_tools_services",
11 - "diy_user_my_rights": "/components/diy_user_my_rights/diy_user_my_rights" 11 + "diy_user_my_rights": "/components/diy_user_my_rights/diy_user_my_rights",
  12 + "com_top_nav": "/components/com_top_nav/com_top_nav",
  13 + "goods_recommend": "/components/goods_list/goods_list"
12 }, 14 },
13 "enablePullDownRefresh": false, 15 "enablePullDownRefresh": false,
14 - "onReachBottomDistance":300 16 + "onReachBottomDistance":300,
  17 + "navigationStyle": "custom",
  18 + "navigationBarTitleText": "会员中心"
15 } 19 }
16 \ No newline at end of file 20 \ No newline at end of file
packageG/pages/user_template/index.wxml
  1 +<com_top_nav title="会员中心" bcolor="{{topbgColor}}" color="{{topwColor}}"></com_top_nav>
1 <view class="container" style="background-color:{{bgcolor_t}}"> 2 <view class="container" style="background-color:{{bgcolor_t}}">
2 <block wx:for="{{template_arr}}" wx:key="{{index}}"> 3 <block wx:for="{{template_arr}}" wx:key="{{index}}">
3 <view> 4 <view>
@@ -17,7 +18,7 @@ @@ -17,7 +18,7 @@
17 </block> 18 </block>
18 <!-- 我的订单 --> 19 <!-- 我的订单 -->
19 <block wx:if="{{item.ename=='order'}}"> 20 <block wx:if="{{item.ename=='order'}}">
20 - <diy_user_order object="{{item.content}}"></diy_user_order> 21 + <diy_user_order object="{{item.content}}" toji="{{toji}}" ></diy_user_order>
21 </block> 22 </block>
22 <!-- 我的权益 --> 23 <!-- 我的权益 -->
23 <block wx:if="{{item.ename=='my_rights'}}"> 24 <block wx:if="{{item.ename=='my_rights'}}">
@@ -25,8 +26,8 @@ @@ -25,8 +26,8 @@
25 </block> 26 </block>
26 <!-- 工具与服务 --> 27 <!-- 工具与服务 -->
27 <block wx:if="{{item.ename=='tools_services'}}"> 28 <block wx:if="{{item.ename=='tools_services'}}">
28 - <diy_user_tools_services object="{{item.content}}" is_dengji="{{is_dengji}}"  
29 - f_user_tool="{{user_tool}}" c_list="{{c_list}}"></diy_user_tools_services> 29 + <diy_user_tools_services object="{{item.content}}" is_dengji="{{is_dengji}}" qy_data="{{qy_data}}"
  30 + enableMeiye="{{enableMeiye}}" f_user_tool="{{user_tool}}" c_list="{{c_list}}"></diy_user_tools_services>
30 </block> 31 </block>
31 32
32 </view> 33 </view>
@@ -49,4 +50,29 @@ @@ -49,4 +50,29 @@
49 </view> 50 </view>
50 </view> 51 </view>
51 </view> 52 </view>
52 -</block>  
53 \ No newline at end of file 53 \ No newline at end of file
  54 +</block>
  55 +
  56 +<!-- 显示商品 -->
  57 +<!-- 显示推荐 -->
  58 +<view style='width:100%;height:73rpx;' wx:if="{{is_show_recommend}}">
  59 + <view class="xc-recommend-goods flex-center">
  60 + <view class="circle xc-small">
  61 + </view>
  62 + <view class="circle xc-zhong">
  63 + </view>
  64 + <view class="circle xc-big">
  65 + </view>
  66 + <view class="three-level-word xc-recommend">为你推荐</view>
  67 + <view class="circle xc-big">
  68 + </view>
  69 + <view class="circle xc-zhong">
  70 + </view>
  71 + <view class="circle xc-small" style='margin-left:15rpx;'>
  72 + <!-- </view> -->
  73 + </view>
  74 + </view>
  75 +</view>
  76 +<!-- 好物推荐 -->
  77 +<block wx:if="{{is_show_recommend}}">
  78 + <goods_recommend id="goods_recommend"></goods_recommend>
  79 +</block>
packageG/pages/user_template/index.wxss
@@ -909,4 +909,32 @@ @@ -909,4 +909,32 @@
909 height: 250rpx; 909 height: 250rpx;
910 padding-bottom:30rpx; 910 padding-bottom:30rpx;
911 } 911 }
912 -.container{ overflow: hidden;}  
913 \ No newline at end of file 912 \ No newline at end of file
  913 +.container{ overflow: hidden;}
  914 +
  915 +.xc-recommend-goods {
  916 + width: 100%;
  917 + height: 73rpx;
  918 + margin: auto;
  919 +}
  920 +
  921 +.xc-small {
  922 + width: 10rpx;
  923 + height: 10rpx;
  924 + background: #ff5f80;
  925 + margin-top: 6rpx;
  926 +}
  927 +
  928 +.xc-zhong {
  929 + width: 15rpx;
  930 + height: 15rpx;
  931 + background: #ff5f80;
  932 + margin-left: 12rpx;
  933 + margin-top: 2rpx;
  934 +}
  935 +
  936 +.xc-big {
  937 + width: 17rpx;
  938 + height: 17rpx;
  939 + background: #ff5f80;
  940 + margin-left: 15rpx;
  941 +}
914 \ No newline at end of file 942 \ No newline at end of file