Mike 9 лет назад
Родитель
Сommit
708ebbd483

+ 1 - 1
wl/config.xml

xqd
@@ -61,5 +61,5 @@
   <plugin name="cordova-plugin-camera" version="2.2.0" />
   <plugin name="cordova-plugin-compat" version="1.0.0" />
   <plugin name="cordova-plugin-alipay" version="1.0.0" />
-  
+  <plugin name="cordova-plugin-appversion" version="1.0.0" />
 </widget>

+ 2 - 2
wl/www/css/style.css

xqd
@@ -29,10 +29,10 @@
 .list-set-arrow .item-arrow-no, .item-arrow-no { background-image: none; padding-right: 15px; }
 
 .item-arrow-no .badge { right: 15px; }
-.list-user-set .item.item-icon-left { padding: 12px 16px 12px 54px; border-color: #EEE; }
+.list-user-set .item.item-icon-left { padding: 22px 16px 22px 54px; border-color: #EEE; }
 .list-user-set .item.item-icon-left i img { margin-top: 6px; }
 .list-user-set.list-set-arrow .item, .list-user-set .item.item-set-arrow { padding-right: 30px; }
-.i-user-phone, .i-user-info, .i-user-message, .i-user-order, .i-user-passsword, .i-user-set,.i-user-car { background: no-repeat center/32px auto; width: 32px; height:32px; position: absolute; left: 11px; top: 6px; vertical-align: middle; }
+.i-user-phone, .i-user-info, .i-user-message, .i-user-order, .i-user-passsword, .i-user-set,.i-user-car { background: no-repeat center/32px auto; width: 32px; height:32px; position: absolute; left: 11px; top: 15px; vertical-align: middle; }
 .item-icon-left i img { width: 32px; height: 32px; margin-top: 10px; }
 
 .i-user-info { background-image: url(../img/icon/i_user_info.png) }

+ 33 - 1
wl/www/js/controllers/my.js

xqd xqd xqd xqd xqd xqd
@@ -1,5 +1,11 @@
 (function (app) {
-    app.controller('myCtrl', ["$scope","$state", function ($scope,$state) {
+    app.controller('myCtrl', ["$scope", "$state", 'userService', 'msg', function ($scope, $state, userService,msg) {
+        $scope.user = {};
+        userService.getUser().then(function (result) {
+            $scope.user = result.data.data;
+        }, function (erro) {
+            msg.error(erro.data.message);
+        });
         $scope.toProfile = function () {
             $state.go('wl.my_profile');
         }
@@ -40,6 +46,10 @@
             $scope.modal1.remove();
             $scope.modal2.remove();
         });
+        $scope.appversion = '1.0.0';
+        if (!!window.AppVersion) {
+            $scope.appversion = AppVersion.version;
+        }
     }]);
     app.controller('mySetPasswordCtrl', ['$scope', '$state', function ($scope,$state) {
         $scope.vm = {
@@ -180,6 +190,22 @@
         $scope.detail = function (item) {
             $state.go('wl.my_truck_add', {item:item});
         }
+        $scope.delete = function (item, $event) {
+            $event.stopPropagation();
+            msg.confirm('删除提示', '确定删除?').then(function (res) {
+                if (res) {
+                    msg.loading('删除中...');
+                    myService.deleteTruck(item.id).then(function (result) {
+                        msg.hide();
+                    }, function (erro) {
+                        msg.hide();
+                        msg.error(erro.data.message);
+                    })
+                } else {
+
+                }
+            });
+        }
         $scope.load(true);
     }]);
     app.controller('myTruckAddCtrl', ['$scope', 'myService', 'msg', '$state', '$stateParams', function ($scope, myService, msg, $state, $stateParams) {
@@ -218,6 +244,10 @@
                 msg.error(erro.data.message);
             });
         }
+        //上传图片
+        $scope.setPhoto = function () {
+
+        }
      
     }]);
     app.controller('myTruckDetailCtrl', ['$scope', function ($scope) {
@@ -240,6 +270,7 @@
                 var more = (result.data.data.length >= $scope.filter.pageSize);
                 $scope.filter.hasMore = more;
                 $scope.items = $scope.items.concat(result.data.data);
+                 
                 if (init) {
                     $scope.$broadcast('scroll.refreshComplete');
                 } else {
@@ -276,6 +307,7 @@
                 var more = (result.data.data.length >= $scope.filter.pageSize);
                 $scope.filter.hasMore = more;
                 $scope.items = $scope.items.concat(result.data.data);
+                debugger;
                 if (init) {
                     $scope.$broadcast('scroll.refreshComplete');
                 } else {

+ 8 - 1
wl/www/js/filters/filter.js

xqd
@@ -31,7 +31,14 @@
             return input;
         };
     });
-
+    module.filter('truckPhoto', function () {
+        return function (input) {
+            if (!input || input.length === 0) {
+                return "img/demo/defaultcar.png";
+            }
+            return input;
+        };
+    });
     module.filter('shortAddress', function () {
         return function (input) {
             if (!input) return input;

+ 1 - 1
wl/www/js/services/carservice.js

xqd
@@ -11,7 +11,7 @@
             },
             //车源列表
             listCars: function (model) {
-                var condition = util.format("?include=user&type={0}&begin_address={1}&end_address={2}&midway_address={3}&page={4}"
+                var condition = util.format("?include=user,truck&type={0}&begin_address={1}&end_address={2}&midway_address={3}&page={4}"
                   , model.type, model.begin_address ? model.begin_address : '', model.end_address ? model.end_address : '', model.midway_address ? model.midway_address : '', model.pageIndex);
                 return $http({
                     url: config.server + 'api/messages/search' + condition,

+ 9 - 3
wl/www/js/services/myservice.js

xqd xqd
@@ -4,7 +4,7 @@
             //我的车辆信息
             listTrucks: function (model) {
                 return $http({
-                    url: config.server + 'api/user/trucks',
+                    url: config.server + 'api/user/trucks?page='+model.page,
                     method: "get"
                 })
             },
@@ -16,15 +16,21 @@
                     data: model
                 })
             },
+            deleteTruck:function (id) {
+                return $http({
+                    url: config.server + 'api/trucks/' + id,
+                    method: "delete"
+                })
+            },
             listMessages: function () {
                 return $http({
                     url: config.server + 'api/user/messages',
                     method: "get"
                 })
             },
-            listOrders: function () {
+            listOrders: function (filter) {
                 return $http({
-                    url: config.server + 'api/user/orders?include=user&?include=message',
+                    url: config.server + 'api/user/orders?include=message&page=' + filter.page,
                     method: "get"
                 })
             }

+ 6 - 0
wl/www/js/services/userservice.js

xqd
@@ -27,6 +27,12 @@
                 //    // reject('654878');
                 //});
             },
+            getUser:function () {
+                return $http({
+                    url: config.server + 'api/user',
+                    method: "get"
+                })
+            },
             isLogin: function () {
                 return !util.empty(data.get("token")) && data.getObject("user");
             },

+ 5 - 1
wl/www/templates/car/detail.html

xqd xqd
@@ -1,4 +1,4 @@
-<ion-view view-title="源信息">
+<ion-view view-title="源信息">
     <ion-content>
         <div class="list">
             <div class="list card">
@@ -12,6 +12,10 @@
                     <p>出发地:{{vm.begin_address | fullAddress}}</p>
                     <p>途经:{{vm.midway_address | fullAddress}}</p>
                     <p>目的地:{{vm.end_address | fullAddress}}</p>
+                    <p>车名:{{vm.truck.data.name}}</p>
+                    <p>车类型:{{vm.truck.data.type}}</p>
+                    <p>车牌:{{vm.truck.data.truck_no}}</p>
+                    <p>载重:{{vm.truck.data.load_weight}}</p>
                     <p>
                         {{vm.detail}}
                     </p>

+ 1 - 1
wl/www/templates/home/index.html

xqd
@@ -62,7 +62,7 @@
         </div>
         <div class="list" ng-if="vm.showIndex==2">
             <a class="item item-thumbnail-left" ng-repeat="item in cars" ng-click="detail(item)">
-                <img src="img/demo/defaultcar.png" />
+                <img ng-src="{{item.truck.data.photo | truckPhoto}}" />
                 <h2 style="white-space:normal">【{{item.begin_address | shortAddress}}】-【{{item.end_address | shortAddress}}】<span style="color:gray;">({{item.title}})</span></h2>
                 <p><span style="float:left"><b style="color:orangered">¥{{item.price}}</b><em style="padding-left:3px;font-size:0.75em">起</em></span></p>
                 <p><span style="float:left">联系人:{{item.contact_name}}</span> <span style="float:right">电话:{{item.contact_phone}}</span></p>

+ 6 - 6
wl/www/templates/my/index.html

xqd
@@ -2,17 +2,17 @@
     <ion-content class="app-content app-user-content">
         <div class="user-box">
             <a  class="user-photo">
-              <img ng-src="img/photo_default_turquoise.jpg"  />
+              <img ng-src="{{user.avatar | avator}}"  />
             </a>
             
             <div class="user-info" ng-click="toProfile()">
-                <a >  <p><span>酉水东流</span></p>  </a>
+                <a >  <p><span>{{user.phone}}</span></p>  </a>
             </div>
             <div class="msg-user">
-                <a class="msg-item"><b>¥20,000</b><span>我的余额</span></a>
-                <a class="msg-item"><b>3辆</b><span>我的车辆</span></a>
-                <a class="msg-item"><b>10条</b><span>我的发布</span></a>
-                <a class="msg-item"><b>5笔</b><span>我的订单</span></a>
+                <a class="msg-item"><b style="color:red">¥{{user.money_balance}}</b><span>我的余额</span></a>
+                <a class="msg-item"><b>{{user.trucks_count}}辆</b><span>我的车辆</span></a>
+                <a class="msg-item"><b>{{user.messages_count}}条</b><span>我的发布</span></a>
+                <a class="msg-item"><b>{{user.orders_count}}笔</b><span>我的订单</span></a>
             </div>
         </div>
         <div class="list list-user-set list-set-arrow">

+ 11 - 6
wl/www/templates/my/message-detail.html

xqd
@@ -3,17 +3,22 @@
         <div class="list">
             <div class="list card">
                 <div class="item item-avatar">
-                    <img src="img/photo_default_turquoise.jpg" />
-                    <h2>{{vm.contact_name}}、{{vm.contact_phone}}</h2>
-                    <p>价格:<b style="color:red">¥{{vm.begin_address}}</b></p>
+                    <img ng-src="{{user.data.avatar | avator}}" />
+                    <h2 style="white-space:normal">【{{vm.begin_address | shortAddress}}】-【{{vm.end_address | shortAddress}}】的货源信息</h2>
+                    <p>价格:<b style="color:red">¥{{vm.price}}</b></p>
                 </div>
                 <div class="item item-body">
-                    <p style="font-weight:bold">从{{vm.begin_address}}到{{vm.end_address}},途径{{vm.midway_address}}</p>
+                    <p>出发地:{{vm.begin_address | fullAddress}}</p>
+                    <p>途经:{{vm.midway_address | fullAddress}}</p>
+                    <p>目的地:{{vm.end_address | fullAddress}}</p>
+                    <p>货物名称:{{vm.title}}</p>
+                    <p>联系人:{{vm.contact_name}}</p>
+                    <p>联系电话:{{vm.contact_phone}}</p>
                     <p>
                         {{vm.detail}}
                     </p>
-                    <p>
-                        {{vm.created_at}}
+                    <p style="color:red">
+                        有效期:{{vm.created_at}}
                     </p>
                 </div>
             </div>

+ 17 - 4
wl/www/templates/my/message.html

xqd
@@ -3,10 +3,23 @@
         <!--下拉刷新-->
         <ion-refresher pulling-text="下拉刷新" on-refresh="load(true)">
         </ion-refresher>
-        <div class="list">
-            <a class="item" ng-repeat="item in items" ng-click="detail(item)">
-                标题{{item.title}},时间{{item.created_at}}
-            </a>
+        <div class="list" >
+            <div ng-repeat="item in items">
+                <a class="item" ng-if="item.type==1" ng-click="detail(item)">
+                    <h2>【{{item.begin_address | shortAddress}}】-【{{item.end_address | shortAddress}}】</h2>
+                    <p>
+                        <span style="float:left"><b style="color:orangered">¥{{item.price}}</b><em style="padding-left:3px;font-size:0.75em">起</em></span>
+                        <span style="float:right">途经:{{item.midway_address | shortAddress}}</span>
+                    </p>
+                    <p><span style="float:left">联系人:{{item.contact_name}}</span> <span style="float:right">电话:{{item.contact_phone}}</span></p>
+                </a>
+                <a class="item item-thumbnail-left" ng-if="item.type==2" ng-click="detail(item)">
+                    <img ng-src="{{item.truck.data.photo | truckPhoto}}" />
+                    <h2 style="white-space:normal">【{{item.begin_address | shortAddress}}】-【{{item.end_address | shortAddress}}】<span style="color:gray;">({{item.title}})</span></h2>
+                    <p><span style="float:left"><b style="color:orangered">¥{{item.price}}</b><em style="padding-left:3px;font-size:0.75em">起</em></span></p>
+                    <p><span style="float:left">联系人:{{item.contact_name}}</span> <span style="float:right">电话:{{item.contact_phone}}</span></p>
+                </a>
+            </div>
         </div>
         <!--上拉更多-->
         <ion-infinite-scroll ng-if="filter.hasMore" on-infinite="load(false)" distance="10%"></ion-infinite-scroll>

+ 2 - 2
wl/www/templates/my/setting.html

xqd xqd
@@ -7,7 +7,7 @@
             
             <div class="user-info">
                 <div><span style="color: #444;">掌上物流网</span></div>
-                <div><span style="color: #444;">版本V1.0.0</span></div>
+                <div><span style="color: #444;">版本V{{appversion}}</span></div>
             </div>
         </div>
         <div class="list">
@@ -17,7 +17,7 @@
             </label>
             <label class="item item-input " ng-click="openModal1()">
                 <span class="input-label">法律条文
-                </span></a>
+                </span> 
             </label>
         </div>
          <div class="padding">

+ 5 - 0
wl/www/templates/my/truck-add.html

xqd
@@ -4,6 +4,11 @@
             <div class="item item-divider">
                 您的车辆
             </div>
+            <a class="item item-avatar-right item-arrow-no" ng-click="setPhoto()">
+                <img ng-src="{{vm.photo | truckPhoto}}" />
+                <h2>上传照片</h2>
+                <p>图片</p>
+            </a>
             <a class="item item-input">
                 <span class="input-label">名称<span class="mustfill">*</span></span>
                 <input style="text-align:right" ng-model="vm.name" type="text" placeholder="名称">

+ 11 - 3
wl/www/templates/my/truck.html

xqd
@@ -11,11 +11,19 @@
         <ion-refresher pulling-text="下拉刷新" on-refresh="load(true)">
         </ion-refresher>
         <div class="list">
-            <a class="item"  ng-repeat="item in items" ng-click="detail(item)">
-             名称:{{item.name}},车牌:{{item.truck_no}}
-            </a>
+            <div class="item item-thumbnail-left" ng-repeat="item in items" ng-click="detail(item)">
+                <img ng-src="{{item.photo | truckPhoto}}">
+                <p>车牌号:{{item.truck_no}}</p>
+                <p>类型:{{item.type}}</p>
+                <p>车长:{{item.length}}(米)</p>
+                <p>载重:{{item.load_weight}}(吨)</p>
+                <button class="button button-stable" ng-click="delete(item,$event)" style="float:right;margin-top:-70px">
+                    删除
+                </button>
+            </div>
          </div>
         <!--上拉更多-->
         <ion-infinite-scroll ng-if="filter.hasMore" on-infinite="load(false)" distance="10%"></ion-infinite-scroll>
 </ion-content>
 </ion-view>
+