TestEShopDist/dist/pages/order/speedComfirm.js
2023-05-15 14:13:36 +08:00

1 line
8.5 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([[6582],{1753:function(e,r,n){var o=n(2180),t=n(1413),a=n(4165),s=n(5861),l=n(9439),i=n(1515),d=n(2954),c=n.n(d),u=n(4184),_=n.n(u),m=n(7294),p=n(3474),f=n(7178),v=n(8536),h=n(7146),x=n(1826),Z=n(2890),g=n(1115),b=n(5679),k=n(8629),j=n(9498),y=n(8093),w=n(6353),N=n(9612),G=n(6028),S=n(1341),C=n(4158),D=n(9194),M=n(5893),T=function SpeedComfirm(){var e=(0,d.useRouter)();(0,j.av)("pages/order/speedComfirm");var r=(0,m.useState)(!1),n=(0,l.Z)(r,2),o=n[0],u=n[1],T=(0,m.useState)(),O=(0,l.Z)(T,2),L=O[0],P=O[1],A=(0,Z.jS)(),E=(0,m.useRef)({sale_order_product_color_list:[],sale_mode:0}),I=(0,m.useState)(),B=(0,l.Z)(I,2),F=B[0],J=B[1],R=(0,N.Kx)().fetchData,$=function(){var e=(0,s.Z)((0,a.Z)().mark((function _callee(){var e,r,n,o;return(0,a.Z)().wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:if(!((null===(e=E.current.sale_order_product_color_list)||void 0===e?void 0:e.length)>0)){t.next=8;break}return r=[],E.current.sale_order_product_color_list.forEach((function(e){r.push({length:(null==e?void 0:e.length)||0,roll:e.roll,product_color_id:e.product_color_id})})),n={sale_mode:E.current.sale_mode,sale_order_product_color_list:r},t.next=6,R(n);case 6:o=t.sent,J(o.data);case 8:case"end":return t.stop()}}),_callee)})));return function getSaleOrderPreView(){return e.apply(this,arguments)}}();(0,d.useDidShow)((0,s.Z)((0,a.Z)().mark((function _callee2(){var r,n;return(0,a.Z)().wrap((function _callee2$(o){for(;;)switch(o.prev=o.next){case 0:E.current={sale_order_product_color_list:[],sale_mode:0},E.current.sale_mode=Number(null===(r=e.params)||void 0===r?void 0:r.sale_mode),E.current.sale_order_product_color_list=JSON.parse(null==e||null===(n=e.params)||void 0===n?void 0:n.buyList),$(),P((function(e){return(0,t.Z)((0,t.Z)({},e),{},{sale_mode:null==A?void 0:A.sale_mode})}));case 5:case"end":return o.stop()}}),_callee2)}))));var q=(0,m.useState)(),U=(0,l.Z)(q,2),V=U[0],Y=U[1],z=(0,m.useMemo)((function(){return V}),[V]),K=(0,m.useMemo)((function(){var e=null==F?void 0:F.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==F?void 0:F.take_goods_address,take_goods_phone:null==F?void 0:F.take_goods_phone}}),[F]),H=(0,m.useCallback)((function(e){P((function(r){return(0,t.Z)((0,t.Z)({},r),{},{shipment_mode:e})}))}),[]),Q=(0,m.useCallback)((function(e){P((function(r){return(0,t.Z)((0,t.Z)({},r),{},{remark:e})})),u((function(){return!1}))}),[]),W=(0,m.useMemo)((function(){return 1==(null==L?void 0:L.shipment_mode)||2==(null==L?void 0:L.shipment_mode)&&(null==L?void 0:L.address_id)}),[L]),X=(0,m.useMemo)((function(){if(V){var e=0==(null==V?void 0:V.sale_mode)?null==V?void 0:V.total_number:(null==V?void 0:V.total_number)/100;return"".concat(null==V?void 0:V.total_fabrics," 种面料,").concat(null==V?void 0:V.total_colors," 种颜色,共 ").concat(e," ").concat(null==V?void 0:V.unit)}}),[V]),ee=k.DY.SubmitOrder,re=(0,j.Yw)().openSubscriptionMessage,ne=(0,D.v)((function(e){return e.userInfo})),oe=(0,N.sy)().fetchData,te=(0,y.P2)((0,s.Z)((0,a.Z)().mark((function _callee3(){var r,n;return(0,a.Z)().wrap((function _callee3$(o){for(;;)switch(o.prev=o.next){case 0:if(null!=L&&L.shipment_mode){o.next=3;break}return g.Z9.error("请选择收货方式"),o.abrupt("return",!1);case 3:if(null!=L&&L.address_id||2!=(null==L?void 0:L.shipment_mode)){o.next=6;break}return g.Z9.error("请选择地址"),o.abrupt("return",!1);case 6:return o.next=8,c().showModal({title:"确定提交订单?",content:"发货方式为".concat(1==(null==L?void 0:L.shipment_mode)?"自提":"物流"),confirmText:"确定",cancelText:"取消"});case 8:if(!o.sent.confirm){o.next=21;break}return o.next=12,re({scenes:ee.value});case 12:return c().showLoading({title:"订单提交中...",mask:!0}),r={sale_mode:Number(e.params.sale_mode),shipment_mode:L.shipment_mode,address_id:L.address_id,remark:(null==L?void 0:L.remark)||"",sale_order_product_color_list:null==L?void 0:L.list},console.log(L,"submitOrderData"),console.log(r,"queryquery"),o.next=18,oe(r);case 18:n=o.sent,c().hideLoading(),n.success?((0,S.u0)({order_type:F.sale_mode_name,order_number:n.data.order_no,province:L.province_name||"",city:L.city_name||"",area:L.district_name||"",trigger_time:(0,C.o0)(new Date),purchaser_name:ne.adminUserInfo.user_name||"未知用户",purchaser_id:ne.adminUserInfo.user_id||0}),(0,g.jD)("/pages/order/index",{id:n.data.id},"redirectTo")):g.Z9.none(n.msg);case 21:case"end":return o.stop()}}),_callee3)}))),800);return(0,d.usePullDownRefresh)((function(){$()})),(0,m.useEffect)((function(){F&&(!function formatData(){Y({estimate_amount:F.estimate_amount,sale_mode:F.sale_mode,is_open_rebate:F.is_open_rebate,rebate_money:F.rebate_money,sale_mode_name:F.sale_mode_name,total_colors:F.total_colors,total_number:F.total_number,total_fabrics:F.total_fabrics,unit:0==F.sale_mode?"条":"m",list:F.product_list,total_should_collect_money:F.total_should_collect_money,total_sale_price:F.total_sale_price,initiative_income:F.initiative_income,passive_income:F.passive_income})}(),function getDataList(){var e,r=[];null===(e=F.product_list)||void 0===e||e.forEach((function(e){var n;null===(n=e.product_colors)||void 0===n||n.forEach((function(e){r.push({product_color_id:e.id,sale_price:e.sale_price,roll:e.roll,length:e.length})}))})),P((function(e){return(0,t.Z)((0,t.Z)({},e),{},{list:r})}))}(),P((function(e){return(0,t.Z)((0,t.Z)({},e),{},{address_id:F.default_address.id,province_name:F.default_address.province_name,city_name:F.default_address.city_name,district_name:F.default_address.district_name,shipment_mode:F.shipment_mode||2})})))}),[F]),(0,M.jsx)(w.Z,{pageName:"pages/order/speedComfirm",showList:["order"],children:(0,M.jsxs)(i.G7,{className:v.Z.order_main,children:[(0,M.jsxs)(i.G7,{className:v.Z.order_content,children:[""!==(null==F?void 0:F.notice)&&(0,M.jsx)(i.G7,{className:v.Z.topBox,children:(0,M.jsxs)(i.G7,{className:v.Z.flexBox,children:[(0,M.jsx)(i.G7,{className:v.Z.gan,children:"!"}),(0,M.jsx)(i.G7,{className:v.Z.ganFont,children:null==F?void 0:F.notice})]})}),(0,M.jsx)(i.G7,{style:{margin:"0 20rpx"},children:(0,M.jsx)(x.Z,{orderInfo:K,onSelect:function getAddress(e){P((function(r){return(0,t.Z)((0,t.Z)({},r),{},{address_id:e.id,province_name:e.province_name,city_name:e.city_name,district_name:e.district_name})}))},onChangeShipmentMode:H,status:1})}),(0,M.jsx)(i.G7,{style:{margin:"0 20rpx"},children:(0,M.jsx)(p.Z,{order:z,comfirm:!0})}),(0,M.jsx)(i.G7,{style:{margin:"0 20rpx"},children:(0,M.jsxs)(i.G7,{className:v.Z.order_desc,onClick:function onClick(){return u(!0)},children:[(0,M.jsx)(i.G7,{className:v.Z.order_desc_con,children:"订单备注"}),(null==L?void 0:L.remark)&&(0,M.jsx)(i.G7,{className:v.Z.order_desc_text,children:null==L?void 0:L.remark})||(0,M.jsx)(i.G7,{className:v.Z.order_desc_text_hint,children:"填写备注"}),(0,M.jsx)(G.Z,{name:"icon-rukou",size:28,color:"#474747"})]})})]}),(0,M.jsxs)(i.G7,{className:v.Z.submit_order,children:[(0,M.jsxs)(i.G7,{className:v.Z.submit_order_number,children:[(0,M.jsx)(h.Z,{style:{color:"#007AFF"},number:(1==(null==F?void 0:F.sale_mode)?null==V?void 0:V.total_should_collect_money:null==V?void 0:V.estimate_amount)/100,priceTitle:1==(null==F?void 0:F.sale_mode)?"合计金额":"预估金额"}),(0,M.jsx)(i.G7,{className:v.Z.order_number_desc,children:X})]}),(0,M.jsx)(i.G7,{className:_()(v.Z.order_btn,W&&v.Z.ok_order_btn),onClick:function onClick(){return te()},children:"提交订单"})]}),(0,M.jsx)(b.Z,{show:o,showTitle:!1,onClose:function onClose(){return u(!1)},children:o&&(0,M.jsx)(f.Z,{defaultValue:null==L?void 0:L.remark,onSave:function onSave(e){return Q(e)}})})]})})};T.enableShareAppMessage=!0;Page((0,o.createPageConfig)(T,"pages/order/speedComfirm",{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 r=1753,e(e.s=r);var r}));e.O()}]);