Commit 8cacb258d4c661260d724d7c9869476049e432e2

Authored by 后端研发-苏明海
2 parents 04ac8a26 deaee6c9

Merge branch 'test' into 'qa'

Test

See merge request !471
Showing 1 changed file with 2 additions and 77 deletions
pages/cart/cart2/cart2.js
... ... @@ -706,56 +706,6 @@ Page({
706 706 cart_item.prom_pt_json=[{"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0}];
707 707 }
708 708  
709   -
710   - //---如果是系统要平摊至单品的时候---
711   - if(!th.data.ispt_goods) {
712   - //此处要对商品从表排序一下,按商品件数升序,商品单价降序
713   - function sort_fun(a, b) {
714   - if (a["goods_num"] === b["goods_num"]) {
715   - if (a["goods_price"] < b["goods_price"]) {
716   - return 1;
717   - } else if (a["goods_price"] > b["goods_price"]) {
718   - return -1;
719   - } else {
720   - return 0;
721   - }
722   - } else {
723   - if (a["goods_num"] > b["goods_num"]) {
724   - return 1;
725   - } else {
726   - return -1;
727   - }
728   - }
729   - }
730   -
731   - //进行排序
732   - item_map.goods.sort(sort_fun);
733   - //这个位置就要开始平摊优惠到优惠活动的单品
734   - var account_all = 0;
735   - var per = (item_map.price - item_map.prom_price) / item_map.price; //优惠单价
736   -
737   - //比例太小的时候,就不进行平摊
738   - if (per < 0.001) {
739   - item_map.goods[0].account_yu = item_map.price - item_map.prom_price;
740   - } else {
741   - per = Math.floor(1000 * per) / 1000; //保留3位小数
742   - for (var i in item_map.goods) {
743   - var m_item = item_map.goods[i];
744   - var m_all_amount = m_item.goods_price * m_item.goods_num - m_item.goods_price * m_item.goods_num * per;
745   - var account = Math.floor(100 * m_all_amount /m_item.goods_num) / 100;
746   - if (account>=0) {
747   - item_map.goods[i].account = account;
748   - account_all += account * m_item.goods_num; //累加总实收
749   - }
750   - }
751   - //算出余数
752   - var yu = account_all - item_map.prom_price;
753   - if (yu != 0) {
754   - item_map.goods[0].account_yu = parseFloat(yu.toFixed(2));
755   - }
756   - }
757   - }
758   -
759 709 o_price-=(item_map.price-item_map.prom_price);
760 710 //如果有限制使用优惠券,就要减掉参与的活动商品的钱
761 711 if(!item_map.is_xz_yh) q_conditin=o_price;
... ... @@ -1532,25 +1482,6 @@ Page({
1532 1482 goods.quan_no= item.coupon_no;
1533 1483 }
1534 1484  
1535   -
1536   -
1537   - //--- 如果有优惠促销的金额,要把金额先平摊下去 ---
1538   - if(th.data.formData.cut_price>0 && !th.data.ispt_goods){
1539   - var per=th.data.formData.cut_price/(goods.goods_price*goods.goods_num) //优惠单价
1540   - //比例太小不平摊
1541   - if(per<0.001){
1542   - goods.account_yu=th.data.formData.cut_price;
1543   - item.is_discount_amount=1;
1544   - }else{
1545   - per=Math.floor(per*1000)/1000;
1546   - var all_amount=goods.goods_price*goods.goods_num-goods.goods_price*goods.goods_num*per; //商品总实收
1547   - var account=Math.floor(all_amount/goods.goods_num*100)/100; //实收单价保留俩位小数
1548   - var account_yu=account*goods.goods_num-(goods.goods_price*goods.goods_num-th.data.formData.cut_price); //算出余数
1549   - goods.account=account;
1550   - goods.account_yu=parseFloat(account_yu.toFixed(2));
1551   - item.is_discount_amount=1;
1552   - }
1553   - }
1554 1485 item.order_goods.push(goods);
1555 1486  
1556 1487 //--如果有赠品的时候,赠品也要提交---
... ... @@ -1673,13 +1604,7 @@ Page({
1673 1604 'store_id': oo.stoid,
1674 1605 };
1675 1606  
1676   - //把优惠的平摊结果写进去
1677   - if(g_item.account>=0 || g_item.account_yu>0){
1678   - if(g_item.account>=0) goods.account=g_item.account;
1679   - if(g_item.account_yu>=0) goods.account_yu=g_item.account_yu;
1680   - item.is_discount_amount=1;
1681   - }
1682   -
  1607 +
1683 1608 //--把券的钱,写入从表---
1684 1609 if(t_item.quan_youhui_list && t_item.coupon_price ){
1685 1610 for(var kk in t_item.quan_youhui_list ){
... ... @@ -1759,7 +1684,7 @@ Page({
1759 1684  
1760 1685 if (pdata.length==0) return;
1761 1686 var str = JSON.stringify(pdata);
1762   -
  1687 +
1763 1688 wx.showLoading({title: "加载中"});
1764 1689 wx.request({
1765 1690 url: oo.url + '/api/weshop/order/createWxdOrder',
... ...