Files
cmgd-mini-app/unpackage/dist/build/mp-weixin/pages/config/price.js
2026-01-05 12:47:14 +08:00

2 lines
11 KiB
JavaScript

"use strict";const e=require("../../common/vendor.js"),o=require("../../api/config.js"),l=require("../../api/house_goods.js");if(!Array){(e.resolveComponent("z-tabs")+e.resolveComponent("nut-noticebar")+e.resolveComponent("nut-button")+e.resolveComponent("nut-input")+e.resolveComponent("nut-radio")+e.resolveComponent("nut-radio-group")+e.resolveComponent("nut-menu-item")+e.resolveComponent("nut-menu")+e.resolveComponent("nut-tag")+e.resolveComponent("z-paging")+e.resolveComponent("nut-popup")+e.resolveComponent("nut-switch")+e.resolveComponent("nut-cell"))()}Math||((()=>"../../uni_modules/z-tabs/components/z-tabs/z-tabs.js")+(()=>"../../uni_modules/nutui-uni/components/noticebar/noticebar.js")+(()=>"../../uni_modules/nutui-uni/components/button/button.js")+(()=>"../../uni_modules/nutui-uni/components/input/input.js")+(()=>"../../uni_modules/nutui-uni/components/radio/radio.js")+(()=>"../../uni_modules/nutui-uni/components/radiogroup/radiogroup.js")+(()=>"../../uni_modules/nutui-uni/components/menuitem/menuitem.js")+(()=>"../../uni_modules/nutui-uni/components/menu/menu.js")+(()=>"../../uni_modules/nutui-uni/components/tag/tag.js")+(()=>"../../uni_modules/z-paging/components/z-paging/z-paging.js")+(()=>"../../uni_modules/nutui-uni/components/popup/popup.js")+(()=>"../../uni_modules/nutui-uni/components/switch/switch.js")+(()=>"../../uni_modules/nutui-uni/components/cell/cell.js"))();const a={__name:"price",setup(a){e.onLoad((e=>{}));const n=e=>{var o,l,a;const n=null==(a=null==(l=null==(o=null==e?void 0:e.goods_house)?void 0:o.image)?void 0:l[0])?void 0:a.file_path;return n?n+"?imageView2/1/w/200/h/200":""},t=()=>{o.fetchGetConfig().then((e=>{console.log("getConfig=====>",e),j.value=1==e.appConfig.is_warehouse}))},i=e=>{const o=(z.value||z).find((o=>o.product_id===e.goods_id));if(!o)return"未单独设置";const l=Number(e.goods_price),a=Number(o.val);let n=l;return 1==o.val_type?n=l+a:2==o.val_type&&(n=l+l*a/100),n.toFixed(2)},u=e.ref(null),r=e.ref([]),d=e.ref([]),s=e.ref([]),p=e.ref(null),c=e.ref(null),_=e.ref(null),v=e.reactive({type_params:[],drop_down_options:[],o_drop_down_options:[],price_sort_params:[{text:"默认排序",value:""},{text:"价格升序",value:"ascend"},{text:"价格降序",value:"descend"}],degree_params:[],price_sort:"",price_sort_name:"默认排序",degree_ids:[],degree_name:"成色",product_name:"机型",type_id:1,type_name:"手机",brand_id:0,brand_name:"全部",product_ids:[0]}),g=e.computed((()=>{var e;return null==(e=null==v?void 0:v.o_drop_down_options[v.type_id])?void 0:e.children[v.brand_id].children})),m=(e,o)=>{const a={pageSize:o,page:e,price_sort:v.price_sort,degree_ids:v.degree_ids,type_id:v.type_id,brand_id:v.brand_id,product_ids:v.product_ids,search:v.search_val};l.houseFetchGoodsList(a).then((e=>{console.log(e),u.value.complete(e.list),d.value=e.user_cart_goods_ids,s.value=e.cart_goods_ids})).catch((e=>{u.value.complete(!1),d.value=[],s.value=[]}))};e.onMounted((()=>{b()}));const b=()=>{console.log("init"),t(),o.fetchGetPriceRules().then((e=>{var o;console.log("res",e),P.value=(null==e?void 0:e.range)??[],z.value=(null==e?void 0:e.single)??[],Object.assign(x,(null==(o=null==e?void 0:e.warehouse)?void 0:o[0])??{val:"",val_type:1})})),l.houseFetchFilterParmas().then((e=>{console.log(e);let o=e.degree_list;v.degree_params=o.reduce(((e,o)=>(e.push({text:o.degree_name,value:o.degree_id}),e)),v.degree_params)||[],v.type_params=e.type_list,v.drop_down_options=e.drop_down_options,v.o_drop_down_options=e.o_drop_down_options}))},h=o=>{var l;console.log(o.goods_house),e.index.previewImage({urls:null==(l=null==o?void 0:o.goods_house)?void 0:l.image.map((e=>e.file_path))})},y=e.ref(["区间调价","单机调价","整仓调价"]),f=e.ref(0),w=e=>{f.value=e},j=e.ref(!1),x=e.reactive({val:"",val_type:1}),C=l=>{console.log(j.value),(()=>{let l={is_warehouse:Number(j.value)};o.fetchSetConfig(l).then((o=>{e.index.showToast({icon:"none",title:"操作成功"})}))})()},z=e.ref([]),k=e.reactive({val:"",val_type:1,product_id:0}),V=e.ref(!1),R=e.reactive({}),O=()=>{Object.assign(R,{}),Object.assign(k,{val:"",val_type:1,product_id:0}),V.value=!1,console.log("关闭")},P=e.ref([]),S=()=>{console.log(P.value),P.value.unshift({min_price:"",max_price:"",val:"",val_type:1})},q=()=>{console.log(P.value);let e={rangeRule:P.value};console.log(e),D(e,1)},D=(l,a)=>{o.fetchSetPriceRules(l).then((l=>{e.index.showToast({icon:"none",title:"规则配置成功"}),o.fetchGetPriceRules().then((e=>{var o;console.log("res",e),P.value=(null==e?void 0:e.range)??[],z.value=(null==e?void 0:e.single)??[],Object.assign(x,(null==(o=null==e?void 0:e.warehouse)?void 0:o[0])??{val:"",val_type:1}),2==a&&(O(),u.value.refresh()),3==a&&t()}))}))};return(o,l)=>{var a,t,b,z,F,G;return e.e({a:e.o(w),b:e.p({list:y.value,"active-color":"rgba(233, 100, 67, 1)"}),c:0==f.value},0==f.value?{d:e.p({text:"区间调价:可以针对价格区间进行批量固定加价,或者按照原价的百分比加价",background:"rgba(251, 248, 220, 1)","custom-color":"#D9500B"})}:{},{e:1==f.value},1==f.value?{f:e.p({text:"单机调价:针对某款机器进行固定加价,或者按照原价的百分比加价",background:"rgba(251, 248, 220, 1)","custom-color":"#D9500B"})}:{},{g:2==f.value},2==f.value?{h:e.p({text:"整仓调价:针对整个仓库进行固定加价,或者按照原价的百分比加价",background:"rgba(251, 248, 220, 1)","custom-color":"#D9500B"})}:{},{i:0==f.value},0==f.value?{j:e.o(S),k:e.p({type:"primary",plain:!0}),l:e.o(q),m:e.p({type:"primary"}),n:e.f(P.value,((o,l,a)=>({a:"b585ac35-6-"+a,b:e.o((e=>o.min_price=e),l),c:e.p({type:"number",placeholder:"0","input-align":"right",modelValue:o.min_price}),d:"b585ac35-7-"+a,e:e.o((e=>o.max_price=e),l),f:e.p({type:"number",placeholder:"0","input-align":"right",modelValue:o.max_price}),g:"b585ac35-8-"+a,h:e.o((e=>o.val=e),l),i:e.p({type:"number",placeholder:"0","input-align":"right",modelValue:o.val}),j:"b585ac35-10-"+a+",b585ac35-9-"+a,k:"b585ac35-11-"+a+",b585ac35-9-"+a,l:"b585ac35-9-"+a,m:e.o((e=>o.val_type=e),l),n:e.p({direction:"horizontal",modelValue:o.val_type}),o:e.o((e=>(e=>{P.value.splice(e,1)})(l)),l),p:"b585ac35-12-"+a,q:l}))),o:e.p({label:1}),p:e.p({label:2}),q:e.p({type:"danger",size:"mini"})}:{},{r:1==f.value},1==f.value?{s:e.f(v.price_sort_params,((o,l,a)=>({a:e.t(o.text),b:v.price_sort===o.value?1:"",c:l,d:e.o((e=>(e=>{var o;v.price_sort!==e.value?(v.price_sort=e.value,v.price_sort_name=e.text):(v.price_sort_name="默认排序",v.price_sort=""),null==(o=p.value)||o.toggle(!1),u.value.reload()})(o)),l)}))),t:e.sr(p,"b585ac35-14,b585ac35-13",{k:"selectPriceSortRef"}),v:e.p({title:v.price_sort_name}),w:e.f(v.type_params,((o,l,a)=>({a:e.t(o.name),b:l,c:e.o((e=>(e=>{console.log(e),v.type_id=e.type_id,v.type_name=e.name,v.brand_id=0,v.brand_name="全部",v.product_ids=[0]})(o)),l),d:v.type_id==o.type_id?1:""}))),x:e.f(null==(a=null==v?void 0:v.drop_down_options[v.type_id])?void 0:a.children,((o,l,a)=>({a:e.t(o.label),b:l,c:e.o((e=>{return l=o,console.log(l),v.brand_id=l.value,v.brand_name=l.label,v.product_ids=[0],void(v.product_name=l.label);var l}),l),d:o.value==v.brand_id?1:""}))),y:e.f(g.value,((o,l,a)=>({a:e.t(o.label),b:l,c:v.product_ids.includes(o.value)?1:"",d:e.o((e=>(e=>{if(0===e.value)v.product_ids=[0];else{v.product_ids=v.product_ids.filter((e=>0!=e));const o=v.product_ids.indexOf(e.value);o>-1?(v.product_ids.splice(o,1),0===v.product_ids.length&&(v.product_ids=[0])):v.product_ids.push(e.value)}console.log(e)})(o)),l)}))),z:e.o((e=>(console.log("重置产品"),v.type_id=1,v.type_name="手机",v.brand_id=0,v.brand_name="全部",v.product_ids=[0],void(v.product_name="机型")))),A:e.p({plain:!0,type:"default"}),B:e.o((e=>(()=>{var e;console.log("当前产品类型",{type_id:v.type_id,type_name:v.type_name,brand_id:v.brand_id,brand_name:v.brand_name,product_ids:v.product_ids}),null==(e=_.value)||e.toggle(!1),u.value.reload()})())),C:e.p({block:!0,type:"primary"}),D:e.sr(_,"b585ac35-15,b585ac35-13",{k:"selectProductRef"}),E:e.p({title:v.product_name}),F:e.f(v.degree_params,((o,l,a)=>({a:e.t(o.text),b:v.degree_ids.includes(o.value)?1:"",c:l,d:e.o((e=>(e=>{const o=v.degree_ids.indexOf(e.value);o>-1?v.degree_ids.splice(o,1):v.degree_ids.push(e.value),v.degree_ids.length>0?v.degree_name="已选"+v.degree_ids.length.toString()+"项":v.degree_name="成色"})(o)),l)}))),G:e.o((e=>(()=>{var e;v.degree_ids=[],v.degree_name="成色",null==(e=c.value)||e.toggle(!1),u.value.reload()})())),H:e.p({plain:!0,type:"default"}),I:e.o((e=>(()=>{var e;v.degree_ids.length>0?v.degree_name="已选"+v.degree_ids.length.toString()+"项":v.degree_name="成色",null==(e=c.value)||e.toggle(!1),u.value.reload()})())),J:e.p({block:!0,type:"primary"}),K:e.sr(c,"b585ac35-18,b585ac35-13",{k:"selectDegreeRef"}),L:e.p({title:v.degree_name}),M:e.p({"title-class":"titleClass"}),N:e.f(r.value,((o,l,a)=>e.e({a:n(o),b:e.o((e=>h(o)),l),c:e.t(o.goods_house.degree.degree_name),d:"b585ac35-22-"+a+",b585ac35-21",e:e.t(o.goods_house.goods_name),f:e.t(o.goods_house.content),g:e.t(o.goods_house.goods_price),h:e.t(i(o)),i:!s.value.includes(o.goods_id)&&!d.value.includes(o.goods_id)},s.value.includes(o.goods_id)||d.value.includes(o.goods_id)?{m:"b585ac35-24-"+a+",b585ac35-21",n:e.p({size:"small",plain:!0})}:{j:e.o((e=>{return l=o,console.log("----",l),Object.assign(R,l),V.value=!0,void console.log("----",R.value);var l}),l),k:"b585ac35-23-"+a+",b585ac35-21",l:e.p({size:"small",type:"primary"})},{o:l}))),O:e.p({"custom-color":"#1a1a1a"}),P:e.sr(u,"b585ac35-21",{k:"paging"}),Q:e.o(m),R:e.o((e=>r.value=e)),S:e.p({fixed:!1,"refresher-enabled":!1,"auto-clean-list-when-reload":!1,"auto-scroll-to-top-when-reload":!1,modelValue:r.value})}:{},{T:n(R),U:e.o((e=>h(R))),V:e.t(null==(b=null==(t=null==R?void 0:R.goods_house)?void 0:t.degree)?void 0:b.degree_name),W:e.p({"custom-color":"#1a1a1a"}),X:e.t(null==(z=null==R?void 0:R.goods_house)?void 0:z.goods_name),Y:e.t(null==(F=null==R?void 0:R.goods_house)?void 0:F.content),Z:e.t(null==(G=null==R?void 0:R.goods_house)?void 0:G.goods_price),aa:e.t(i(R)),ab:e.o((e=>k.val=e)),ac:e.p({type:"number",placeholder:"0","input-align":"right",modelValue:k.val}),ad:e.p({label:1}),ae:e.p({label:2}),af:e.o((e=>k.val_type=e)),ag:e.p({direction:"horizontal",modelValue:k.val_type}),ah:e.o((e=>(()=>{k.product_id=R.goods_id,console.log("tempSingleRule.value",k);let e={singleRule:{...k}};console.log(e),D(e,2)})())),ai:e.p({type:"primary",block:!0}),aj:e.o(O),ak:e.o((e=>V.value=e)),al:e.p({"custom-style":{height:"45%"},position:"bottom","safe-area-inset-bottom":!0,visible:V.value}),am:2==f.value},2==f.value?{an:e.o(C),ao:e.o((e=>j.value=e)),ap:e.p({modelValue:j.value}),aq:e.o((e=>x.val=e)),ar:e.p({type:"number",placeholder:"0","input-align":"right",modelValue:x.val}),as:e.p({label:1}),at:e.p({label:2}),av:e.o((e=>x.val_type=e)),aw:e.p({direction:"horizontal",modelValue:x.val_type}),ax:e.o((e=>(()=>{console.log(x);let e={warehouseRule:{...x}};console.log(e),D(e,3)})())),ay:e.p({type:"primary",block:!0})}:{})}}},n=e._export_sfc(a,[["__scopeId","data-v-b585ac35"]]);wx.createPage(n);