Просмотр исходного кода

产品单价与折扣取消以牌价为上限限制

xiaohaizhao 3 лет назад
Родитель
Сommit
9012e10375

+ 9 - 7
packageA/contract/modules/discount/product/list/index.js

@@ -18,9 +18,10 @@ Component({
                 item = this.data.list[index];
             switch (name) {
                 case "discountrate":
-                    if (detail >= 100) {
+                    /* if (detail >= 100) {
                         item[name] = 100.00
-                    } else if (detail <= 0) {
+                    } else  */
+                    if (detail <= 0) {
                         item[name] = 1.00
                     } else {
                         item[name] = detail;
@@ -29,10 +30,11 @@ Component({
                     item.price = (item.marketprice * (item.discountrate / 100) - 0).toFixed(2);
                     break;
                 case "price":
-                    if (detail >= item.marketprice) {
-                        item.price = item.marketprice
-                        item.discountrate = 100.00;
-                    } else if (detail <= 0) {
+                    /*  if (detail >= item.marketprice) {
+                         item.price = item.marketprice
+                         item.discountrate = 100.00;
+                     } else  */
+                    if (detail <= 0) {
                         item.discountrate = 1.00;
                         item.price = (item.marketprice * (item.discountrate / 100) - 0).toFixed(2);
                     } else {
@@ -47,7 +49,7 @@ Component({
                 [`list[${index}]`]: item
             })
             let obj = {};
-            ["sa_contract_itemsid", "itemid", "price", "discountrate", "qty"].forEach(v => obj[v] = item[v]);
+            ["sa_contract_itemsid", "itemid", "price", "discountrate", "qty", "marketprice"].forEach(v => obj[v] = item[v]);
             obj.discountrate = (obj.discountrate / 100).toFixed(4);
             this.triggerEvent("changeQueue", obj)
         },

+ 7 - 6
packageA/contract/modules/product/list/index.js

@@ -45,9 +45,10 @@ Component({
                     item.amount = (item.price * item.qty).toFixed(2);
                     break;
                 case "discountrate":
-                    if (detail >= 100) {
-                        item.discountrate = 100
-                    } else if (detail <= 0) {
+                    /*  if (detail >= 100) {
+                         item.discountrate = 100
+                     } else */
+                    if (detail <= 0) {
                         item.discountrate = 1
                     } else {
                         item.discountrate = detail;
@@ -58,9 +59,10 @@ Component({
                     console.log(item.price)
                     break;
                 case "price":
-                    if (detail >= item.marketprice) {
+                    /* if (detail >= item.marketprice) {
                         item.price = item.marketprice
-                    } else if (detail <= 0) {
+                    } else  */
+                    if (detail <= 0) {
                         item.discountrate = 1;
                         item.price = (item.marketprice * (item.discountrate / 100) - 0).toFixed(2);
                     } else {
@@ -81,7 +83,6 @@ Component({
             ["sa_contract_itemsid", "itemid", "price", "discountrate", "qty", "remarks", 'marketprice'].forEach(v => obj[v] = item[v]);
             obj.discountrate = (obj.discountrate / 100).toFixed(4);
             obj.showAmount = item.amount;
-
             this.triggerEvent("changeQueue", obj)
         },
         /* 计算百分比 */

+ 3 - 3
packageA/offers/modules/product/list/index.js

@@ -50,17 +50,17 @@ Component({
             }
 
             if (name == 'price') {
-                if (item.price > item.marketprice) item.price = item.marketprice
+                // if (item.price > item.marketprice) item.price = item.marketprice
                 if (item.price <= 0) item.price = 1
                 item.discountrate = this.getPercent(item.price, item.marketprice).toFixed(2);
             } else if (name == 'discountrate') {
-                if (item.discountrate > 100) item.discountrate = 100;
+                // if (item.discountrate > 100) item.discountrate = 100;
                 if (item.discountrate <= 0) item.discountrate = 1;
                 item.price = currency(item.marketprice).multiply((item.discountrate / 100)).value;
             }
             item.showAmount = CNY(currency(item.price).multiply(item.qty));
             item.amount = currency(item.price).multiply(item.qty).value;
-            item.discountDifferenceAmount = CNY(currency(item.price).subtract(item.minPrice));
+            item.discountDifferenceAmount = CNY(currency(item.marketprice).subtract(item.price));
             this.setData({
                 [`list[${index}]`]: item
             })

+ 2 - 2
packageA/offers/modules/product/list/index.wxml

@@ -24,11 +24,11 @@
                 </view>
                 <view class="subfield">
                     <text class="line-1" style="margin-right: 6rpx;">牌价:{{item.showMarketprice||' --'}}</text>
-                    <text class="line-1" style="margin-right: 6rpx;">单价差额:<text style="color: {{(item.mindiscountrate-0)>(item.discountrate-0)?'var(--error)':'var(--success)'}};">{{item.discountDifferenceAmount||' --'}}</text></text>
+                    <text class="line-1" style="margin-right: 6rpx;">单价差额:<text style="color: {{(item.mindiscountrate-0)>(item.discountrate-0)?'var(--success)':'var(--error)'}};">{{item.discountDifferenceAmount||' --'}}</text></text>
                 </view>
                 <view class="subfield">
                     <text class="line-1" style="margin-right: 6rpx;">最低授权折扣:{{item.mindiscountrate}}%</text>
-                    <text class="line-1" style="margin-right: 6rpx;">是否特价:<text style="color: {{(item.mindiscountrate-0)>(item.discountrate-0)?'var(--error)':'var(--success)'}};">{{(item.mindiscountrate-0)>(item.discountrate-0)?'是':'否'}}</text></text>
+                    <text class="line-1" style="margin-right: 6rpx;">是否特价:<text style="color: {{(item.mindiscountrate-0)>(item.discountrate-0)?'var(--success)':'var(--error)'}};">{{(item.mindiscountrate-0)>(item.discountrate-0)?'是':'否'}}</text></text>
                 </view>
             </view>
             <view class="delete" wx:if="{{disabled}}" data-item="{{item}}" catchtap="deleteProduct">

+ 2 - 1
packageA/project/modules/product/index.js

@@ -67,7 +67,8 @@ Component({
                         title: res.msg,
                         icon: "none"
                     });
-                    page.getDetail(true);
+                    page.getDetail();
+                    this.getList(this.data.sa_projectid, true)
                 })
             }, 300)
         },

+ 82 - 82
packageA/project/modules/product/list/index.js

@@ -1,87 +1,87 @@
 const currency = require("../../../../../utils/currency"),
-  CNY = value => currency(value, {
-    symbol: "¥",
-    precision: 2
-  }).format();
+    CNY = value => currency(value, {
+        symbol: "¥",
+        precision: 2
+    }).format();
 Component({
-  properties: {
-    list: Array,
-    deleteItem: Function,
-    changeQueue: Function, //修改队列
-    disabled: Boolean
-  },
-  options: {
-    addGlobalClass: true
-  },
-  methods: {
-    /* 修改产品数量/单价 */
-    onBlur(e) {
-      let {
-        name,
-        index
-      } = e.currentTarget.dataset;
-      let item = this.data.list[index];
-      if (e.detail.value <= 0) {
-        wx.showToast({
-          title: '非法数值',
-          icon: "none",
-          mask: true
-        });
-      } else {
-        if (item[name] == e.detail.value) return;
-        // orderminqty 起订量
-        // orderaddqty 增量
-        let v = e.detail.value - 0;
-        //处理起订量和增量
-        if (name == 'qty') {
-          if (v < item.orderminqty) {
-            wx.showToast({
-              title: `输入数量小于起订量${item.orderminqty}`,
-              icon: "none",
-              mask: true
-            });
-            item.qty = item.orderminqty;
-          } else if (item.orderminqty < v) {
-            var currencyRounding = value => currency(value, {
-              increment: item.orderaddqty
-            });
-            item.qty = currency(currencyRounding(currency(v).subtract(item.orderminqty)).format()).add(item.orderminqty).value;
-            if (item.qty != v) wx.showToast({
-              title: `输入数量不符合增减量规则,已为您取最接近的值`,
-              icon: "none",
-              mask: true
-            })
-          } else {
-            item.qty = v;
-          }
-        } else {
-          item[name] = v;
-        }
-        if (name == "price") item[name] = item[name] > item.marketprice ? item[name] = item.marketprice : (item[name] - 0).toFixed(2) - 0;
-        item.amount = CNY(currency(item.price).multiply(item.qty));
-        let obj = {};
-        ["sa_project_itemsid", "itemid", "qty", "remarks", "marketprice", "price"].forEach(v => obj[v] = item[v]);
-        this.triggerEvent("changeQueue", obj)
-      }
-      this.setData({
-        list: this.data.list
-      })
+    properties: {
+        list: Array,
+        deleteItem: Function,
+        changeQueue: Function, //修改队列
+        disabled: Boolean
     },
-    deleteProduct(e) {
-      const {
-        sa_project_itemsid,
-        itemname
-      } = e.currentTarget.dataset.item,
-        that = this;
-      wx.showModal({
-        title: '提示',
-        content: `是否确认删除“${itemname}”?`,
-        complete: ({
-          confirm
-        }) => {
-          if (confirm) that.triggerEvent("deleteItem", [sa_project_itemsid]);
-        }
-      })
+    options: {
+        addGlobalClass: true
     },
-  }
+    methods: {
+        /* 修改产品数量/单价 */
+        onBlur(e) {
+            let {
+                name,
+                index
+            } = e.currentTarget.dataset;
+            let item = this.data.list[index];
+            if (e.detail.value <= 0) {
+                wx.showToast({
+                    title: '非法数值',
+                    icon: "none",
+                    mask: true
+                });
+            } else {
+                if (item[name] == e.detail.value) return;
+                // orderminqty 起订量
+                // orderaddqty 增量
+                let v = e.detail.value - 0;
+                //处理起订量和增量
+                if (name == 'qty') {
+                    if (v < item.orderminqty) {
+                        wx.showToast({
+                            title: `输入数量小于起订量${item.orderminqty}`,
+                            icon: "none",
+                            mask: true
+                        });
+                        item.qty = item.orderminqty;
+                    } else if (item.orderminqty < v) {
+                        var currencyRounding = value => currency(value, {
+                            increment: item.orderaddqty
+                        });
+                        item.qty = currency(currencyRounding(currency(v).subtract(item.orderminqty)).format()).add(item.orderminqty).value;
+                        if (item.qty != v) wx.showToast({
+                            title: `输入数量不符合增减量规则,已为您取最接近的值`,
+                            icon: "none",
+                            mask: true
+                        })
+                    } else {
+                        item.qty = v;
+                    }
+                } else {
+                    item[name] = v;
+                }
+                if (name == "price") item[name] = (item[name] - 0).toFixed(2) - 0;
+                item.amount = CNY(currency(item.price).multiply(item.qty));
+                let obj = {};
+                ["sa_project_itemsid", "itemid", "qty", "remarks", "marketprice", "price"].forEach(v => obj[v] = item[v]);
+                this.triggerEvent("changeQueue", obj)
+            }
+            this.setData({
+                list: this.data.list
+            })
+        },
+        deleteProduct(e) {
+            const {
+                sa_project_itemsid,
+                itemname
+            } = e.currentTarget.dataset.item,
+                that = this;
+            wx.showModal({
+                title: '提示',
+                content: `是否确认删除“${itemname}”?`,
+                complete: ({
+                    confirm
+                }) => {
+                    if (confirm) that.triggerEvent("deleteItem", [sa_project_itemsid]);
+                }
+            })
+        },
+    }
 })

+ 64 - 1
pages/login/retrievePassword.scss

@@ -1 +1,64 @@
-@import "../../pages/tabbar/mine/changePassword/index.scss";
+.input-field {
+	width: 690rpx;
+	background-color: #fff;
+	box-sizing: border-box;
+	border-radius: 16rpx;
+	display: flex;
+	position: relative;
+	padding: 26rpx 20rpx 24rpx 30rpx;
+	margin: 20rpx auto;
+
+	.icon-box {
+			width: 40rpx;
+			height: 40rpx;
+			margin-right: 50rpx;
+
+			.iconfont {
+					font-size: 40rpx;
+					color: var(--assist);
+			}
+	}
+
+	.input {
+			flex: 1;
+			font-size: 28rpx;
+			font-family: PingFang SC-Regular, PingFang SC;
+			color: #333333;
+			margin-top: -5rpx;
+	}
+
+	.auth-code {
+			width: 180rpx;
+			height: 40rpx;
+			line-height: 40rpx;
+			text-align: center;
+			flex-shrink: 0;
+			font-size: 28rpx;
+			font-family: PingFang SC-Regular, PingFang SC;
+			color: #3874F6;
+			border-left: 1rpx solid #EEE;
+	}
+
+	.errmsg {
+			font-size: 24rpx;
+			font-family: PingFang SC-Regular, PingFang SC;
+			color: #FF3B30;
+
+			.iconfont {
+					padding-left: 10rpx;
+					color: #BBBBBB;
+			}
+	}
+}
+
+.but-style {
+	width: 500rpx;
+	height: 90rpx;
+	background: #3874F6 !important;
+	border-radius: 45rpx !important;
+	opacity: 0.85;
+	font-size: 28rpx;
+	font-family: PingFang SC-Bold, PingFang SC;
+	font-weight: bold;
+	color: #FFFFFF !important;
+}

+ 9 - 9
pages/login/retrievePassword.wxml

@@ -1,23 +1,23 @@
-<My_card custom-class='input-field'>
+<view class='input-field'>
     <view class="icon-box">
         <text class="iconfont icon-a-biaoqianlanwodexuanzhong" />
     </view>
     <input class="input" type="text" bindinput="formInput" data-name="accountno" placeholder='请填写账户名' />
-</My_card>
-<My_card custom-class='input-field'>
+</view>
+<view class='input-field'>
     <view class="icon-box">
-        <text class="iconfont icon-hujiao" />
+        <text class="iconfont icon-a-biaoqianlanxiaoxixuanzhong" />
     </view>
     <input class="input" type="number" bindinput="formInput" data-name="password" placeholder='请填写验证码' />
     <view class="auth-code" bindtap="getPassword">{{countDown?countDown+'s':'获取验证码'}}</view>
-</My_card>
-<My_card custom-class='input-field'>
+</view>
+<view class='input-field'>
     <view class="icon-box">
         <text class="iconfont icon-a-wodemima" />
     </view>
     <input class="input" password bindinput="formInput" data-name="newPassword" placeholder='请设置6-20位新密码' />
-</My_card>
-<My_card custom-class='input-field'>
+</view>
+<view class='input-field'>
     <view class="icon-box">
         <text class="iconfont icon-a-wodemima" />
     </view>
@@ -25,7 +25,7 @@
     <view wx:if="{{confirmPassword===false}}" class="errmsg">两次密码不一致
         <van-icon class="iconfont" name="clear" bind:click="clearNewPassword" />
     </view>
-</My_card>
+</view>
 <view style="width: 100%; text-align: center;margin-top: 100rpx;">
     <van-button disabled='{{disabled}}' bindtap="changePassword" loading='{{loading}}' loading-text="修改中..." custom-class='but-style'>确定修改</van-button>
 </view>

+ 1 - 0
utils/Http.js

@@ -1,4 +1,5 @@
 // const baseUrl = "http://61.164.207.46:8000/yos/rest/index";
+// const baseUrl = "http://192.168.3.13:8080/yos/rest/index";
 const baseUrl = "https://oms.idcgroup.com.cn:8079/yos/rest/index";
 
 let count = null;