You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
13 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/confirm-order/index"],{279:function(t,e,n){"use strict";(function(t,e){var i=n(4);n(26);i(n(25));var r=i(n(280));t.__webpack_require_UNI_MP_PLUGIN__=n,e(r.default)}).call(this,n(1)["default"],n(2)["createPage"])},280:function(t,e,n){"use strict";n.r(e);var i=n(281),r=n(283);for(var a in r)["default"].indexOf(a)<0&&function(t){n.d(e,t,(function(){return r[t]}))}(a);n(286);var s,o=n(33),u=Object(o["default"])(r["default"],i["render"],i["staticRenderFns"],!1,null,"2b9e2b4a",null,!1,i["components"],s);u.options.__file="pages/confirm-order/index.vue",e["default"]=u.exports},281:function(t,e,n){"use strict";n.r(e);var i=n(282);n.d(e,"render",(function(){return i["render"]})),n.d(e,"staticRenderFns",(function(){return i["staticRenderFns"]})),n.d(e,"recyclableRender",(function(){return i["recyclableRender"]})),n.d(e,"components",(function(){return i["components"]}))},282:function(t,e,n){"use strict";var i;n.r(e),n.d(e,"render",(function(){return r})),n.d(e,"staticRenderFns",(function(){return s})),n.d(e,"recyclableRender",(function(){return a})),n.d(e,"components",(function(){return i}));try{i={titleBlock:function(){return n.e("components/title-block/title-block").then(n.bind(null,414))},uUpload:function(){return Promise.all([n.e("common/vendor"),n.e("uview-ui/components/u-upload/u-upload")]).then(n.bind(null,388))},uPopup:function(){return Promise.all([n.e("common/vendor"),n.e("uview-ui/components/u-popup/u-popup")]).then(n.bind(null,487))},uPicker:function(){return Promise.all([n.e("common/vendor"),n.e("uview-ui/components/u-picker/u-picker")]).then(n.bind(null,495))},uLoadingPage:function(){return Promise.all([n.e("common/vendor"),n.e("uview-ui/components/u-loading-page/u-loading-page")]).then(n.bind(null,503))}}}catch(o){if(-1===o.message.indexOf("Cannot find module")||-1===o.message.indexOf(".vue"))throw o;console.error(o.message),console.error("1. 排查组件名称拼写是否正确"),console.error("2. 排查组件是否符合 easycom 规范文档https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"),console.error("3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件")}var r=function(){var t=this,e=t.$createElement,n=(t._self._c,t.listPaintings.length),i=n>1?t.__map(t.listPaintings,(function(e,n){var i=t.__get_orig(e),r=t.listPaintings[n].warehouseID?t.addressList.find((function(e){return e.ID===t.listPaintings[n].warehouseID})):null;return{$orig:i,g1:r}})):null,r=n>1?t.listPaintings.length:null,a=n>1?t.listPaintings.length:null,s=t.listPaintings.length,o=t.__map(t.listPaintings,(function(e,n){var i=t.__get_orig(e),r=t.listPaintings[n].warehouseID?t.addressList.find((function(e){return e.ID===t.listPaintings[n].warehouseID})):null;return{$orig:i,g5:r}})),u="detail"!==t.type?t.listPaintings.length:null;t._isMounted||(t.e0=function(){t.show_2=!0},t.e1=function(e){t.show_2=!1},t.e2=function(e){t.show_1=!1}),t.$mp.data=Object.assign({},{$root:{g0:n,l0:i,g2:r,g3:a,g4:s,l1:o,g6:u}})},a=!1,s=[];r._withStripped=!0},283:function(t,e,n){"use strict";n.r(e);var i=n(284),r=n.n(i);for(var a in i)["default"].indexOf(a)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(a);e["default"]=r.a},284:function(t,e,n){"use strict";(function(t){var i=n(4);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=i(n(63)),a=i(n(65)),s=i(n(11)),o=i(n(223)),u=n(262);n(285);function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function l(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?c(Object(n),!0).forEach((function(e){(0,s.default)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var d={name:"order-details",data:function(){for(var t=new Date,e=[],n=t.getFullYear(),i=[],r=t.getMonth()+1,a=[],s=t.getDate(),o=1990;o<=t.getFullYear();o++)e.push(o);for(var u=1;u<=12;u++)i.push(u);for(var c=1;c<=31;c++)a.push(c);return{itemHeight:0,scrollId:"item-0",columns:[[180],["*"],[1,2,3,4,5],["="],[180]],currentIndex:0,listPaintings:[{expectedPayment:"",fileList1:[],artworkNum:"",artworkName:"",artistName:"",artworkSquareSize:"",warehouseID:"",endAt:""}],contentListHeight:0,isExpand:!1,isExpand1:!1,listHeight:308,minDate:"",type:"",show:!1,value1:"",loading:!1,fileList1:[],dayMoney:"",expectedPayment:"",warehouseID:"",cycleId:"",cycleList:[],addressList:[],info:{},show_2:!1,data:[],show_1:!1,title:"picker-view",years:e,year:n,months:i,month:r,days:a,day:s,value:[9999,r-1,s-1],visible:!0,url:""}},computed:{totalMoney:function(){return this.listPaintings.reduce((function(t,e){return t+Number(e.expectedPayment)}),0)},currentArtworkSquareSize:function(){return this.currentIndex>=0&&this.currentIndex<this.listPaintings.length?this.listPaintings[this.currentIndex].artworkSquareSize:null},currentEndAt:function(){return this.currentIndex>=0&&this.currentIndex<this.listPaintings.length?this.listPaintings[this.currentIndex].endAt:null}},watch:{currentArtworkSquareSize:function(t,e){t!==e&&this.obtainAmount()},currentEndAt:function(t,e){console.log(t,e),t!==e&&this.obtainAmount()}},onLoad:function(e){var n;(e.url&&(this.url=e.url,this.getDetailUrl()),"detail"===e.type&&(this.getData(),this.type=e.type),"scan"===e.type)&&(this.listPaintings=null===(n=t.getStorageSync("scanlist"))||void 0===n?void 0:n.map((function(t){return l(l({},t),{},{expectedPayment:"",warehouseID:"",fileList1:[{url:t.artworkImg}]})})));this.listPaintings=t.getStorageSync("orderingInfo").listPaintings},mounted:function(){var t=this;this.getCycle(),this.$mp.query.url&&(this.url=this.$mp.query.url,this.getDetailUrl()),this.getAddress(),this.$nextTick((0,a.default)(r.default.mark((function e(){return r.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,t.getElementHeight(".content-scroll");case 2:t.itemHeight=e.sent,t.getheight();case 4:case"end":return e.stop()}}),e)}))))},methods:{getElementHeight:function(e){return new Promise((function(n,i){var r=t.createSelectorQuery();r.select(e).boundingClientRect((function(t){t?n(t.height):i(new Error("无法获取元素高度"))})).exec()}))},scrollDetail:function(t){var e=this;return(0,a.default)(r.default.mark((function n(){var i,a,s;return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:i=t.detail.scrollTop,a=e.listPaintings.length*e.itemHeight,i/a*100,s=Math.floor(i/e.itemHeight),e.currentIndex=s;case 5:case"end":return n.stop()}}),n)})))()},getData:function(){var t=this;return(0,a.default)(r.default.mark((function e(){var n,i;return r.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n={ID:Number(t.$mp.query.ID)},e.next=3,(0,u.postDataByParams)("/api/v2/warehouse/detail",n);case 3:i=e.sent,200===i.code&&(t.info=i.data);case 5:case"end":return e.stop()}}),e)})))()},changeHandler:function(t){var e=t.columnIndex,n=(t.value,t.values,t.index,t.picker),i=void 0===n?this.$refs.uPicker:n;2===e&&i.setColumnValues(this.columns.length-1,[this.columns[2][t.index]*this.columns[0][0]])},itemDelete:function(){var t=this;this.listPaintings.splice(this.currentIndex,1),this.currentIndex=0,1===this.listPaintings.length&&(this.contentListHeight=0),this.$nextTick((function(){t.getheight()}))},itemClick:function(t){this.scrollId="item-".concat(t),this.currentIndex=t},addPainting:function(){var t=this;this.listPaintings.push({expectedPayment:"",fileList1:[],artworkNum:"",artworkName:"",artistName:"",artworkSquareSize:"",warehouseID:this.listPaintings[0].warehouseID,endAt:this.listPaintings[0].endAt}),this.$nextTick((function(){t.getheight()})),this.currentIndex=this.currentIndex+1},getheight:function(){var e=this,n=t.createSelectorQuery().in(this);n.select(".content-list").boundingClientRect((function(n){if(n){var i=t.createSelectorQuery().in(e);i.select(".titile-d").boundingClientRect((function(t){t&&(e.contentListHeight=n.bottom-t.bottom)})).exec()}})).exec()},expand1:function(){this.isExpand1=!this.isExpand1},expand:function(){this.isExpand?this.listHeight=308:this.listHeight=154*(this.listPaintings.length<=7?this.listPaintings.length:7),this.isExpand=!this.isExpand},timestampToDateString:function(t){var e=new Date(t),n=e.getFullYear(),i=("0"+(e.getMonth()+1)).slice(-2),r=("0"+e.getDate()).slice(-2);return n+"-"+i+"-"+r},confirmDate:function(t){this.listPaintings[this.currentIndex].endAt=t.value[t.value.length-1],this.obtainAmount(),this.show_1=!1},openShow1:function(){this.listPaintings[this.currentIndex].artworkSquareSize?this.show_1=!0:t.showToast({title:"请先填写画作平尺数",duration:2e3,icon:"none"})},uploadFilePromise:function(e){return new Promise((function(n){t.uploadFile({url:o.default.baseUrl+"/api/wxuser/uploadpic",filePath:e,name:"file",success:function(t){var e=JSON.parse(t.data).data.path;n(e)}})}))},deletePic:function(){this.fileList1=[]},afterRead:function(t,e){var n=this;return(0,a.default)(r.default.mark((function i(){var a,s,o,u,c;return r.default.wrap((function(i){while(1)switch(i.prev=i.next){case 0:a=[].concat(t.file),s=n.listPaintings[e].fileList1.length,a.map((function(t){n.listPaintings[e].fileList1.push(l(l({},t),{},{status:"uploading",message:"上传中"}))})),o=0;case 4:if(!(o<a.length)){i.next=14;break}return i.next=7,n.uploadFilePromise(a[o].url,"check");case 7:u=i.sent,c=n.listPaintings[e].fileList1[s],n.listPaintings[e].fileList1.splice(s,1,Object.assign(c,{status:"success",message:"",url:u})),s++;case 11:o++,i.next=4;break;case 14:case"end":return i.stop()}}),i)})))()},signContract:function(){var e=this;return(0,a.default)(r.default.mark((function n(){var i,a,s;return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return e.loading=!0,i={batchId:t.getStorageSync("orderingInfo").transactionId},n.next=4,(0,u.postDataByParams)("/api/v2/warehouse/create",i);case 4:if(a=n.sent,200!==a.code){n.next=10;break}return n.next=8,(0,u.postDataByParams)("/api/v2/warehouse/paid",{ID:a.data.ID});case 8:s=n.sent,200===s.code&&t.requestPayment(l(l({},s.data),{},{fail:function(t){e.loading=!1},success:function(){e.loading=!1,t.navigateTo({url:"/pages/paySuccess/paySuccess?ID=".concat(a.data.ID)})}}));case 10:case"end":return n.stop()}}),n)})))()},obtainAmount:function(){var e=this;return(0,a.default)(r.default.mark((function n(){var i,a,s,o,c,l,d,f;return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return t.setStorageSync("endAt",null===(i=new Date(Date.now()+864e5*e.listPaintings[e.currentIndex].endAt))||void 0===i||null===(a=i.toISOString())||void 0===a?void 0:a.slice(0,10)),c={orders:[{artworkSquareSize:Number(e.listPaintings[e.currentIndex].artworkSquareSize),endAt:null===(s=new Date(Date.now()+864e5*e.listPaintings[e.currentIndex].endAt))||void 0===s||null===(o=s.toISOString())||void 0===o?void 0:o.slice(0,10)}]},n.next=4,(0,u.postDataByParams)("/api/v2/warehouse/calculate",c);case 4:l=n.sent,200===l.code&&(e.listPaintings[e.currentIndex].expectedPayment=null===(d=l.data.orders)||void 0===d||null===(f=d[0])||void 0===f?void 0:f.money);case 6:case"end":return n.stop()}}),n)})))()},confirmCycle:function(){this.show_1=!1},confirmAddress:function(){this.show_2=!1},selectAddress:function(t){this.listPaintings[this.currentIndex].warehouseID=t.ID},selectionPeriod:function(t){this.cycleId=t.ID},getCycle:function(){var t=this;return(0,a.default)(r.default.mark((function e(){var n;return r.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.postDataByParams)("/api/warehouse/cycle");case 2:n=e.sent,200===n.code&&(t.cycleList=n.data.data);case 4:case"end":return e.stop()}}),e)})))()},getAddress:function(){var t=this;return(0,a.default)(r.default.mark((function e(){var n;return r.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.postDataByParams)("/api/warehouse/address");case 2:n=e.sent,200===n.code&&(t.addressList=n.data.data);case 4:case"end":return e.stop()}}),e)})))()},getDetailUrl:function(){var e=this;return(0,a.default)(r.default.mark((function n(){var i,a;return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return i={url:e.url},n.next=3,(0,u.postDataByParams)("/api/warehouse/ocr",i);case 3:a=n.sent,200===a.code?(e.info=a.data,e.fileList1=[{url:e.info.artworkImg}]):t.showToast({title:a.msg,icon:"none"});case 5:case"end":return n.stop()}}),n)})))()},isDateFont:function(t,e){if(Array.isArray&&3===this.data.length)return this.data[e]===t},changeData:function(t){this.data=[t.detail.value[0]+1990,t.detail.value[1]+1,t.detail.value[2]+1]},back:function(){"detail"===this.type?t.switchTab({url:"/pages/home/index"}):t.navigateBack({delta:2})}}};e.default=d}).call(this,n(2)["default"])},286:function(t,e,n){"use strict";n.r(e);var i=n(287),r=n.n(i);for(var a in i)["default"].indexOf(a)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(a);e["default"]=r.a},287:function(t,e,n){}},[[279,"common/runtime","common/vendor"]]]);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/confirm-order/index.js.map