Quellcode durchsuchen

fix:功能优化

DaMowang vor 3 Jahren
Ursprung
Commit
e9b6322807

+ 0 - 37
src/components/noticeBar.vue

@@ -1,37 +0,0 @@
-<template>
-  <uni-notice-bar
-    background-color="#fff"
-    color="#333"
-    scrollable="true"
-    single="true"
-    class="noticeBar"
-    :text="text"
-  ></uni-notice-bar>
-</template>
-
-<script>
-export default {
-  name: "noticeBar",
-  props: {
-    "text": {
-        type: String,
-        default: ""
-    }
-  },
-  components: {},
-  data() {
-    return {};
-  },
-  methods: {},
-  mounted() {},
-  watch: {},
-  computed: {},
-  filters: {},
-};
-</script>
-
-<style scoped lang='scss'>
-.noticeBar{
-    font-size: 26rpx;
-}
-</style>

+ 9 - 6
src/main.js

@@ -12,26 +12,29 @@ Vue.prototype.$md5 = md5;
 import dayjs from 'dayjs';
 Vue.prototype.$day = dayjs;
 
+import cof from '@/static/config/in';
+Vue.prototype.$cof = cof;
+
 // 微信全局分享
 import share from '@/utils/share.js'
 Vue.mixin(share)
 
-import cof from '@/static/config/in';
-Vue.prototype.$cof = cof;
+// js高精度计算
+import highPrecision from "@/utils/highPrecision";
+Vue.prototype.$h = highPrecision;
 
+// 自动适配接口域名
 import hosts from "@/request/config";
 Vue.prototype.$hosts = hosts;
 
+// 上传
 import { up } from "@/utils/up";
 Vue.prototype.$up = up;
 
+// 页面跳转
 import { goto } from '@/utils/myfun.js';
 Vue.prototype.goto = goto;
 
-//注册为全局组件 - 通告
-import noticeBar from "@/components/noticeBar";
-Vue.component('noticeBar', noticeBar);
-
 App.mpType = 'app'
 
 const app = new Vue({

+ 11 - 5
src/pages/account/giveAsPresent.vue

@@ -14,7 +14,7 @@
 
     <!-- 赠送 -->
     <view class="give">
-      <view class="give_option flex_r flex_ac"
+      <view class="give_option flex_r flex_ac flex_jb"
         ><text class="flex_r flex_ac">赠送数量</text>
         <input
           type="number"
@@ -54,11 +54,11 @@ export default {
       userinfo: undefined, // 获取用户信息
     };
   },
-  onLoad: function () {
+  onLoad () {
     this.userinfo = uni.getStorageSync("userinfo");
   },
   methods: {
-    setCurren: function (e) {
+    setCurren(e) {
       this.surplus = 0;
       this.curren = e;
       this.giveUserIntegral();
@@ -128,7 +128,7 @@ export default {
   width: 100%;
 }
 .give_option {
-  height: 88rpx;
+  height: 70rpx;
 }
 .give_list:nth-child(3n) {
   margin-right: 0;
@@ -144,10 +144,12 @@ export default {
   box-sizing: border-box;
 }
 .give_option text {
+  width: 116rpx;
   font-size: 26rpx;
   color: #404040;
   font-family: "SourceHanSansCN-Medium";
   height: 100%;
+  box-sizing: border-box;
 }
 .give_number {
   font-size: 24rpx;
@@ -157,12 +159,16 @@ export default {
   width: 100%;
 }
 .give_option input {
+  width: calc(100% - 136rpx);
   margin-left: 20rpx;
-  font-size: 34rpx;
+  // font-size: 34rpx;
   font-family: "SourceHanSansCN-Bold";
   font-weight: bold;
   color: #17bb87;
   height: 100%;
+  background: #ebebeb;
+  padding: 0 40rpx;
+  box-sizing: border-box;
 }
 .give_label {
   width: 100%;

+ 1 - 1
src/pages/product/p_details.vue

@@ -221,7 +221,7 @@ export default {
         toPayOrder: function() {
             let da = {
                 ...this.goodsDa,
-                num: this.buyNum,
+                num: Number(this.buyNum),
                 is_sell: this.type == 2 ? this.pfway : '0'
             }
             this.goto("/pages/to-pay-list/index", da);

+ 14 - 9
src/pages/to-pay-list/index.vue

@@ -30,10 +30,9 @@
                 <image class="goods_img" :src="goodsInfo.original_img" mode=""></image>
                 <view class="goods_con flex_c flex_jc flex_jb">
                     <view class="goods_name ellipsis2">{{ goodsInfo.goods_name }}</view>
-                    <view class="flex_r flex_ac flex_jb">
-                        <view class="goods_msg">{{ Data.type == 2 ? goodsInfo.trade_num + "消费积分" + "¥" + goodsInfo.trade_price : "¥" + goodsInfo.cost_price }}</view>
-                        <view class="goods_num">x {{ Data.num }}</view>
-                    </view>
+                    <view class="goods_msg" v-if="Data.type == 2">{{goodsInfo.trade_price}}元+{{goodsInfo.trade_num}}批发积分+{{goodsInfo.treasure_price}}茶宝</view>
+                    <view class="goods_msg" v-else>{{ goodsInfo.cost_price }}</view>
+                    <view class="goods_num">x {{ Data.num }}</view>
                 </view>
             </view>
         </view>
@@ -49,7 +48,7 @@
                     <view class="list_name">运费</view>
                     <view class="list_con p_color">({{ freight }}元/每套)</view>
                 </view>
-                <view class="list_con">¥{{ freight * Data.num }}</view>
+                <view class="list_con">¥{{ $h.Mul(freight, Data.num) }}</view>
             </view>
             <view class="order_list flex_r flex_ac flex_jb" v-if="Data.type == 2 || Data.type == 5">
                 <view class="flex_r flex_ac">
@@ -57,18 +56,18 @@
                     <view class="list_con p_color">(可用{{ userinfo.cha_bao }})</view>
                 </view>
                 <view class="list_con" v-if="Data.type != 5">{{ goodsInfo.treasure_price * Data.num }} 茶宝</view>
-                <view class="list_con" v-else>{{ goodsInfo.cha_bao * Data.num }} 茶宝</view>
+                <view class="list_con" v-else>{{ $h.Mul(goodsInfo.cha_bao, Data.num) }} 茶宝</view>
             </view>
             <view class="order_list flex_r flex_ac flex_jb" v-if="Data.type == 2">
                 <view class="flex_r flex_ac">
                     <view class="list_name">批发积分</view>
                     <view class="list_con p_color">(可用{{ userinfo.integral }})</view>
                 </view>
-                <view class="list_con">{{ goodsInfo.trade_num * Data.num }} 批发积分</view>
+                <view class="list_con">{{ $h.Mul(goodsInfo.trade_num, Data.num) }} 批发积分</view>
             </view>
             <view class="order_list flex_r flex_ac flex_jb" v-if="Data.type != 5">
                 <view class="list_name">商品金额</view>
-                <view class="list_con">¥{{ (Data.type == 2 ? goodsInfo.trade_price : goodsInfo.cost_price) * Data.num || 0 }}</view>
+                <view class="list_con">¥{{ $h.Mul((Data.type == 2 ? goodsInfo.trade_price : goodsInfo.cost_price), Data.num) || 0 }}</view>
             </view>
             <view class="order_list flex_r flex_ac flex_jb" v-if="Data.type != 4 && Data.type != 5">
                 <view class="list_name">可用余额</view>
@@ -340,13 +339,19 @@ page {
 }
 
 .goods_num {
+    text-align: right;
     font-size: 26rpx;
     color: #989898;
+    position: absolute;
+    bottom: 0;
+    right: 0;
 }
 
 .goods_con {
     width: calc(100% - 202rpx - 36rpx);
-    overflow: hidden;
+    min-height: 187rpx;
+    position: relative;
+    // overflow: hidden;
 }
 
 .goods {

+ 45 - 0
src/utils/highPrecision.js

@@ -0,0 +1,45 @@
+export default {
+    //加法函数
+    Add: function(arg1, arg2) {
+       let r1,r2,m;
+       // 获取每个参数的小数的位数
+       try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0}
+       try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0}
+       // 计算底数为10以最大小数位数为次幂的值
+       m=Math.pow(10,Math.max(r1,r2));
+       // 把所有参数转为整数后相加再除以次幂的值
+       return (arg1*m + arg2*m)/m;
+    },
+    //减法函数
+    Sub: function(arg1, arg2) {
+       let r1,r2,m,n;
+       // 获取每个参数的小数的位数
+       try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0}
+       try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0}
+       // 计算底数为10以最大小数位数为次幂的值
+       m=Math.pow(10,Math.max(r1,r2));
+       //精度长度以最大小数位数为长度
+       n=(r1>=r2)?r1:r2;
+       return ((arg1*m-arg2*m)/m).toFixed(n);
+    },
+    //乘法函数
+    Mul: function(arg1, arg2) {
+       let m=0,s1=arg1.toString(),s2=arg2.toString();
+       // 获取所有参数小数位长度之和
+       try{m+=s1.split(".")[1].length}catch(e){}
+       try{m+=s2.split(".")[1].length}catch(e){}
+       // 替换掉小数点转为数字相乘再除以10的次幂值
+       return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m);
+    },
+    //除法函数
+    Div: function(arg1, arg2) {
+       let t1=0,t2=0,r1,r2;
+       // 获取每个参数的小数的位数
+       try{t1=arg1.toString().split(".")[1].length}catch(e){}
+       try{t2=arg2.toString().split(".")[1].length}catch(e){}
+       // 把所有参数的小数点去掉转为整数
+       r1=Number(arg1.toString().replace(".",""));
+       r2=Number(arg2.toString().replace(".",""));
+       return (r1/r2)*Math.pow(10,t2-t1);
+    },
+}