2023-05-15 14:13:36 +08:00

1 line
8.0 KiB
JavaScript

"use strict";require("./sub-vendors.js");require("./sub-common/5203ee5b6c7f4a9fb1ae172eb73f138a.js");require("./sub-common/37c8d87e96c04e575f72be683de6cceb.js");require("./sub-common/87c86f7f5784eb6df1c3449a346aa652.js");require("./sub-common/79dce9cedae514998e78ea49450e892a.js");require("./sub-common/2d6c1e74d7f6aeec909c38802e94be4d.js");require("./sub-common/e2bfd15678b26a24e9970acd7bc73315.js");require("./sub-common/bd58a99800ec9985133b8fafd773d720.js");(wx.webpackJsonp=wx.webpackJsonp||[]).push([[3200],{5317:function(e,n,r){var o=r(2180),t=r(1413),a=r(4165),s=r(5861),l=r(9439),i=r(1515),c=r(2954),d=r.n(c),u=r(4184),_=r.n(u),m=r(7294),p=r(3474),f=r(7178),v=r(8536),h=r(7146),Z=r(1826),x=r(2890),g=r(1115),b=r(5679),j=r(4158),k=r(1251),w=r(8629),G=r(9498),N=r(8093),y=r(6353),S=r(1341),C=r(9194),D=r(5893),M=function Comfirm(){var e=(0,m.useState)(!1),n=(0,l.Z)(e,2),r=n[0],o=n[1],u=(0,m.useState)(),M=(0,l.Z)(u,2),T=M[0],A=M[1];(0,G.av)("pages/order/comfirm");var O=(0,x.jS)(),P=(0,m.useRef)({shopping_cart_product_color_list:[],sale_mode:0}),B=(0,m.useState)(),I=(0,l.Z)(B,2),L=I[0],E=I[1],F=(0,k.BD)().fetchData,V=function(){var e=(0,s.Z)((0,a.Z)().mark((function _callee(){var e,n;return(0,a.Z)().wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:if(!((null===(e=P.current.shopping_cart_product_color_list)||void 0===e?void 0:e.length)>0)){r.next=5;break}return r.next=3,F(P.current);case 3:n=r.sent,E(n.data);case 5:case"end":return r.stop()}}),_callee)})));return function getSaleOrderPreView(){return e.apply(this,arguments)}}();(0,c.useDidShow)((0,s.Z)((0,a.Z)().mark((function _callee2(){var e,n;return(0,a.Z)().wrap((function _callee2$(r){for(;;)switch(r.prev=r.next){case 0:P.current={shopping_cart_product_color_list:[],sale_mode:0},P.current.sale_mode=Number(null==O?void 0:O.sale_mode),null==O||null===(e=O.ids)||void 0===e||null===(n=e.split("-"))||void 0===n||n.map((function(e){var n;return null===(n=P.current.shopping_cart_product_color_list)||void 0===n?void 0:n.push({shopping_cart_product_color_id:Number(e)})})),V(),A((function(e){return(0,t.Z)((0,t.Z)({},e),{},{sale_mode:null==O?void 0:O.sale_mode})}));case 5:case"end":return r.stop()}}),_callee2)}))));var $=(0,m.useState)(),J=(0,l.Z)($,2),R=J[0],U=J[1],Y=(0,m.useMemo)((function(){return R}),[R]),q=(0,m.useMemo)((function(){var e=null==L?void 0:L.default_address;return{province_name:null==e?void 0:e.province_name,city_name:null==e?void 0:e.city_name,district_name:null==e?void 0:e.district_name,address_detail:null==e?void 0:e.address_detail,id:null==e?void 0:e.id,target_user_name:null==e?void 0:e.name,target_user_phone:null==e?void 0:e.phone,shipment_mode:null==e?void 0:e.shipment_mode,take_goods_address:null==L?void 0:L.take_goods_address,take_goods_phone:null==L?void 0:L.take_goods_phone}}),[L]),z=(0,m.useCallback)((function(e){A((function(n){return(0,t.Z)((0,t.Z)({},n),{},{shipment_mode:e})}))}),[]),H=(0,m.useCallback)((function(e){A((function(n){return(0,t.Z)((0,t.Z)({},n),{},{remark:e})})),o((function(){return!1}))}),[]),K=(0,m.useMemo)((function(){return 1==(null==T?void 0:T.shipment_mode)||2==(null==T?void 0:T.shipment_mode)&&(null==T?void 0:T.address_id)}),[T]),Q=(0,m.useMemo)((function(){if(R){var e=0==(null==R?void 0:R.sale_mode)?null==R?void 0:R.total_number:(null==R?void 0:R.total_number)/100;return"".concat(null==R?void 0:R.total_fabrics," 种面料,").concat(null==R?void 0:R.total_colors," 种颜色,共 ").concat(e," ").concat(null==R?void 0:R.unit)}}),[R]),W=w.DY.SubmitOrder,X=(0,G.Yw)().openSubscriptionMessage,ee=(0,C.v)((function(e){return e.userInfo})),ne=(0,k.xl)().fetchData,re=(0,N.P2)((0,s.Z)((0,a.Z)().mark((function _callee3(){var e;return(0,a.Z)().wrap((function _callee3$(n){for(;;)switch(n.prev=n.next){case 0:if(null!=T&&T.shipment_mode){n.next=3;break}return g.Z9.error("请选择收货方式"),n.abrupt("return",!1);case 3:if(null!=T&&T.address_id||2!=(null==T?void 0:T.shipment_mode)){n.next=6;break}return g.Z9.error("请选择地址"),n.abrupt("return",!1);case 6:return n.next=8,d().showModal({title:"确定提交订单?",content:"发货方式为".concat(1==(null==T?void 0:T.shipment_mode)?"自提":"物流"),confirmText:"确定",cancelText:"取消"});case 8:if(!n.sent.confirm){n.next=18;break}return n.next=12,X({scenes:W.value});case 12:return d().showLoading({title:"订单提交中...",mask:!0}),n.next=15,ne(T);case 15:e=n.sent,d().hideLoading(),e.success?((0,S.u0)({order_type:L.sale_mode_name,order_number:e.data.order_no,province:T.province_name||"",city:T.city_name||"",area:T.district_name||"",trigger_time:(0,j.o0)(new Date),purchaser_name:ee.adminUserInfo.user_name||"未知用户",purchaser_id:ee.adminUserInfo.user_id||0}),(0,g.jD)("/pages/order/index",{id:e.data.id},"redirectTo")):g.Z9.none(e.msg);case 18:case"end":return n.stop()}}),_callee3)}))),800);return(0,c.usePullDownRefresh)((function(){V()})),(0,m.useEffect)((function(){L&&(console.log("preViewOrder",L),function formatData(){U((0,t.Z)((0,t.Z)({},L),{},{estimate_amount:L.estimate_amount,sale_mode:L.sale_mode,sale_mode_name:L.sale_mode_name,total_colors:L.total_colors,total_number:L.total_number,total_fabrics:L.total_fabrics,unit:0==L.sale_mode?"条":"m",list:L.product_list,total_should_collect_money:L.total_should_collect_money,total_sale_price:L.total_sale_price}))}(),function getDataList(){var e,n=[];null===(e=L.product_list)||void 0===e||e.forEach((function(e){var r;null===(r=e.product_colors)||void 0===r||r.forEach((function(e){n.push({shopping_cart_product_color_id:e.id})}))})),A((function(e){return(0,t.Z)((0,t.Z)({},e),{},{list:n})}))}(),A((function(e){return(0,t.Z)((0,t.Z)({},e),{},{address_id:L.default_address.id,shipment_mode:L.shipment_mode||2,province_name:L.default_address.province_name,city_name:L.default_address.city_name,district_name:L.default_address.district_name})})))}),[L]),(0,D.jsx)(y.Z,{pageName:"pages/order/comfirm",showList:["order"],children:(0,D.jsxs)(i.G7,{className:v.Z.order_main,children:[(0,D.jsxs)(i.G7,{className:v.Z.order_content,children:[""!==(null==L?void 0:L.notice)&&(0,D.jsx)(i.G7,{className:v.Z.topBox,children:(0,D.jsxs)(i.G7,{className:v.Z.flexBox,children:[(0,D.jsx)(i.G7,{className:v.Z.gan,children:"!"}),(0,D.jsx)(i.G7,{className:v.Z.ganFont,children:null==L?void 0:L.notice})]})}),(0,D.jsx)(i.G7,{style:{margin:"0 20rpx"},children:(0,D.jsx)(Z.Z,{orderInfo:q,onSelect:function getAddress(e){console.log("getAddress",e),A((function(n){return(0,t.Z)((0,t.Z)({},n),{},{address_id:e.id,province_name:e.province_name,city_name:e.city_name,district_name:e.district_name})}))},onChangeShipmentMode:z,status:1})}),(0,D.jsx)(i.G7,{style:{margin:"20rpx",marginTop:"0"},children:(0,D.jsx)(p.Z,{order:Y,comfirm:!0})}),(0,D.jsx)(i.G7,{style:{margin:"20rpx"},children:(0,D.jsxs)(i.G7,{className:v.Z.order_desc,onClick:function onClick(){return o(!0)},children:[(0,D.jsx)(i.G7,{className:v.Z.order_desc_con,children:"订单备注"}),(null==T?void 0:T.remark)&&(0,D.jsx)(i.G7,{className:v.Z.order_desc_text,children:null==T?void 0:T.remark})||(0,D.jsx)(i.G7,{className:v.Z.order_desc_text_hint,children:"填写备注"}),(0,D.jsx)(i.G7,{className:_()(v.Z.miconfont,"iconfont icon-a-moreback")})]})})]}),(0,D.jsxs)(i.G7,{className:v.Z.submit_order,children:[(0,D.jsxs)(i.G7,{className:v.Z.submit_order_number,children:[(0,D.jsx)(h.Z,{style:{color:"#007AFF"},number:(1==(null==L?void 0:L.sale_mode)?null==R?void 0:R.total_should_collect_money:null==R?void 0:R.estimate_amount)/100,priceTitle:1==(null==L?void 0:L.sale_mode)?"合计金额":"预估金额"}),(0,D.jsx)(i.G7,{className:v.Z.order_number_desc,children:Q})]}),(0,D.jsx)(i.G7,{className:_()(v.Z.order_btn,K&&v.Z.ok_order_btn),onClick:re,children:"提交订单"})]}),(0,D.jsx)(b.Z,{show:r,showTitle:!1,onClose:function onClose(){return o(!1)},children:r&&(0,D.jsx)(f.Z,{defaultValue:null==T?void 0:T.remark,onSave:function onSave(e){return H(e)}})})]})})};M.enableShareAppMessage=!0;Page((0,o.createPageConfig)(M,"pages/order/comfirm",{root:{cn:[]}},{navigationBarTitleText:"确认订单",enableShareAppMessage:!0}||{}))}},function(e){e.O(0,[1680,9907,2977,4423,586,1167,7706,1287,9303,1977,4044,2107,1216,8592],(function(){return n=5317,e(e.s=n);var n}));e.O()}]);