zhengjinyi vor 4 Jahren
Ursprung
Commit
6e7bc90ecc

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

@@ -6,6 +6,7 @@ li{list-style:none}
  * PC端
  */
 @media screen and (min-width:768px){
+    .formLine .checked{top: 7px;}
     input[type="number"]{-moz-appearance:none;-webkit-appearance:none}
     input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none}
     .pageTitle{height:57px;line-height:57px;padding-top:16px}
@@ -48,7 +49,7 @@ li{list-style:none}
     .listWrap .c3{float:left;width:200px}
     .listWrap .c4{float:left;width:142px}
     .listWrap .c5{float:left;width:185px;position:relative}
-    .listWrap .c6{float:left;width:142px}
+    .listWrap .c6{float:left;width:122px}
     .listWrap .c7{float:right;width:118px}
     .listWrap .c10{float:left;width:495px}
     .listWrap .c11{float:left;width:480px;text-align:left}

+ 2 - 2
src/main/resources/static/js/base.js

@@ -129,9 +129,9 @@ var globalHead = new Vue({
         this.articleType = getUrlParam("type");
     },
     mounted:function(){
-        var userData =JSON.parse(window.localStorage.getItem('userInfo'));
+        var userData = JSON.parse(window.localStorage.getItem('userInfo'));
         if(userData!=null){
-            this.userIdentity = userData.userIdentity;
+            this.userIdentity = userData.identity;
             this.shopId = userData.shopId;
         }
     }

+ 38 - 10
src/main/resources/static/js/shopping/cart.js

@@ -26,6 +26,11 @@ var shoppingCart = new Vue({
             deep: true
         }
     },
+    filters: {
+        NumFormat: function (text) {//处理金额
+            return Number(text).toFixed(2);
+        }
+    },
     methods: {
         getCartLists: function () {
             var _self = this;
@@ -233,19 +238,42 @@ var shoppingCart = new Vue({
         },
         deleteCart: function(productIds){
             var _self = this;
-            alertInfo("确定要删除该商品?",function(){
-                // 删除逻辑
-                tokenAjax("post", "/shoppingCart/delete", {
-                    userID: _self.userId,
-                    productIDs: productIds
-                },function (res) {
-                    window.location.reload();
-                });
+            ShoppingApi.DeleteCartProducts({userID:_self.userId,productIDs:productIds},function(response){
+                if(response.code === 0){
+                    CAIMEI.dialog('删除成功',true,function () {
+                        _self.getCartLists();
+                    })
+                }else{
+                    CAIMEI.Alert(response.msg,'确定',true, function(){});
+                }
             })
         },
+        deletefailureList:function(){
+            var _self = this;
+            var delGoodsList='';
+            _self.invalidData.forEach(function(item){
+                delGoodsList+= item.productId+','
+            });
+            CAIMEI.Modal('确定清空全部失效商品吗?','取消','确定',function(){
+                _self.deleteCart(delGoodsList)
+            });
+        },
+        deleteCartOne:function(productIds){
+            var _self = this;
+            CAIMEI.Modal('确定删除该商品吗?','取消','确定',function(){
+                _self.deleteCart(productIds);
+            });
+        },
         deleteSelected: function(){
-            var productIds = this.submitIds.join(",");
-            this.deleteCart(productIds);
+            var _self = this;
+            var productIds = _self.submitIds.join(",");
+            if(productIds == ''){
+                CAIMEI.dialog('请选择要删除的商品~');
+                return false;
+            }
+            CAIMEI.Modal('确定删除选中的商品吗?','取消','确定',function(){
+                _self.deleteCart(productIds);
+            });
         },
         submitCart: function(){
             if (this.submitIds.length>0){

+ 43 - 49
src/main/resources/static/js/shopping/confirm.js

@@ -61,6 +61,7 @@ var shoppingConfirm = new Vue({
             freePostFlag:-1      // 0包邮 -1到付 1 有运费
         },
         invoice: {
+            id:'',
             type: 0,
             invoiceTitleType: 0, //发票抬头类型 1企业 0个人
             invoiceTitle: '',    //单位名称
@@ -107,6 +108,7 @@ var shoppingConfirm = new Vue({
                     _self.balance.userMoney = r.data.userMoney;
                     _self.balance.originUserMoney = r.data.userMoney;
                     _self.payInfo.orderShouldPayFee = r.data.totalPrice;
+                    _self.invoice =  r.data.invoice;
                     _self.getAddressList(_self.userId,20);
                 }else{
                     CAIMEI.Alert(r.msg, '确定', false);
@@ -222,6 +224,13 @@ var shoppingConfirm = new Vue({
         },
         createAddress: function(){
             this.isShowAddressForm = true;
+            this.addressForm.name= '';
+            this.addressForm.mobile= '';
+            this.addressForm.townId= '';
+            this.addressForm.cityId= '';
+            this.addressForm.provinceId= '';
+            this.addressForm.desc= '';
+            this.addressForm.default= '';
             if(!isPC){fixedBody();}
         },
         updateAddress: function(){
@@ -411,63 +420,48 @@ var shoppingConfirm = new Vue({
                     CAIMEI.dialog('请输入银行账号');return false;
                 }
             }
-            var params = {
-                cartType: this.type,
-                orderSource: 1,            // 购买类型:(1购物车提交[对应表cm_cart],2直接购买提交, 3协销下单)
-                serviceProviderId: '',     // 协销ID(小程序忽略)
-                clubUserId: this.userId,   // 机构用户ID
-                addressId: this.address.id,// 地址ID
-                orderInfo: [],             // 商品信息
-                payInfo: {},               // 订单信息
-                orderInvoice: {}           // 发票信息
-            };
             // 发票信息
             if(this.invoice.type*1 === 0){
-                params.orderInvoice =  {type: 0};
+                this.invoice = Object.assign(this.invoice,'',{type:0});
             }else if(this.invoice.type*1 === 1){
-                params.orderInvoice = {
-                   type: 1,  // 普通发票
-                   invoiceContent: '商品明细',
-                   invoiceTitleType: this.invoice.invoiceTitleType, //发票抬头类型 1企业 0个人
-                   invoiceTitle: this.invoice.invoiceTitle,         //发票抬头
-                   corporationTaxNum: this.invoice.corporationTaxNum//纳税人识别号
-                }
+                this.invoice = Object.assign(this.invoice,'',{type:1, invoiceContent: '商品明细'});
             }else if(this.invoice.type*1 === 2){
-                params.orderInvoice = {
-                   type: 2,  // 增值税发票
-                   invoiceTitle: this.invoice.invoiceTitle,          //单位名称
-                   corporationTaxNum: this.invoice.corporationTaxNum,//纳税人识别号
-                   registeredAddress: this.invoice.registeredAddress,//单位地址
-                   registeredPhone: this.invoice.registeredPhone,    //注册电话
-                   openBank: this.invoice.openBank,                  //开户银行
-                   bankAccountNo: this.invoice.bankAccountNo         //银行账号
-                }
+                this.invoice = Object.assign(this.invoice,'',{type:2});
             }
             //商品信息
-            params.orderInfo = this.listData.map(function(supplier){
-                var productInfo = [];
-                supplier.cartList.forEach(function(item){
-                    productInfo.push({
-                        productId:item.productId,
-                        productNum:item.number,
-                        presentNum:0,
-                        productType:item.productType
-                    })
+            var _orderInfo = this.listData.map(function(supplier){
+                    var productInfo = [];
+                    supplier.cartList.forEach(function(item){
+                        productInfo.push({
+                            productId:item.productId,
+                            productNum:item.number,
+                            presentNum:0,
+                            productType:item.productType
+                        })
+                    });
+                    return {
+                        shopId: supplier.id,
+                        note: supplier.note ? supplier.note : '',
+                        productInfo: productInfo
+                    }
                 });
-                return {
-                    shopId: supplier.id,
-                    note: supplier.note ? supplier.note : '',
-                    productInfo: productInfo
-                }
-            });
-            params.payInfo = {
-                clauseId: 0,
-                orderShouldPayFee: toFloat(this.payInfo.orderShouldPayFee),
-                balancePayFlag: this.payInfo.balancePayFlag,
-                freight: toFloat(this.payInfo.freight),
-                freePostFlag: this.payInfo.freePostFlag
+            var _payInfo = {
+                    clauseId: 0,
+                    orderShouldPayFee: toFloat(this.payInfo.orderShouldPayFee),
+                    balancePayFlag: this.payInfo.balancePayFlag,
+                    freight: toFloat(this.payInfo.freight),
+                    freePostFlag: this.payInfo.freePostFlag
+                };
+            var params = {
+                    cartType: this.type,
+                    orderSource: 1,            // 购买类型:(1购物车提交[对应表cm_cart],2直接购买提交, 3协销下单)
+                    serviceProviderId: '',     // 协销ID(小程序忽略)
+                    clubUserId: this.userId,   // 机构用户ID
+                    addressId: this.address.id,// 地址ID
+                    orderInfo: _orderInfo,             // 商品信息
+                    payInfo: _payInfo,               // 订单信息
+                    orderInvoice: this.invoice           // 发票信息
             };
-            console.log(params);
             this.submitLoading = true;
             OrderApi.ConfirmOrder({'params':JSON.stringify(params)},function (r) {
                 if(r.code === 0){

+ 1 - 1
src/main/resources/templates/index.html

@@ -83,7 +83,7 @@
                                                 <em>¥会员可见</em>
                                                 <span class="listTag" v-if="p.actStatus==1">{{p.promotions.name}}</span>
                                                 <div class="btnBox">
-                                                    <a href="/upgrade.html" class="btn">升级会员查看价格</a>
+                                                    <a href="/user/setting/upgrade.html" class="btn">升级会员查看价格</a>
                                                 </div>
                                             </template>
                                             <template v-else>

+ 1 - 1
src/main/resources/templates/product/detail.html

@@ -148,7 +148,7 @@
                 </div>
                <template v-if="GLOBAL_USER_ID && GLOBAL_USER_ID>0">
                    <div  class="btnBox" v-if="priceObj.priceFlag==2 && userIdentity!=2">
-                      <a class="upgrade" href="/upgrade.html">升级会员查看价格</a>
+                      <a class="upgrade" href="/user/setting/upgrade.html">升级会员查看价格</a>
                    </div>
                     <div class="btnBox" v-else-if="priceObj.priceFlag==0 || (priceObj.priceFlag==2 && userIdentity==2)">
                         <a href="javascript:void(0);" class="cart icon" @click='addShopCart()'>加入购物车</a>

+ 1 - 1
src/main/resources/templates/product/list.html

@@ -126,7 +126,7 @@
                                     <em>¥会员可见</em>
                                     <span class="listTag" v-if="p.actStatus==1">{{p.promotions.name}}</span>
                                     <div class="btnBox">
-                                        <a href="/upgrade.html" class="btn">升级会员查看价格</a>
+                                        <a href="/user/setting/upgrade.html" class="btn">升级会员查看价格</a>
                                     </div>
                                 </template>
                                 <template v-else>

+ 1 - 1
src/main/resources/templates/product/promotions.html

@@ -60,7 +60,7 @@
                                     <em>¥会员可见</em>
                                     <span class="listTag" v-if="p.actStatus==1">{{p.promotions.name}}</span>
                                     <div class="btnBox">
-                                        <a href="/upgrade.html" class="btn">升级会员查看价格</a>
+                                        <a href="/user/setting/upgrade.html" class="btn">升级会员查看价格</a>
                                     </div>
                                 </template>
                                 <template v-else>

+ 6 - 5
src/main/resources/templates/shopping/cart.html

@@ -150,16 +150,16 @@
                         </span>
                         <input type="hidden" :value="cart.step">
                     </div>
-                    <div v-if="isPC" class="c6"><span v-text="'¥'+toFloat(cart.price*cart.number)"></span></div>
-                    <div v-if="isPC" class="c7"><span class="del" @click="deleteCart(cart.productId)">×<em class="tips">删除</em></span></div>
+                    <div v-if="isPC" class="c6"><span>¥{{ (cart.price*cart.number) | NumFormat}}</span></div>
+                    <div v-if="isPC" class="c7"><span class="del" @click="deleteCartOne(cart.productId)">×<em class="tips">删除</em></span></div>
                 </div>
                 <div class="supplierBtn">
-                    <span>合计:<em v-text="'¥'+toFloat(supplier.totalPrice)"></em></span>
+                    <span>合计:<em>¥{{ supplier.totalPrice | NumFormat}}</em></span>
                 </div>
             </div>
             <div class="invalidTit" v-if="invalidData.length>0">
                 <div class="tit">失效商品 <em v-text="invalidData.length"></em> 件</div>
-                <span class="delAll">清空失效商品</span>
+                <span class="delAll" @class="deletefailureList">清空失效商品</span>
             </div>
             <div class="supplierItem disable" v-for="cart in invalidData">
                 <div class="cartItem clear">
@@ -180,7 +180,7 @@
                         <em v-else-if="cart.status==7">库存不足</em>
                         <em v-else>商品已失效</em>
                     </div>
-                    <div v-if="isPC" class="c6"><span class="del">×<em class="tips">删除</em></span></div>
+                    <div v-if="isPC" class="c6"><span class="del" @click="deleteCartOne(cart.productId)">×<em class="tips">删除</em></span></div>
                 </div>
             </div>
         </div>
@@ -207,6 +207,7 @@
 <!-- 引入底部 -->
 <template th:replace="components/footer"></template>
 <template th:replace="components/foot-link"></template>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/shopping.service.js(v=${version})}"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/shopping/cart.js(v=${version})}"></script>
 </body>
 </html>

+ 0 - 20
src/main/resources/templates/user-center/order/detail.html

@@ -90,16 +90,6 @@
                                                     <em v-if="shop.shopPromotion.mode==3">{{shop.shopPromotion.name+',满 ¥'+toFloat(shop.shopPromotion.touchPrice)+' 赠送商品'}}</em>
                                                 </p>
                                                 <p>促销时间:<em v-if="shop.shopPromotion.status==1">不限时</em><em v-else>{{shop.shopPromotion.beginTime.substr(0,10)+' ~ '+shop.shopPromotion.endTime.substr(0,10)}}</em></p>
-                                                <template v-if="shop.shopPromotion.mode==3">
-                                                    <p>赠品:</p>
-                                                    <p>
-                                                        <span v-for="g in shop.shopPromotion.giftList" class="p">
-                                                            <img :src="g.image">
-                                                            <span v-text="g.name"></span>
-                                                            <span v-text="'× '+g.number"></span>
-                                                        </span>
-                                                    </p>
-                                                </template>
                                                 <p class="c"><a class="close" @click="hideThisLadder($event)" href="JavaScript:void(0);">了解</a></p>
                                             </div>
                                         </div>
@@ -133,16 +123,6 @@
                                                                     <em v-if="pros.productPromotion.mode==3">{{pros.productPromotion.name+',满 ¥'+toFloat(pros.productPromotion.touchPrice)+' 赠送商品'}}</em>
                                                                 </p>
                                                                 <p>促销时间:<em v-if="pros.productPromotion.status==1">不限时</em><em v-else>{{pros.productPromotion.beginTime.substr(0,10)+' ~ '+pros.productPromotion.endTime.substr(0,10)}}</em></p>
-                                                                <template v-if="pros.productPromotion.mode==3">
-                                                                    <p>赠品:</p>
-                                                                    <p>
-                                                                        <span v-for="g in pros.productPromotion.giftList" class="p">
-                                                                            <img :src="g.image">
-                                                                            <span v-text="g.name"></span>
-                                                                            <span v-text="'× '+g.number"></span>
-                                                                        </span>
-                                                                    </p>
-                                                                </template>
                                                                 <p class="c"><a class="close" @click="hideThisLadder($event)" href="JavaScript:void(0);">了解</a></p>
                                                             </div>
                                                         </div>