Ver Fonte

联合丽格V1.0.2

zhengjinyi há 2 anos atrás
pai
commit
c35ea40445

+ 1 - 1
src/main/resources/static/css/shopping/shopping.css

@@ -249,7 +249,7 @@ li{list-style:none}
     .model-address-content .content .list .list-defalut a{display:inline-block;height:24px;line-height:24px;vertical-align:top;margin-left:15px;color:#1890f9}
     .model-address-content .content .list .seclet{width:40px;height:40px;position:absolute;bottom:0;right:0;opacity:0}
     .model-address-content .content .list .seclet .icon{width:40px;height:40px;display:block}
-    .model-address-content .content .list .seclet .icon:before{width:40px;height:40px;background-position:-308px -453px}
+    .model-address-content .content .list .seclet .icon:before{width:40px;height:40px;background-position:-290px -457px;}
     .model-address-content .content .list.checked{border-color:#FF5B00}
     .model-address-content .content .list.checked .seclet{opacity:1}
     .model-address-content .button{width:100%;height:36px;float:left;box-sizing:border-box;padding:0 187px}

+ 56 - 29
src/main/resources/static/js/shopping/confirm.js

@@ -252,7 +252,7 @@ var shoppingConfirm = new Vue({
             })
         },
         getProvinceOptions(){ // 获取全部省份
-            var _self = this;
+            const _self = this;
             OrderApi.GetAddressSelect({},function(res){
                 if(res.code === 0 && res.data){
                     _self.provinceOptions =res.data;
@@ -262,7 +262,7 @@ var shoppingConfirm = new Vue({
             });
         },
         getCityOptions(parentId,callback){// 获取地区
-            var _self = this;
+            const _self = this;
             if(parentId && parentId>0){
                 _self.cityOptions = [];
                 _self.townOptions = [];
@@ -279,7 +279,7 @@ var shoppingConfirm = new Vue({
             }
         },
         getTownOptions(parentId, callback){
-            var _self = this;
+            const _self = this;
             if(parentId && parentId>0){
                 _self.townOptions = [];
                 _self.addressForm.townId = '';
@@ -293,19 +293,19 @@ var shoppingConfirm = new Vue({
                 })
             }
         },
-        showAddressBox: function(){// 显示地址弹窗
+        showAddressBox(){// 显示地址弹窗
             this.isShowAddressList = true;
             if(!isPC){fixedBody();}
         },
-        closeAddressBox: function(){// 关闭地址弹窗
+        closeAddressBox(){// 关闭地址弹窗
             this.isShowAddressList = false;
             if(!isPC){looseBody();}
         },
-        hideAddressForm: function(){// 隐藏地址表单
+        hideAddressForm(){// 隐藏地址表单
             this.isShowAddressForm = false;
             if(!isPC){looseBody();}
         },
-        createAddress: function(){// 新建地址
+        createAddress(){// 新建地址
             this.isShowAddressForm = true;
             this.addressForm.name= '';
             this.addressForm.mobile= '';
@@ -319,16 +319,16 @@ var shoppingConfirm = new Vue({
             this.getProvinceOptions();
             if(!isPC){fixedBody();}
         },
-        updateAddress: function(){// 更新选择地址
-            var _self = this;
-            _self.isShowAddressForm = true;
-            _self.addressForm.id = _self.address.id;
-            _self.addressForm.name = _self.address.name;
-            _self.addressForm.mobile = _self.address.mobile;
-            _self.addressForm.default = _self.address.default;
-            _self.addressForm.desc = _self.address.desc;
-            _self.addressForm.provinceId = _self.address.provinceId;
-            _self.getCityOptions(_self.address.provinceId, function(){
+        updateAddress(){// 更新选择地址
+            const _self = this;
+            this.isShowAddressForm = true;
+            this.addressForm.id = this.address.id;
+            this.addressForm.name = this.address.name;
+            this.addressForm.mobile = this.address.mobile;
+            this.addressForm.default = this.address.default;
+            this.addressForm.desc = _self.address.desc;
+            this.addressForm.provinceId = this.address.provinceId;
+            this.getCityOptions(_self.address.provinceId, function(){
                 _self.addressForm.cityId = _self.address.cityId;
                 _self.getTownOptions(_self.address.cityId,function(){
                     _self.addressForm.townId = _self.address.townId;
@@ -337,8 +337,8 @@ var shoppingConfirm = new Vue({
             if(!isPC){fixedBody();}
         },
         saveAddressForm(){// 更新保存地址
-            var _self = this;
-            var pass = verifyForm();
+            const _self = this;
+            const pass = verifyForm();
             if (_self.saveLoading) { return false; }
             this.$nextTick(function() {
                 if (!pass) {return false;}
@@ -362,21 +362,48 @@ var shoppingConfirm = new Vue({
             });
         },
         saveAddress(params){// 更新保存地址
-            var _self = this;
-            OrderApi.AddSaveAddress(params,function(r){
-                if(r.code === 0){
-                    CAIMEI.dialog('保存成功');
+            const _self = this;
+            OrderApi.AddSaveAddress(params,function(res){
+                if(res.code === 0){
                     _self.saveLoading = false;
-                    _self.isShowAddressForm = false;
+                    CAIMEI.dialog('保存成功');
+                    let data =  res.data
                     // 重新获取地址列表
                     _self.getAddressList(_self.userId,20);
+                    // 重新请求查询运费
+                    setTimeout(()=>{
+                        _self.confirmParam.addressId = data.addressId
+                        _self.productParam.townId = data.townId
+                        _self.cartParam.townId = data.townId
+                        _self.supportParm.townId = data.townId
+                        if(_self.urlType === 1) {//购物车提交
+                            _self.getCartCreateOrderInfo()
+                        }
+                        if(_self.urlType === 2) {//商品提交
+                            _self.getProductCreateOrderInfo()
+                        }
+                        if(this.urlType === 3) {//配套商品提交
+                            _self.OrderClubProductSupporting()
+                        }
+                        _self.address.townId = data.townId;
+                        _self.address.cityId = data.cityId;
+                        _self.address.provinceId = data.provinceId;
+                        _self.address.name = data.receiver;
+                        _self.address.mobile = data.mobile;
+                        _self.address.desc = data.address;
+                        _self.address.town = data.town;
+                        _self.address.city = data.city;
+                        _self.address.province = data.province;
+                        _self.address.default = (data.defaultFlag > 0);
+                    },500)
+                    _self.isShowAddressForm = false;
                 }else{
-                    CAIMEI.Alert(r.msg,'确定',false);
+                    CAIMEI.Alert(res.msg,'确定',false);
                 }
             });
         },
         setDefaultAddress(addressId){// 列表直接设为默认地址
-            var _self = this;
+            const _self = this;
             OrderApi.DefaultAddress({addressId:addressId,userId:_self.userId},function (r) {
                 if(r.code === 0 ){
                     // 重新获取地址列表
@@ -387,7 +414,7 @@ var shoppingConfirm = new Vue({
             });
         },
         deleteAddress(addressId){// 列表删除单个地址
-            var _self = this;
+            const _self = this;
             CAIMEI.Modal('确定要删除该地址?','取消','确定',function () {
                 OrderApi.DeleteAddress({addressId:addressId,userId:_self.userId},function (r) {
                     if(r.code === 0 ){
@@ -400,8 +427,8 @@ var shoppingConfirm = new Vue({
                 })
             });
         },
-        chooseAddress(selectedId){
-            this.address.selectedId = selectedId;
+        chooseAddress(address){//选择地址
+            this.address.selectedId = address.addressId
         },
         // 确认地址并重新查运费
         confirmAddress(){

+ 7 - 7
src/main/resources/templates/shopping/confirm.html

@@ -42,8 +42,8 @@
                     <div class="btnBox mfbt">
                         <span class="default"><i class="icon mIcon" v-if="address.default"></i><span v-if="address.default">默认地址</span><a v-if="addressList.length>0" href="javascript:void(0)" @click="updateAddress()">修改</a></span>
                         <div class="group">
-                            <a class="btn"  v-if="addressList.length>0" href="javascript:void(0)" @click="showAddressBox()">选择地址</a>
-                            <a class="btn con" :class="addressList.length>0 ? '' : 'none'"  href="javascript:void(0)" @click="createAddress()">新建地址</a>
+                            <a class="btn"  v-if="addressList.length>0" href="javascript:void(0)" @click="showAddressBox">选择地址</a>
+                            <a class="btn con" :class="addressList.length>0 ? '' : 'none'"  href="javascript:void(0)" @click="createAddress">新建地址</a>
                         </div>
                     </div>
                 </div>
@@ -86,8 +86,8 @@
                                 <label class="check"><input v-model="addressForm.default" name="default" type="checkbox">设为默认地址</label>
                             </p>
                             <p>
-                                <a class="btn save"  href="javascript:void(0)" @click="saveAddressForm()" :class="saveLoading ? 'disable':''">保存并使用</a>
-                                <a class="btn con"  href="javascript:void(0)" @click="hideAddressForm()">取消</a>
+                                <a class="btn save"  href="javascript:void(0)" @click="saveAddressForm" :class="saveLoading ? 'disable':''">保存并使用</a>
+                                <a class="btn con"  href="javascript:void(0)" @click="hideAddressForm">取消</a>
                             </p>
                         </div>
                     </div>
@@ -480,7 +480,7 @@
         <div class="model-content">
             <div v-if="isPC" class="title"><p>选择地址</p><i class="icon mIcon" @click="closeAddressBox()"></i></div>
             <div class="content">
-                <div class="list" v-for="(item, index) in addressList" @click="chooseAddress(item.addressId)" :class="address.selectedId==item.addressId ? 'checked' : ''">
+                <div class="list" v-for="(item, index) in addressList" @click="chooseAddress(item)" :class="address.selectedId==item.addressId ? 'checked' : ''">
                     <div class="list-left">
                         <p><span class="label">收货人:</span>{{ item.receiver }}</p>
                         <p><span class="label">联系方式:</span>{{ item.mobile }}</p>
@@ -500,8 +500,8 @@
                 </div>
             </div>
             <div class="button">
-                <a class="btn btn-confirm" href="javascript:void(0)"@click="confirmAddress()">确定</a>
-                <a class="btn btn-cancel" href="javascript:void(0)" @click="closeAddressBox()">取消</a>
+                <a class="btn btn-confirm" href="javascript:void(0)"@click="confirmAddress">确定</a>
+                <a class="btn btn-cancel" href="javascript:void(0)" @click="closeAddressBox">取消</a>
             </div>
         </div>
     </div>