Commit 77a7c728c6c10a91dd9efec55845f03ab2ef9925

Authored by 前端开发-罗建龙
1 parent d68c6c6e

预售优化

packageC/pages/presell/cart/cart2_pre.js
... ... @@ -4,7 +4,7 @@ var os = t.globalData.setting;
4 4 var regeneratorRuntime = require('../../../../utils/runtime.js');
5 5 var util_pay = require("../../../../utils/pay.js");
6 6 const t_pay = require("../../../../utils/pay2.js");
7   -
  7 +
8 8 Page({
9 9 data: {
10 10 url: t.globalData.setting.url,
... ... @@ -523,6 +523,10 @@ Page({
523 523 if (this.data.bn_goods.yck_off == 2) {
524 524 this.setData({ [txt]: 1 })
525 525 } else if (this.data.bn_goods.yck_off == 1) {
  526 + // let atxt10 = "formData.prestore"; //预存金额
  527 + // this.setData({
  528 + // [atxt10]:0
  529 + // })
526 530 this.setData({ [txt]: 2 })
527 531 }
528 532 this.calculatePrice2()//计算金额
... ... @@ -745,7 +749,7 @@ Page({
745 749 var atxt = "formData.total_amount";
746 750 th.setData({ [atxt]: total_m, })
747 751 var order_m = total_m;
748   -
  752 +
749 753 //预存金额使用参与计算
750 754 if (th.data.udata && th.data.udata.Balance > 0 && order_m * 1 > 0) {
751 755 if (!th.data.bn_goods.keyid) {
... ... @@ -793,7 +797,7 @@ Page({
793 797 good.pre_json = cart_yc.pre_json
794 798 let yct1 = 'bn_goods.yck_off';
795 799 let yct2 = 'bn_goods.yck';
796   - let yct3 = 'bn_goods.yckid';
  800 + let yct3 = 'bn_goods.yckid';
797 801 let yct4 = 'bn_goods.pre_json';
798 802 th.setData({
799 803 [yct1]: good.yck_off,
... ... @@ -826,6 +830,22 @@ Page({
826 830 // all_yck_arr.push(yck) //真实预存款抵扣金额
827 831 // all_pre_json.push(good.pre_json)
828 832 // all_prestore = parseFloat(all_prestore); //真实预存款抵扣金额总和
  833 + }else{
  834 + let yct1 = 'bn_goods.yck_off';
  835 + let yct2 = 'bn_goods.yck';
  836 + let yct3 = 'bn_goods.yckid';
  837 + let yct4 = 'bn_goods.pre_json';
  838 + let atxt10 = "formData.prestore"; //预存金额
  839 + let atxt11 = "formData.pre_json"; //预存json
  840 + let atxt12 = "formData.all_yck_arr"; //预存真实抵扣列表
  841 + th.setData({
  842 + [yct2]: 0,
  843 + [yct3]: '',
  844 + [yct4]: '',
  845 + [atxt10]: 0,
  846 + [atxt11]: '',
  847 + [atxt12]: [],
  848 + })
829 849 }
830 850 }
831 851 } else {
... ... @@ -845,13 +865,13 @@ Page({
845 865 [atxt12]: [],
846 866 })
847 867 }
848   -
  868 +
849 869 var txt = "formData.user_money";
850 870 var txt2 = "formData.order_amount";
851 871 //--------------如果使用余额---------------------
852 872 if (th.data.bn_use_money == 1 && th.data.yuer > 0) {
853   - if (parseFloat(th.data.yuer) > total_m) {
854   - th.setData({ [txt]: total_m, [txt2]: 0 })
  873 + if (parseFloat(th.data.yuer) > order_m) {
  874 + th.setData({ [txt]: order_m, [txt2]: 0 })
855 875 } else {
856 876 order_m = parseFloat(order_m) - parseFloat(th.data.yuer);
857 877 order_m = order_m.toFixed(2);
... ...