diff --git a/alipay/app.js b/alipay/app.js index 63e19ff24..96d26b5fa 100755 --- a/alipay/app.js +++ b/alipay/app.js @@ -47,7 +47,7 @@ App({ // 请求地址 request_url: "https://demo.shopxo.net/", - //request_url: 'http://localhost/project/shopxo/service/', + request_url: 'http://localhost/project/shopxo/service/', // 基础信息 application_title: "ShopXO电商系统", diff --git a/alipay/app.json b/alipay/app.json index c851a018e..e64e758f1 100755 --- a/alipay/app.json +++ b/alipay/app.json @@ -1,9 +1,9 @@ { - "pages": [ + "pages": ["pages/user/user", "pages/index/index", "pages/goods-category/goods-category", "pages/cart/cart", - "pages/user/user", + "pages/web-view/web-view", "pages/login/login", "pages/paytips/paytips", diff --git a/alipay/images/user-index-nav-order-icon-1.png b/alipay/images/user-index-nav-order-icon-1.png new file mode 100644 index 000000000..b17897383 Binary files /dev/null and b/alipay/images/user-index-nav-order-icon-1.png differ diff --git a/alipay/images/user-index-nav-order-icon-2.png b/alipay/images/user-index-nav-order-icon-2.png new file mode 100644 index 000000000..fb20b6866 Binary files /dev/null and b/alipay/images/user-index-nav-order-icon-2.png differ diff --git a/alipay/images/user-index-nav-order-icon-3.png b/alipay/images/user-index-nav-order-icon-3.png new file mode 100644 index 000000000..61483e02c Binary files /dev/null and b/alipay/images/user-index-nav-order-icon-3.png differ diff --git a/alipay/images/user-index-nav-order-icon-4.png b/alipay/images/user-index-nav-order-icon-4.png new file mode 100644 index 000000000..db15f17c0 Binary files /dev/null and b/alipay/images/user-index-nav-order-icon-4.png differ diff --git a/alipay/images/user-nav-booking-order-icon.png b/alipay/images/user-nav-booking-order-icon.png deleted file mode 100755 index 90daa4b97..000000000 Binary files a/alipay/images/user-nav-booking-order-icon.png and /dev/null differ diff --git a/alipay/images/user-nav-order-icon.png b/alipay/images/user-nav-order-icon.png new file mode 100644 index 000000000..c0380d099 Binary files /dev/null and b/alipay/images/user-nav-order-icon.png differ diff --git a/alipay/pages/user-order/user-order.js b/alipay/pages/user-order/user-order.js index 4037a4c00..3133524f8 100755 --- a/alipay/pages/user-order/user-order.js +++ b/alipay/pages/user-order/user-order.js @@ -16,7 +16,7 @@ Page({ temp_pay_index: 0, nav_status_list: [ { name: "全部", value: "-1" }, - { name: "待付款", value: "0,1" }, + { name: "待付款", value: "1" }, { name: "待发货", value: "2" }, { name: "待收货", value: "3" }, { name: "已完成", value: "4" }, @@ -26,7 +26,21 @@ Page({ }, onLoad(params) { - this.setData({params: params}); + // 是否指定状态 + var nav_status_index = 0; + if ((params.status || null) != null) { + for (var i in this.data.nav_status_list) { + if (this.data.nav_status_list[i]['value'] == params.status) { + nav_status_index = i; + break; + } + } + } + + this.setData({ + params: params, + nav_status_index: nav_status_index, + }); this.init(); }, @@ -122,7 +136,6 @@ Page({ data_page: this.data.data_page + 1, load_status: 1, payment_list: res.data.data.payment_list || [], - nav_status_list: res.data.data.nav_status_list || [], }); // 是否还有数据 diff --git a/alipay/pages/user/user.acss b/alipay/pages/user/user.acss index 228ba097e..7051ddc29 100755 --- a/alipay/pages/user/user.acss +++ b/alipay/pages/user/user.acss @@ -3,7 +3,7 @@ padding: 30rpx 10rpx; font-size: 24rpx; } -.head-item .portrait{ +.head-item .avatar { width: 160rpx; height: 160rpx; border-radius: 50%; @@ -27,6 +27,7 @@ } .nav-box .nav-item .item-icon{ width: 40rpx; + height: 40rpx; vertical-align: middle; } .nav-box .nav-item .item-name{ @@ -35,4 +36,24 @@ .nav-box .nav-item .item-arrow{ width: 25rpx; } + +.items-list { + padding: 15rpx 0; +} +.items-list .items { + width: 25%; + position: relative; +} +.items-list .items .items-icon { + width: 60rpx; + height: 60rpx; + margin-bottom: 6rpx; +} +.items-list .items .am-badge { + position: absolute; + top: 0; + left: calc(50% + 30rpx); +} + + .user-notice { margin-top: 20rpx; padding: 0 10rpx 20rpx 10rpx; } \ No newline at end of file diff --git a/alipay/pages/user/user.axml b/alipay/pages/user/user.axml index 9fea06b53..bfaa5fa0c 100755 --- a/alipay/pages/user/user.axml +++ b/alipay/pages/user/user.axml @@ -1,17 +1,32 @@ - + {{nickname}} - + + + - - {{item.name}} + + {{item.name}} - + + + + + + + + + {{items.name}} + + + + + diff --git a/alipay/pages/user/user.js b/alipay/pages/user/user.js index 96794f7e4..430264cbc 100755 --- a/alipay/pages/user/user.js +++ b/alipay/pages/user/user.js @@ -8,20 +8,25 @@ Page({ agreement_url: '', customer_service_tel: null, common_user_center_notice: null, - + user_order_status_list: [ + { name: "待付款", status: 1, count: 0 }, + { name: "待发货", status: 2, count: 0 }, + { name: "待收货", status: 3, count: 0 }, + { name: "已完成", status: 4, count: 0 }, + ], lists: [ + { + url: "user-order", + icon: "user-nav-order-icon", + is_show: 1, + name: "我的订单", + }, { url: "user-address", icon: "user-nav-address-icon", is_show: 1, name: "我的地址" }, - { - url: "user-order", - icon: "user-nav-booking-order-icon", - is_show: 1, - name: "我的订单" - }, { url: "user-faovr", icon: "user-nav-faovr-icon", @@ -83,22 +88,28 @@ Page({ my.stopPullDownRefresh(); if (res.data.code == 0) { var data = res.data.data; + + // 订单数量处理 + var temp_user_order_status_list = this.data.user_order_status_list; + if ((data.user_order_status || null) != null && data.user_order_status.length > 0) { + for (var i in temp_user_order_status_list) { + for (var t in data.user_order_status) { + if (temp_user_order_status_list[i]['status'] == data.user_order_status[t]['status']) { + temp_user_order_status_list[i]['count'] = data.user_order_status[t]['count']; + break; + } + } + } + } + this.setData({ + user_order_status_list: temp_user_order_status_list, customer_service_tel: data.customer_service_tel || null, common_user_center_notice: data.common_user_center_notice || null, + avatar: (data.avatar != null) ? data.avatar : this.data.avatar, + nickname: (data.nickname != null) ? data.nickname : this.data.nickname, + integral: (data.integral != null) ? data.integral : this.data.integral, }); - if(data.avatar != null) - { - this.setData({avatar: data.avatar}); - } - if(data.nickname != null) - { - this.setData({nickname: data.nickname}); - } - if(data.integral != null) - { - this.setData({integral: data.integral}); - } } else { my.showToast({ type: "fail", diff --git a/alipay/pages/user/user.json b/alipay/pages/user/user.json index c96031fd7..40f099847 100755 --- a/alipay/pages/user/user.json +++ b/alipay/pages/user/user.json @@ -1,3 +1,6 @@ { - "pullRefresh": true + "pullRefresh": true, + "usingComponents": { + "badge": "mini-antui/es/badge/index" + } } \ No newline at end of file diff --git a/service/Application/Api/Controller/OrderController.class.php b/service/Application/Api/Controller/OrderController.class.php index a61b26bd6..1d5c184e1 100755 --- a/service/Application/Api/Controller/OrderController.class.php +++ b/service/Application/Api/Controller/OrderController.class.php @@ -68,23 +68,12 @@ class OrderController extends CommonController // 支付方式 $payment_list = ResourcesService::BuyPaymentList(['is_enable'=>1, 'is_open_user'=>1]); - // 导航状态列表 - $nav_status_list = [ - ['name'=>'全部', 'value'=>'-1'], - ['name'=>'待付款', 'value'=>'0,1'], - ['name'=>'待发货', 'value'=>'2'], - ['name'=>'待收货', 'value'=>'3'], - ['name'=>'已完成', 'value'=>'4'], - ['name'=>'已失效', 'value'=>'5,6'], - ]; - // 返回数据 $result = [ 'total' => $total, 'page_total' => $page_total, 'data' => $data['data'], 'payment_list' => $payment_list, - 'nav_status_list' => $nav_status_list, ]; $this->ajaxReturn(L('common_operation_success'), 0, $result); } diff --git a/service/Application/Api/Controller/UserController.class.php b/service/Application/Api/Controller/UserController.class.php index efd5970df..41b800bb2 100755 --- a/service/Application/Api/Controller/UserController.class.php +++ b/service/Application/Api/Controller/UserController.class.php @@ -2,6 +2,8 @@ namespace Api\Controller; +use Service\OrderService; + /** * 用户 * @author Devil @@ -235,6 +237,9 @@ class UserController extends CommonController // 登录校验 $this->Is_Login(); + // 用户订单状态 + $user_order_status = OrderService::OrderStatusStepTotal(['user_type'=>'user', 'user'=>$this->user, 'is_comments'=>1]); + // 初始化数据 $result = array( 'integral' => $this->user['integral'], @@ -243,6 +248,7 @@ class UserController extends CommonController 'username' => $this->user['username'], 'customer_service_tel' => MyC('common_customer_service_tel'), 'common_user_center_notice' => MyC('common_user_center_notice'), + 'user_order_status' => $user_order_status['data'], ); // 返回数据 diff --git a/service/Application/Service/OrderService.class.php b/service/Application/Service/OrderService.class.php index 43993bee9..da242bd69 100755 --- a/service/Application/Service/OrderService.class.php +++ b/service/Application/Service/OrderService.class.php @@ -1245,7 +1245,7 @@ class OrderService $order_status_list = L('common_order_user_status'); foreach(L('common_order_user_status') as $v) { - $result[$v['id']] = [ + $result[] = [ 'name' => $v['name'], 'status' => $v['id'], 'count' => 0, @@ -1255,15 +1255,17 @@ class OrderService // 数据处理 if(!empty($data)) { - - foreach($data as $v) + foreach($result as &$v) { - if(isset($result[$v['status']])) + foreach($data as $vs) { - $result[$v['status']]['count'] = $v['count']; + if($v['status'] == $vs['status']) + { + $v['count'] = $vs['count']; + continue; + } } } - sort($result); } // 待评价状态站位100