yangc 7 жил өмнө
parent
commit
f2da4e8e29

+ 44 - 0
components/mobile/base/RemindStr.vue

@@ -0,0 +1,44 @@
+<template>
+  <div class="mobile-modal" v-if="showRemind">
+    <div class="mobile-remind-modal">
+      <div class="mb-content">{{text}}</div>
+      <div class="mb-foot" @click="$emit('closeAction')">我知道了</div>
+    </div>
+  </div>
+</template>
+<script>
+  export default {
+    props: {
+      showRemind: {
+        type: Boolean,
+        default: false
+      },
+      text: {
+        type: String,
+        default: '提示'
+      }
+    }
+  }
+</script>
+<style lang="scss" scoped>
+  .mobile-remind-modal {
+    position: absolute;
+    top: 50%;
+    left: 50%;
+    width: 6.3rem;
+    margin-left: -3.15rem;
+    margin-top: -1.36rem;
+    background: #fff;
+    border-radius: .15rem;
+    font-size: .32rem;
+    .mb-content {
+      padding: .39rem .42rem .25rem;
+      border-bottom: 1px solid #f4f4f4;
+    }
+    .mb-foot {
+      padding: .27rem 0;
+      color: #3f84f6;
+      text-align: center;
+    }
+  }
+</style>

+ 3 - 2
components/mobile/base/index.js

@@ -5,6 +5,7 @@ import ModalWrapper from './ModalWrapper.vue'
 import BottomModalWrapper from './BottomModalWrapper.vue'
 import SelectAddress from './SelectAddress.vue'
 import AddressView from './addressView.vue'
-import AddressEdit from './addressEdit'
+import AddressEdit from './addressEdit.vue'
+import RemindStr from './RemindStr.vue'
 
-export { SearchHeader, SearchHeader2, LinkUser, ModalWrapper, BottomModalWrapper, SelectAddress, AddressView, AddressEdit }
+export { SearchHeader, SearchHeader2, LinkUser, ModalWrapper, BottomModalWrapper, SelectAddress, AddressView, AddressEdit, RemindStr }

+ 12 - 11
pages/mobile/center/user/cart.vue

@@ -25,7 +25,7 @@
                 </div>
                 <div class="inline-block params param-operate">
                   <p class="param text-ellipse"><span class="title">交期(天):</span>{{goods.goods.b2cMinDelivery + '-' + goods.goods.b2cMaxDelivery}}</p>
-                  <p class="param text-ellipse"><span class="title">单价:</span>{{baseUtils.getPriceByLevel(goods.goods.prices, goods.number, goods.currencyName)}}</p>
+                  <p class="param text-ellipse"><span class="title">单价:</span>{{baseUtils.getPriceByLevel(goods.goods.prices, goods.number, goods.currencyName) | priceFilter}}</p>
                   <p class="param text-ellipse"><span class="title">起拍:</span>{{goods.goods.minBuyQty}}</p>
                   <p class="param"><span class="title">数量(PCS):</span>
                     <span class="input-line inline-block">
@@ -39,7 +39,7 @@
                   </div>-->
                 </div>
               </div>
-              <div class="single-count text-ellipse"><span class="title">小计:</span><span class="ol-price"><span>{{goods.currencyName | currencyFilter}}</span>{{goods.goods.currentPrice}}</span></div>
+              <div class="single-count text-ellipse"><span class="title">小计:</span><span class="ol-price"><span>{{goods.currencyName | currencyFilter}}</span>{{goods.goods.currentPrice | priceFilter}}</span></div>
             </li>
           </ul>
         </li>
@@ -55,8 +55,8 @@
         </div>
         <div class="wrap-count line">
           <!--<i class="fare">不含运费</i>-->
-          <span class="title">合计:</span><span class="price"><span v-show="allCount > 0">{{allCurrency | currencyFilter}}</span>{{allPrice}}</span>
-          <button class="buy-btn" @click="submit">结算({{allCount}})</button>
+          <span class="title">合计:</span><span class="price"><span v-show="allCount > 0">{{allCurrency | currencyFilter}}</span>{{allPrice | priceFilter}}</span>
+          <button class="buy-btn" @click="submit">结算</button>
         </div>
       </div>
     </template>
@@ -302,8 +302,8 @@
             this.setRemindText(res.data.message)
           }
         }, err => {
-          console.log(err.response.data.data || '系统错误')
-          this.setRemindText(err.response.data.data || '系统错误')
+          console.log(err.response.data || '系统错误')
+          this.setRemindText(err.response.data || '系统错误')
         })
       },
       linkSaler (item) {
@@ -388,12 +388,13 @@
               font-size: .28rem;
               color: #666;
               text-align: right;
-              padding: 0 .21rem 0 .25rem;
+              padding: 0 .21rem 0 .72rem;
               .ol-price {
                 font-size: .26rem;
               }
               .title {
                 float: left;
+                font-size: .3rem;
               }
             }
             .params {
@@ -412,9 +413,9 @@
             .param-operate {
               width: 3.23rem;
               .input-line {
-                $group-height: .4rem;
+                $group-height: .5rem;
                 input {
-                  width: .91rem;
+                  width: .98rem;
                   height: $group-height;
                   border-top: 1px solid #ddd;
                   border-bottom: 1px solid #ddd;
@@ -429,7 +430,7 @@
                 span {
                   width: .35rem;
                   height: $group-height;
-                  line-height: .38rem;
+                  line-height: .48rem;
                   text-align: center;
                   border: 1px solid #ddd;
                   font-size: .24rem;
@@ -490,7 +491,7 @@
           font-size: .28rem;
           color: #fc2706;
           display: inline-block;
-          max-width: 1.6rem;
+          max-width: 3.6rem;
           overflow: hidden;
           text-overflow: ellipsis;
           white-space: nowrap;

+ 75 - 22
pages/mobile/center/user/pay/_orderId.vue

@@ -23,7 +23,7 @@
         </p>
         <div class="ps-goods-info"  @click="showDetailList(item.goods)">
           <ul class="ps-goods-list">
-            <li class="inline-block" v-for="goods in (item.$expand && item.goods.length > 3 ? item.goods : item.goods.slice(0, 3))">
+            <li class="inline-block" v-for="goods in (item.$expand ? item.goods : item.goods.slice(0, 3))">
               <div class="clearfix" style="padding: .31rem .25rem;">
                 <div class="fl">
                   <div class="ps-goods-item text-ellipse"><span>品牌:</span>{{goods.brName || '-'}}</div>
@@ -44,11 +44,13 @@
                   </div>
                 </div>
               </div>
-              <div class="single-count text-ellipse"><span class="pay-price-title inline-block">小计:</span><span class="ol-price"><span>{{goods.currencyName | currencyFilter}}</span>{{goods.goods.currentPrice}}</span></div>
+              <div class="single-count text-ellipse"><span class="pay-price-title inline-block">小计:</span><span class="ol-price"><span>{{goods.currencyName | currencyFilter}}</span>{{goods.goods.currentPrice | priceFilter}}</span></div>
             </li>
           </ul>
-          <div class="show-more-psgoods" v-if="item.goods.length > 3 && !item.$expand" @click="item.$expand = true">
-            查看更多 <i class="iconfont icon-arrow-down"></i>
+          <div class="show-more-psgoods" v-if="item.goods.length > 3" @click="item.$expand = !item.$expand">
+            {{item.$expand ? '收起' : '查看更多'}}
+            <i v-show="!item.$expand" class="iconfont icon-arrow-down"></i>
+            <i v-show="item.$expand" class="iconfont icon-arrow-up"></i>
           </div>
         </div>
        <!-- <div class="ps-operate-line" @click="showRuleSet(item.storeid)">
@@ -94,14 +96,14 @@
           <div class="text-ellipse">
              <span class="pay-price-title inline-block">手续费:</span><span class="ol-price"><span>{{payData.currency | currencyFilter}}</span>0.00</span>
             <!--(<span class="ol-price fare"><span>{{payData.currency | currencyFilter}}</span>{{getPoundage(item)}}</span>)-->
-            <span class="inline-block tag">减免</span>
+            <span class="inline-block tag" @click="showRemindStr = true">减免</span>
             <i class="fa fa-exclamation-circle"></i>
           </div>
         </div>
         <div class="ps-operate-line ps-price">
           <span class="pay-price-title inline-block">店铺合计:</span>
           <span class="ol-price"><span>{{payData.currency | currencyFilter}}</span>
-          {{item.goodsFarePrice || 0}}</span>
+          {{(item.goodsFarePrice || 0) | priceFilter}}</span>
         </div>
       </li>
     </ul>
@@ -148,7 +150,7 @@
     <div class="buy-wrap">
       <div class="fr">
         <span class="title">实付:</span><span class="ol-price price inline-block text-ellipse"><span>{{payData.currency | currencyFilter}}</span>
-        {{allPriceNew}}</span>
+        {{allPriceNew | priceFilter}}</span>
         <button class="buy-btn" @click="confirmOrder">提交订单</button>
       </div>
     </div>
@@ -261,7 +263,7 @@
     <!-- 选择发票弹框end -->
 
     <!-- 选择地址弹框start -->
-    <modal-wrapper :showModal="showAddrModal"
+   <!-- <modal-wrapper :showModal="showAddrModal"
                    :title="'收货地址'"
                    @closeAction="showAddrModal = false">
       <template v-if="!editAddr">
@@ -289,7 +291,39 @@
         </div>
       </template>
       <address-edit v-else="editAddr" :inFix="true" :data="currentAddress" :isPersonal="true" :isSend="false" @isEditEvent="editClick"></address-edit>
-    </modal-wrapper>
+    </modal-wrapper>-->
+    <div class="mobile-modal addr-modal" v-if="showAddrModal" @click="showAddrModal = false">
+      <div class="mobile-modal-box addr-modal-wrapper" @click="stopPropagation($event)">
+        <div class="mobile-modal-header">收货地址<i @click="showAddrModal = false" class="icon-guanbi iconfont"></i></div>
+        <div style="height: 100%;overflow-y: auto;background: #fff;padding-bottom: .3rem;">
+          <template v-if="!editAddr">
+            <div class="addr-list-wrap">
+              <ul class="addr-list">
+                <li v-for="(addr, index) in addressData" :class="{active: selectedAddressIndex === index}" @click="setAddressCheck(index)">
+                  <div class="info-wrap">
+                    <div class="info-line">
+                      <label class="mobile-cart-check" :class="{active: selectedAddressIndex === index}">
+                        <input type="checkbox">
+                      </label>
+                      <span class="name inline-block text-ellipse">{{addr.name}}</span>
+                      <span class="tel inline-block text-ellipse">{{addr.tel}}</span>
+                      <i class="inline-block" v-if="addr.num === 1">默认地址</i>
+                    </div>
+                    <p>{{addr.area + addr.detailAddress}}</p>
+                  </div>
+                  <div class="edit-addr-area">
+                    <a class="inline-block addr-btn" @click.stop="addAddress(addr)"><i class="iconfont icon-xinzeng"></i>编辑</a>
+                    <a class="inline-block addr-btn" @click.stop="deleteAddress(addr)"><i class="iconfont icon-lajitong"></i>删除</a>
+                  </div>
+                </li>
+              </ul>
+              <button class="add-addr-btn" @click="addAddress()"><i class="iconfont icon-add"></i>添加新地址</button>
+            </div>
+          </template>
+          <address-edit v-else="editAddr" :inFix="false" :data="currentAddress" :isPersonal="true" :isSend="false" @isEditEvent="editClick"></address-edit>
+        </div>
+      </div>
+    </div>
    <!-- <div v-if="showAddrModal" class="mobile-hover-pager">
       <template v-if="!editAddr">
         <div class="addr-list-wrap">
@@ -341,10 +375,14 @@
     <!-- 选择自提点弹框end -->
 
     <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
+    <remind-str :showRemind="showRemindStr"
+                :text="'手续费:是指第三方支付机构在交易过程中,按照一定的百分比进行收取的费用。手续费金额=订单金额 * 0.45%'"
+                @closeAction="showRemindStr = false"
+    ></remind-str>
   </div>
 </template>
 <script>
-  import { LinkUser, ModalWrapper, BottomModalWrapper, AddressEdit } from '~components/mobile/base'
+  import { LinkUser, ModalWrapper, BottomModalWrapper, AddressEdit, RemindStr } from '~components/mobile/base'
   import { RemindBox } from '~components/mobile/common'
   import { goodsPurchaseOperate } from '~utils/mixin'
   export default {
@@ -379,7 +417,8 @@
         // 正在修改自提点的店铺id
         currentTakeSelfStoreId: '',
         editAddr: false,
-        currentAddress: {}
+        currentAddress: {},
+        showRemindStr: false
       }
     },
     mixins: [goodsPurchaseOperate],
@@ -388,7 +427,8 @@
       ModalWrapper,
       RemindBox,
       BottomModalWrapper,
-      AddressEdit
+      AddressEdit,
+      RemindStr
     },
     fetch ({ store, params }) {
       return Promise.all([
@@ -460,7 +500,7 @@
       allPriceNew () {
         let allOrderPrice = 0
         this.orderData.forEach((item, index) => {
-          item.goodsPrice = this.getTotalPrice(item) // 总价
+          item.goodsPrice = this.baseUtils.priceFixed(this.getTotalPrice(item)) // 总价
           // 包含运费的价格
 //          item.goodsFarePrice = this.baseUtils.priceFixed(item.goodsPrice + (item.fare && item.fare.fare ? item.fare.fare : 0))
           item.goodsFarePrice = item.goodsPrice
@@ -543,7 +583,7 @@
         this.allOrderPrice = 0
         this.orderData.forEach(item => {
           item.fare = this.fareRule[item.storeid] && this.fareRule[item.storeid].length ? this.fareRule[item.storeid][0] : {}
-          item.goodsPrice = this.getTotalPrice(item) // 总价
+          item.goodsPrice = this.baseUtils.priceFixed(this.getTotalPrice(item)) // 总价
           // 包含运费的价格
 //          item.goodsFarePrice = this.baseUtils.priceFixed(item.goodsPrice + (item.fare && item.fare.fare ? item.fare.fare : 0))
           item.goodsFarePrice = item.goodsPrice
@@ -1018,6 +1058,7 @@
     }
     .pay-price-title {
       float: left;
+      font-size: .3rem;
     }
     .ps-operate-line {
       height: .89rem;
@@ -1090,23 +1131,26 @@
           text-align: right;
           color: #333;
           .ol-price {
-            font-size: .22rem;
+            font-size: .26rem;
             span {
-              font-size: .22rem;
+              font-size: .26rem;
             }
           }
+          .pay-price-title {
+            font-size: .26rem;
+          }
           .fare {
             text-decoration: line-through;
             color: #666!important;
           }
           i {
-            font-size: .28rem;
+            font-size: .38rem;
             color: #adacac;
           }
           .tag {
-            height: .25rem;
-            line-height: .25rem;
-            width: .48rem;
+            height: .35rem;
+            line-height: .35rem;
+            width: .58rem;
             font-size: .22rem;
             color: #fff;
             background: #15b262;
@@ -1115,7 +1159,7 @@
             margin-left: .14rem;
             margin-right: .06rem;
             position: relative;
-            top: -.02rem;
+            top: -.06rem;
           }
         }
       }
@@ -1179,7 +1223,7 @@
           }
           p {
             position: relative;
-            bottom: .06rem;
+            bottom: 0;
           }
           .inv-head {
             max-width: 4rem;
@@ -1466,4 +1510,13 @@
       }
     }
   }
+  .addr-modal {
+    .addr-modal-wrapper {
+      top: 1.5rem;
+      bottom: 1.5rem;
+      left: .2rem;
+      right: .2rem;
+      background: #fff;
+    }
+  }
 </style>

+ 14 - 10
pages/mobile/center/vendor/payCenter.vue

@@ -404,19 +404,23 @@
         this.filterRecord()
       },
       setDate (type) {
-        this.filterParams[type] = new Date(this.filterParams[type]).getTime() - 8 * 60 * 60 * 1000
-        if (this.filterParams.fromDate && this.filterParams.toDate && this.filterParams.fromDate > this.filterParams.toDate) {
-          if (type === 'fromDate') {
-            this.setRemindText('起始时间不能大于结束时间')
+        if (this.filterParams[type]) {
+          this.filterParams[type] = new Date(this.filterParams[type]).getTime() - 8 * 60 * 60 * 1000
+          if (this.filterParams.fromDate && this.filterParams.toDate && this.filterParams.fromDate > this.filterParams.toDate) {
+            if (type === 'fromDate') {
+              this.setRemindText('起始时间不能大于结束时间')
+            } else {
+              this.setRemindText('结束时间不能小于起始时间')
+            }
+            this.filterParams[type] = null
           } else {
-            this.setRemindText('结束时间不能小于起始时间')
+            if (this.filterParams.fromDate && this.filterParams.toDate && this.filterParams.fromDate === this.filterParams.toDate) {
+              // 23:59:59
+              this.filterParams.toDate += 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000
+            }
+            this.filterRecord()
           }
-          this.filterParams[type] = null
         } else {
-          if (this.filterParams.fromDate && this.filterParams.toDate && this.filterParams.fromDate === this.filterParams.toDate) {
-            // 23:59:59
-            this.filterParams.toDate += 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000
-          }
           this.filterRecord()
         }
       },

+ 27 - 0
plugins/mixin.js

@@ -144,6 +144,33 @@ Vue.mixin({
         }
       }
     },
+    priceFilter: function (num) {
+      if (num === 0) {
+        return num
+      }
+      if (typeof num === 'number') {
+        if (num <= 0.000001) {
+          num = 0.000001
+        } else {
+          if (num.toString().indexOf('.') === -1) {
+            num += '.00'
+          } else {
+            let inputStr = num.toString()
+            let arr = inputStr.split('.')
+            let floatNum = arr[1]
+            if (floatNum.length > 6) {
+              num = inputStr.substring(0, arr[0].length + 7)
+              if (Number(floatNum.charAt(6)) > 4) {
+                num = (Number(num) * 1000000 + 1) / 1000000
+              }
+            } else if (floatNum.length === 1) {
+              num = num + '0'
+            }
+          }
+        }
+      }
+      return num
+    },
     currencyFilter: function (val) {
       return val ? val === 'RMB' ? '¥' : '$' : ''
     },