| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715 |
- /*******************************************************************************
- * Copyright(c) 2022 dongke All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:商品选择相关共通方法
- * 2.功能描述:首页 促销商品选择,购物车页面,开单选商品,退还补选商品
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 于继渤 2022-09-01 1.00 商品选择相关共通方法(方便维护)
- *******************************************************************************/
- const app = getApp()
- const api = require('./api.js');
- const Constants = require('./Constants.js');
- const common = require('./common.js');
- const util = require('./util.js');
- /**
- * @desc : 打开商品
- * @author : 于继渤
- * @date : 2022/7/2 20:16
- */
- function openAddItemInfoCommon(e, _this, page, type) {
- _this.setData({
- goodsSkuList: []
- })
- let item = e.currentTarget.dataset.item
- //促销类型
- let promotionType = e.currentTarget.dataset.item.promotionType
- item['priceStandardTemp'] = item.priceStandard
- //开单/退还补选商品页面
- if (page == 'choose-goods') {
- item.itemQuantity = 1
- //促销价
- item.pricePromotion = e.currentTarget.dataset.item.pricePromotion
- item.activityId = e.currentTarget.dataset.item.activityId
- item.warehouseId = app.globalData.user.whId
- item.whId = app.globalData.user.whId
- item.warehouseName = app.globalData.user.whName
- // 组合促销
- if (promotionType == Constants.PROMOTION_TYPE.COMBINED) {
- getCombinedByPriceId(e, _this);
- _this.setData({
- show1: false,
- show2: false,
- show3: false,
- show4: true,
- show5: false
- })
- }
- else {
- //非标淋浴房 2定制
- if (item.flgNonStandardType == 1 || item.flgNonStandardType == 2) {
- item.nonStandardList = []
- item.nonStandardArea = 1
- //加载默认spu非标参数数据
- getFlgNonStandardList(item, _this)
- _this.setData({
- show7: true
- })
- }
- // 根据spuId获取sku相关信息
- getSkuBySpuId(e, _this);
- _this.setData({
- show1: true,
- show2: false,
- show3: false,
- show4: false,
- show5: false
- })
- }
- _this.setData({
- currentChoosedItem: item,
- showAdd: true,
- })
- }
- //购物车页面
- if (page == 'shopping') {
- item.itemQuantity = 1
- //促销价
- item.pricePromotion = e.currentTarget.dataset.item.pricePromotion
- item.activityId = e.currentTarget.dataset.item.activityId
- item.warehouseId = app.globalData.user.whId
- item.whId = app.globalData.user.whId
- item.warehouseName = app.globalData.user.whName
- // 组合促销
- if (promotionType == Constants.PROMOTION_TYPE.COMBINED) {
- getCombinedByPriceId(e, _this, type);
- _this.setData({
- show1: false,
- show2: false,
- show3: false,
- show4: true,
- show5: false
- })
- }
- else {
- //非标淋浴房
- if (item.flgNonStandardType == 1 || item.flgNonStandardType == 2) {
- item.nonStandardArea = 1
- item.nonStandardList = []
- //加载默认spu非标参数数据
- getFlgNonStandardList(item, _this)
- _this.setData({
- show7: true
- })
- }
- // 根据spuId获取sku相关信息
- getSkuBySpuId(e, _this);
- _this.setData({
- show1: true,
- show2: false,
- show3: false,
- show4: false,
- show5: false
- })
- }
- _this.setData({
- currentChoosedItem: item,
- showAdd: true,
- })
- }
- //其他出库页面
- if (page == 'otherOutbound') {
- item.itemQuantity = 1
- _this.setData({
- currentChoosedItem: item,
- showAdd: true,
- })
- }
- //其他入库页面
- if (page == 'choose-sku-product') {
- item.itemQuantity = 1
- //非标淋浴房 2定制
- if (item.flgNonStandardType == 1 || item.flgNonStandardType == 2) {
- item.nonStandardList = []
- item.nonStandardArea = 1
- //加载默认spu非标参数数据
- // getFlgNonStandardList(item, _this)
- _this.setData({
- show7: true
- })
- }
- // 根据spuId获取sku相关信息
- //getSkuBySpuIdProduct(e, _this);
- _this.setData({
- show1: false,
- show2: false,
- show3: false,
- show4: false,
- show5: false,
- show5: true
- })
- _this.setData({
- currentChoosedItem: item,
- showAdd: true,
- })
- }
- }
- /**
- * @desc : 选择非标参数事件
- * @author : 于继渤
- * @date : 2022/8/24 13:16
- */
- function nonStandardTap(e, _this) {
- let currentChoosedItem = _this.data.currentChoosedItem
- let nonStandardList = currentChoosedItem.nonStandardList
- let pindex = e.currentTarget.dataset.pindex //父索引
- let indext = e.currentTarget.dataset.indext //子索引
- let itemt = e.currentTarget.dataset.itemt //子对象
- console.log('选择非标参数事件', currentChoosedItem)
- nonStandardList[pindex].options.forEach(res => {
- res.infotype = 'default'
- })
- if (itemt.infotype == 'info') {
- return
- }
- nonStandardList[pindex].options[indext].infotype = itemt.infotype == 'info' ? 'default' : 'info'
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- //设置非标匹配参数
- setNonStandardMatchingParameters(_this)
- }
- /**
- * @desc : 设置非标匹配参数
- * @author : 于继渤
- * @date : 2022/8/24 13:16
- */
- function setNonStandardMatchingParameters(_this) {
- //当前选择的商品信息
- let currentChoosedItem = _this.data.currentChoosedItem
- //非标参数 数组(根据参数不同对应不同数据)
- let nonStandardList = currentChoosedItem.nonStandardList
- //非标参数保存用的 json 数据
- let nonGlassList = []
- let skuData = currentChoosedItem.skuData
- if (nonStandardList && nonStandardList.length > 0) {
- //判断哪些按钮状态为info 代表当前选中
- nonStandardList.forEach(res => {
- if (res.options && res.options.length > 0) {
- //遍历可选中的参数
- res.options.forEach(item => {
- if (item.infotype == 'info') {
- //选中的数据
- //编辑非标JSON
- nonGlassList.push({
- fieldId: res.fieldId,
- fieldCode: res.fieldCode,
- fieldName: res.fieldName,
- option_code: item.code,
- option_name: item.name,
- })
- }
- })
- }
- })
- currentChoosedItem.nonGlassList = nonStandardList
- //设置显示非标参数 (展示非标text)
- if (nonGlassList && nonGlassList.length > 0) {
- let nonGlassListShowTemp = []
- nonGlassList.forEach(it => {
- if (it.option_name && it.option_name != undefined) {
- nonGlassListShowTemp.push(it.fieldName + ':' + it.option_name)
- }
- })
- //非标参数显示/匹配命中标价的数据
- currentChoosedItem.nonGlassListShow = nonGlassListShowTemp.join(',')
- }
- //设置当前sku的所有非标标价数组
- skuData.forEach(res => {
- if (res.skuId == currentChoosedItem.skuId) {
- //赋值
- currentChoosedItem.nonGlassPriceItems = res.nonGlassPriceItems
- }
- })
- //非标商品匹配标价
- matchingListPrice(currentChoosedItem, currentChoosedItem.nonGlassPriceItems, currentChoosedItem.nonGlassListShow, _this)
-
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }else{
- console.log('没有匹配SKU')
- }
- }
- /**
- * @desc : 非标商品匹配标价
- * @author : 于继渤
- * @date : 2022/8/24 13:16
- */
- function matchingListPrice(currentChoosedItem, nonGlassPriceItems, nonGlassListShow, _this) {
- console.log('currentChoosedItem', currentChoosedItem)
- //铝材颜色:亮光-不锈钢,工艺:蒙砂-正,定制柜系列:B系列
- if (nonGlassPriceItems && nonGlassPriceItems.length > 0) {
- let flgItemList = [] //匹配到的标价数据
- // console.log('已选参非标商参数',nonGlassListShow)
- nonGlassPriceItems.forEach(res => {
- let flag = true
- let nonGlassListShowArr = res.nonGlassListShowArr
- if (nonGlassListShowArr && nonGlassListShowArr.length > 0) {
- console.log('-----------------------')
- res.nonGlassListShowArr.forEach(item => {
- let nonGlassListShowTwo = nonGlassListShow.split(',')
- console.log('已选参数=> ', nonGlassListShow)
- console.log('可用参数=> ', res.nonGlassListShow)
- console.log('是否包含=> ', (!nonGlassListShowTwo.includes(item) || res.nonGlassListShowArr.length != nonGlassListShowTwo.length) ? '不包含->' : '包含->', item)
- console.log('-----------------------')
- if (!nonGlassListShowTwo.includes(item) || res.nonGlassListShowArr.length != nonGlassListShowTwo.length) {
- flag = false
- }
- })
- } else {
- flag = false
- }
- if (flag) {
- flgItemList.push(res)
- }
- })
- //如果匹配到数据 设置默认标价
- if (flgItemList.length > 0) {
- console.log('匹配到数据', flgItemList)
- currentChoosedItem.priceStandard = flgItemList[0].itemPrice //标价
- currentChoosedItem.priceSale = currentChoosedItem.priceStandard
- currentChoosedItem.itemAmount = currentChoosedItem.orderItemQuantity * currentChoosedItem.priceSale
- getCombinedDiscount(currentChoosedItem)
- //面积计算
- if (currentChoosedItem.nonStandardArea) {
- calculateFormulaItemAmount(currentChoosedItem, currentChoosedItem.nonStandardArea)
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }
- } else {
- if (currentChoosedItem.flgNonStandardType == 1) {
- currentChoosedItem.priceStandard = currentChoosedItem.nonGlassPriceDef ? currentChoosedItem.nonGlassPriceDef : Number(0)
- }
- //匹配到sku 但是没有匹配到标价 但是有价格
- if (currentChoosedItem.nonGlassPriceItems && currentChoosedItem.nonGlassPriceItems.length > 0) {
- let objItems = currentChoosedItem.nonGlassPriceItems.filter(res => {
- if (res.flgDefItem && (!res.nonGlassListShowArr || res.nonGlassListShowArr.length == 0)) {
- return res;
- }
- })
- if (objItems && objItems.length > 0) {
- console.log('匹配到sku 但是没有匹配到标价 但是有价格')
- currentChoosedItem.priceStandard = objItems[0].itemPrice
- } else {
- //sku标价改为spu标价
- console.log('sku标价改为spu标价')
- currentChoosedItem.priceStandard = currentChoosedItem.skuData.length > 0 ? currentChoosedItem.skuData[0].priceStandard : currentChoosedItem.priceStandardtemp
- }
- }
- currentChoosedItem.priceSale = currentChoosedItem.priceStandard
- currentChoosedItem.itemAmount = currentChoosedItem.orderItemQuantity * currentChoosedItem.priceSale
- getCombinedDiscount(currentChoosedItem)
- }
- } else {
- console.log('没有设置非标参数')
- if (currentChoosedItem.flgNonStandardType == 1 || currentChoosedItem.flgNonStandardType == 2) {
- currentChoosedItem.priceStandard = Number(currentChoosedItem.priceStandardTemp ? currentChoosedItem.priceStandardTemp : 0)
- }
- currentChoosedItem.priceSale = currentChoosedItem.priceStandard
- currentChoosedItem.itemAmount = currentChoosedItem.orderItemQuantity * currentChoosedItem.priceSale
- getCombinedDiscount(currentChoosedItem)
- }
- }
- /**
- * @desc : 非标商品选择事件
- * @author : 于继渤
- * @date : 2022/8/24 13:16
- */
- function nonGlassSpuItemsTap(e, _this) {
- let currentChoosedItem = _this.data.currentChoosedItem
- let skuData = currentChoosedItem.skuData
- let indext = e.currentTarget.dataset.indext //子索引
- let itemt = e.currentTarget.dataset.itemt //子对象
- //初始化按钮状态
- skuData.forEach(res => {
- res.infotype = 'default'
- })
- let nonStandardList = []
- if (itemt.infotype == 'info') {
- return
- }
- //设置按钮状态
- skuData[indext].infotype = itemt.infotype == 'info' ? 'default' : 'info'
- // 设置默认skuId
- currentChoosedItem.defSkuId = itemt.skuId
- let nonStandardListFlag = true
- if (skuData[indext].infotype == 'info') {
- nonStandardList = skuData[indext].nonGlassSpuItems
- if (!skuData[indext].nonGlassSpuItems || skuData[indext].nonGlassSpuItems.length == 0) {
- if (currentChoosedItem.nonGlassList) {
- let nonStandardListCopy = util.copyObj(currentChoosedItem.nonGlassList)
- //没设置标价显示spu默认
- nonStandardList = nonStandardListCopy
- nonStandardListFlag = false
- }
- } else {
- console.log('没有匹配上SKU')
- currentChoosedItem.priceSale = itemt.nonGlassPriceDef
- currentChoosedItem.itemAmount = itemt.nonGlassPriceDef
- }
- }
- _this.setData({
- nonStandardListFlag: nonStandardListFlag
- })
- currentChoosedItem.nonStandardList = nonStandardList
- _this.setData({
- skuData: skuData,
- defSkuId: skuData[indext].skuId,
- currentChoosedItem: currentChoosedItem
- })
- //数据格式化
- chooseSkuItem(_this);
- //设置默认参数
- if (skuData && skuData.length > 0 && itemt.skuId) {
- setDefault(skuData, itemt.skuId, _this)
- }
- //没匹配到标价为0
- // if (!nonStandardListFlag ) {
- // currentChoosedItem.priceStandard = 0
- // _this.setData({
- // currentChoosedItem: currentChoosedItem
- // })
- // }
- }
- /**
- * @desc : 非标商品非标参数输入事件
- * @author : 于继渤
- * @date : 2022/8/24 13:16
- */
- function bindInputIsScopeOne(e, _this) {
- }
- function bindBlurIsScopeOne(e, _this) {
- let currentChoosedItem = _this.data.currentChoosedItem
- let specialFormulaName = currentChoosedItem.specialFormulaName //面积公式
- let nonStandardList = currentChoosedItem.nonStandardList
- let index = e.currentTarget.dataset.pindex //大数组所在索引
- let item = e.currentTarget.dataset.item
- let value = e.detail.value
- if (value) {
- value = value.replace(/\s/g, '')
- }
- // if (nonStandardList[index].fieldType == 3) {
- // //数字类型判断最大值最小值
- // let maxValue = Number(nonStandardList[index].maxValue)
- // let minValue = Number(nonStandardList[index].minValue)
- // if(Number(value) > maxValue){
- // //大于最大值 为最大值
- // nonStandardList[index].optionName = maxValue
- // nonStandardList[index].optionCode = maxValue
- // } else if(Number(value) < minValue){
- // //小于最小值 为最小值
- // nonStandardList[index].optionName = minValue
- // nonStandardList[index].optionCode = minValue
- // }
- // else if (maxValue >= Number(value) >= minValue) {
- // //最大值最小值之间
- // nonStandardList[index].optionName = Number(value)
- // nonStandardList[index].optionCode = Number(value)
- // }
- // }else{
- //TODO 非标参数 ios复制问题 2023/03/13 于继渤
- if (nonStandardList[index].fieldType == 3) {
- console.log('面积公式输入参数', value)
- //数字类型
- if (!checkNumber(value)) {
- console.log('请输入正确数字->', value)
- nonStandardList[index].optionName = ""
- nonStandardList[index].optionCode = ""
- } else {
- nonStandardList[index].optionName = value
- nonStandardList[index].optionCode = value
- }
- } else {
- nonStandardList[index].optionName = value
- nonStandardList[index].optionCode = value
- }
- // }
- calculateFormula(_this, currentChoosedItem)
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }
- function checkNumber(theObj) {
- var reg = /^[0-9]+.?[0-9]*$/;
- if (reg.test(theObj)) {
- return true;
- }
- return false;
- }
- function bindBlurIsScopeOne_t(e, _this) {
- let currentChoosedItem = _this.data.currentChoosedItem
- let specialFormulaName = currentChoosedItem.specialFormulaName //面积公式
- let nonStandardList = currentChoosedItem.nonStandardList
- let index = e.currentTarget.dataset.pindex //大数组所在索引
- let item = e.currentTarget.dataset.item
- let value = e.detail.value
- nonStandardList[index].optionName = value
- nonStandardList[index].optionCode = value
- calculateFormula_t(_this, currentChoosedItem)
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }
- /**
- * @desc : 计算面积
- * @author : 于继渤
- * @date : 2022/9/21 13:16
- */
- function calculateFormula(_this, currentChoosedItem) {
- let nonStandardList = currentChoosedItem.nonStandardList
- let itemAmount = currentChoosedItem.itemAmount
- currentChoosedItem.itemAmount_Temp = itemAmount
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- let formula = currentChoosedItem.specialFormulaName.toUpperCase()//公式
- let param = {
- }
- let API_FLAG = true
- if (nonStandardList && nonStandardList.length > 0) {
- let list = nonStandardList.filter(item => {
- return item.isScope == 1
- })
- if (list && list.length > 0) {
- list.forEach(res => {
- // if (res.optionCode && res.optionCode != '' && res.optionCode != 0) {
- // if (res.fieldName.indexOf('W1') != -1) {
- // param.W1 = Number(res.optionCode)
- // }
- // if (res.fieldName.indexOf('W2') != -1) {
- // param.W2 = Number(res.optionCode)
- // }
- // if (res.fieldName.indexOf('H') != -1) {
- // param.H = Number(res.optionCode)
- // }
- param[res.fieldName] = Number(res.optionCode) ? Number(res.optionCode) : null
- // } else {
- // //其中输入没参数 不计算
- // API_FLAG = false
- // }
- if (res.optionCode == "" || res.optionCode == null || res.optionCode == undefined) {
- API_FLAG = false
- }
- })
- }
- }
- let paramData = {
- formula: formula,//公式
- param: param
- }
- if (API_FLAG) {
- api.request(Constants.BPM_FORMULA_APPRAVAL + 'calculate_formula', 'POST', paramData).then(res => {
- console.log(res)
- if (res.data.code == 200) {
- if (typeof res.data.data === 'number') {
- //面积公式中包含【/1000】字符时,输入值不用除以1000,如不包括就要除以1000再计算
- //现在面积公式【(W1/1000+2*W2/1000)*H1/1000】、【(W1+2*W2)*H1】混合存在
- if (formula.indexOf('/1000') != -1) {
- //包含
- currentChoosedItem.nonStandardArea = res.data.data ? Number(res.data.data).toFixed(2) : 0
- } else {
- //不包含
- currentChoosedItem.nonStandardArea = res.data.data ? Number(res.data.data / 1000).toFixed(2) : 0
- }
- }
- if (currentChoosedItem.nonStandardArea) {
- //计算金额
- calculateFormulaItemAmount(currentChoosedItem, currentChoosedItem.nonStandardArea)
- }
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }
- })
- }
- }
- function calculateFormula_t(_this, currentChoosedItem) {
- let nonStandardList = currentChoosedItem.nonStandardList
- let itemAmount = currentChoosedItem.itemAmount
- currentChoosedItem.itemAmount_Temp = itemAmount
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- let formula = currentChoosedItem.specialFormulaName.toUpperCase()//公式
- let param = {
- }
- let API_FLAG = true
- if (nonStandardList && nonStandardList.length > 0) {
- let list = nonStandardList.filter(item => {
- return item.isScope == 1
- })
- if (list && list.length > 0) {
- console.log('面积接口', list)
- list.forEach(res => {
- // if (res.optionCode && res.optionCode != '' && res.optionCode != 0) {
- // if (res.fieldName.indexOf('W1') != -1) {
- // param.W1 = Number(res.optionCode)
- // }
- // if (res.fieldName.indexOf('W2') != -1) {
- // param.W2 = Number(res.optionCode)
- // }
- // if (res.fieldName.indexOf('H') != -1) {
- // param.H = Number(res.optionCode)
- // }
- param[res.fieldName] = Number(res.optionCode) ? Number(res.optionCode) : null
- // } else {
- // //其中输入没参数 不计算
- // API_FLAG = false
- // }
- if (res.optionCode == "" || res.optionCode == null || res.optionCode == undefined) {
- API_FLAG = false
- }
- })
- }
- }
- let paramData = {
- formula: formula,//公式
- param: param
- }
- if (API_FLAG) {
- api.request(Constants.BPM_FORMULA_APPRAVAL + 'calculate_formula', 'POST', paramData).then(res => {
- if (res.data.code == 200) {
- if (typeof res.data.data === 'number') {
- currentChoosedItem.nonStandardArea = res.data.data ? Number(res.data.data / 1000).toFixed(2) : 0
- }
- if (currentChoosedItem.nonStandardArea) {
- //计算金额
- calculateFormulaItemAmount(currentChoosedItem, currentChoosedItem.nonStandardArea, true)
- }
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }
- })
- }
- }
- //面积离焦事件
- function bindBlurNonStantardArea(e, _this, flag) {
- let value = e.detail.value
- if (value) {
- value = value.replace(/\s/g, '')
- }
- let currentChoosedItem = _this.data.currentChoosedItem
- if (value) {
- currentChoosedItem.nonStandardArea = Number(value)
- //调用 面积计算合计金额 面积*数量*售价
- calculateFormulaItemAmount(currentChoosedItem, currentChoosedItem.nonStandardArea, flag)
- } else {
- currentChoosedItem.nonStandardArea = 0
- }
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }
- // 面积计算合计金额 面积*数量*售价
- function calculateFormulaItemAmount(currentChoosedItem, value, flag) {
- if (flag) {
- if (currentChoosedItem.nonStandardArea) {
- currentChoosedItem.tItemAmount = Number(value * currentChoosedItem.itemQuantity * currentChoosedItem.priceSale).toFixed(2)
- } else {
- currentChoosedItem.tItemAmount = Number(currentChoosedItem.tItemQuantity * currentChoosedItem.priceSale)
- }
- } else {
- if (currentChoosedItem.nonStandardArea) {
- currentChoosedItem.itemAmount = Number(value * currentChoosedItem.itemQuantity * currentChoosedItem.priceSale).toFixed(2)
- } else {
- currentChoosedItem.itemAmount = Number(currentChoosedItem.itemQuantity * currentChoosedItem.priceSale).toFixed(2)
- }
- }
- }
- function bindInputNonStantardArea(e, _this) {
- }
- /**
- * @desc : 根据spuid查询非标参数
- * @author : 于继渤
- * @date : 2022/8/24 13:16
- */
- function getFlgNonStandardList(item, _this) {
- let param = {
- spuId: item.spuId,
- cpId: app.globalData.user.cpId
- }
- api.request(Constants.GOODS_SPU_API + 'get_flg_non_standard_list', 'POST', param).then(res => {
- if (res.data.code == 200) {
- let data = res.data.data
- if (data && data.length > 0) {
- data.forEach(item => {
- if (item.options && item.options.value && item.options.value != '[]') {
- item.options = JSON.parse(item.options.value)
- item.options.forEach(it => {
- it.infotype = 'default'
- })
- }
- })
- }
- let dataTemp = util.copyObj(data) //拷贝数据
- _this.setData({
- nonStandardList: dataTemp
- })
- item.nonGlassList = []
- item.nonGlassListShow = ''
- let data_nonStandardList = [...data]
- item.nonStandardList = data_nonStandardList
- }
- })
- }
- /**
- * @desc : 根据spuId获取sku数据
- * @date : 2022/9/1 13:49
- * @author : 于继渤
- */
- function getSkuBySpuId(e, _this) {
- _this.setData({
- skuloading: true
- })
- let item = e.currentTarget.dataset.item
- let param = {}
- // 要记录原始的标价、促销,活动Id
- item.standardIdSocial = item.standardIdSocial ? item.standardIdSocial : item.standardId
- item.promotionIdSocial = item.promotionIdSocial ? item.promotionIdSocial : item.promotionId
- item.activityIdSocial = item.activityIdSocial ? item.activityIdSocial : item.activityId
- param.spuId = item.spuId
- param.standardId = item.standardIdSocial
- param.promotionId = item.promotionIdSocial
- param.activityId = item.activityIdSocial
- param.cpId = app.globalData.user.cpId;
- param.orgId = app.globalData.user.orgId;
- param.customerId = app.globalData.user.sale2CustomerId ? app.globalData.user.sale2CustomerId : null
- api.request(Constants.GOODS_SPU_SPECS + 'select_sku_by_spu_id', 'POST', param).then(res => {
- if (res.data.code === 200) {
- let currentChoosedItem = _this.data.currentChoosedItem
- currentChoosedItem.nonGlassList = []
- currentChoosedItem.skuData = []
- let list = res.data
- // 获取默认的skuId
- let defSkuId = e.currentTarget.dataset.item.defSkuId;
- // 判断如果默认的skuId没有设置标价,那么要取价格最低的作为默认sku
- let filters = list.data.skuData.filter(it => it.skuId == defSkuId)
- if (filters && filters.length > 0) {
- if (filters[0].disabled) {
- defSkuId = null;
- item.pricePromotion = undefined;
- item.priceStandard = undefined;
- _this.setData({
- defSkuId: null
- })
- }
- }
- //判断规格是否有数据
- if (list.data.specsData && list.data.specsData.length == 0) {
- let flgNonStandardTypeFlag = false;
- list.data.skuData.forEach(item => {
- //设置默认商品按钮
- if (defSkuId == item.skuId) {
- //设置默认显示商品按钮
- item.infotype = 'info'
- if (item.flgNonStandardType && item.flgNonStandardType != 0) {
- flgNonStandardTypeFlag = true;
- if (item.flgNonStandardType == 2) {
- } else if (item.flgNonStandardType == 1) {
- item.priceStandard = item.nonGlassPriceDef
- }
- }
- // 有问题,直接跳过了促销价
- // item.priceSale = item.priceStandard ? item.priceStandard : 0
- item.priceSale = item.priceSale ? item.priceSale : (item.priceStandard ? item.priceStandard : 0)
- item.itemAmount = item.orderItemQuantity * item.priceSale
- getCombinedDiscount(item)
- }
- })
- if (flgNonStandardTypeFlag) {
- _this.setData({
- show6: true
- })
- }
- } else {
- _this.setData({
- show6: false
- })
- }
- if (list.data.specsData.length == 0 && list.data.skuData && list.data.skuData.length > 1) {
- _this.setData({
- show6: true
- })
- }
- currentChoosedItem.skuData = list.data.skuData
- currentChoosedItem.specsData = list.data.specsData
- currentChoosedItem.skuSpecsList = list.data.specsData
- _this.setData({
- skuData: list.data.skuData,
- currentChoosedItem: currentChoosedItem,
- skuSpecsList: list.data.specsData,
- defSkuId: defSkuId,
- })
- setSkuData(_this); // 把sku处理为相应的格式
- getSkuSpecs(defSkuId, _this); //判断规格是否可用
- if (e.currentTarget.dataset.item.flgNonStandardType == 1 || e.currentTarget.dataset.item.flgNonStandardType == 2) {
- //非标标价设置默认值
- setDefault(list.data.skuData, defSkuId, _this)
- }
- }
- // 设置赠品
- setFlgGift(_this);
- setTimeout(() => {
- _this.setData({
- skuloading: false
- })
- }, 100)
- })
- }
- /**
- * @desc : 根据spuId获取sku数据
- * @date : 2023年9月8日
- * @author : 王英杰
- */
- function getSkuBySpuIdProduct(e, _this) {
- _this.setData({
- skuloading: true
- })
- let item = e.currentTarget.dataset.item
- let param = {}
- param.spuId = item.spuId
- param.cpId = app.globalData.user.cpId;
- api.request(Constants.OTHER_IN + 'get_sku_for_other_entry', 'POST', param).then(res => {
- if (res.data.code === 200) {
- let currentChoosedItem = _this.data.currentChoosedItem
- currentChoosedItem.nonGlassList = []
- currentChoosedItem.skuData = []
- let list = res.data
- // 获取默认的skuId
- let defSkuId = e.currentTarget.dataset.item.defSkuId;
- // 判断如果默认的skuId没有设置标价,那么要取价格最低的作为默认sku
- let filters = list.data.skuData.filter(it => it.skuId == defSkuId)
- if (filters && filters.length > 0) {
- if (filters[0].disabled) {
- defSkuId = null;
- item.pricePromotion = undefined;
- item.priceStandard = undefined;
- _this.setData({
- defSkuId: null
- })
- }
- }
- //判断规格是否有数据
- if (list.data.specsData && list.data.specsData.length == 0) {
- let flgNonStandardTypeFlag = false;
- list.data.skuData.forEach(item => {
- //设置默认商品按钮
- if (defSkuId == item.skuId) {
- //设置默认显示商品按钮
- item.infotype = 'info'
- if (item.flgNonStandardType && item.flgNonStandardType != 0) {
- flgNonStandardTypeFlag = true;
- if (item.flgNonStandardType == 2) {
- } else if (item.flgNonStandardType == 1) {
- item.priceStandard = item.nonGlassPriceDef
- }
- }
- // 有问题,直接跳过了促销价
- // item.priceSale = item.priceStandard ? item.priceStandard : 0
- item.priceSale = item.priceSale ? item.priceSale : (item.priceStandard ? item.priceStandard : 0)
- item.itemAmount = item.orderItemQuantity * item.priceSale
- getCombinedDiscount(item)
- }
- })
- if (flgNonStandardTypeFlag) {
- _this.setData({
- show6: true
- })
- }
- } else {
- _this.setData({
- show6: false
- })
- }
- if (list.data.specsData.length == 0 && list.data.skuData && list.data.skuData.length > 1) {
- _this.setData({
- show6: true
- })
- }
- currentChoosedItem.skuData = list.data.skuData
- currentChoosedItem.specsData = list.data.specsData
- currentChoosedItem.skuSpecsList = list.data.specsData
- _this.setData({
- skuData: list.data.skuData,
- currentChoosedItem: currentChoosedItem,
- skuSpecsList: list.data.specsData,
- defSkuId: defSkuId,
- })
- setSkuData(_this); // 把sku处理为相应的格式
- getSkuSpecs(defSkuId, _this); //判断规格是否可用
- if (e.currentTarget.dataset.item.flgNonStandardType == 1 || e.currentTarget.dataset.item.flgNonStandardType == 2) {
- //非标标价设置默认值
- setDefault(list.data.skuData, defSkuId, _this)
- }
- }
- // 设置赠品
- setFlgGift(_this);
- setTimeout(() => {
- _this.setData({
- skuloading: false
- })
- }, 100)
- })
- }
- /**
- * @desc :非标标价设置默认值
- * @date : 2022/8/25 9:56
- * @author : 于继渤
- */
- function setDefault(skuData, defSkuId, _this) {
- //当前选中的商品非标参数数组
- let currentChoosedItem = _this.data.currentChoosedItem
- //校验数据不为空 否则报异常
- if (currentChoosedItem.nonStandardList && currentChoosedItem.nonStandardList.length > 0 && _this.data.nonStandardListFlag) {
- let list = []
- let obj = []
- //视图初始化非标标价组
- let nonStandardList = currentChoosedItem.nonStandardList
- //过滤出默认数据
- if (skuData && skuData.length > 0) {
- list = skuData.filter((item) => {
- return item.skuId == defSkuId;
- })
- }
- if (list.length > 0) {
- if (list[0].nonGlassPriceItems) {
- obj = list[0].nonGlassPriceItems.filter((item) => {
- return item.flgDefItem == true && list[0].skuId == item.skuId;
- })
- }
- }
- //默认标价组
- if (obj.length > 0) {
- let nonGlassList = obj[0].nonGlassList ? obj[0].nonGlassList : {}
- nonStandardList.forEach(res => {
- let temp = nonGlassList.filter((item) => {
- return item.fieldCode == res.fieldCode;
- })
- if (temp.length > 0) {
- //过滤出 spu显示的非标参数与默认的非标参数并改变按钮状态
- let options = res.options.filter((item) => {
- return item.infotype = ((item.code == temp[0].optionCode) || (item.code == temp[0].option_code)) ? 'default' : '';
- })
- if (options && options.length > 0) {
- options[0].infotype = 'info'
- }
- }
- })
- //设置显示非标参数 (展示非标text)
- if (nonGlassList && nonGlassList.length > 0) {
- let nonGlassListShowTemp = []
- nonGlassList.forEach(it => {
- if (it.optionName && it.optionName != undefined) {
- nonGlassListShowTemp.push(it.fieldName + ':' + it.optionName)
- }
- })
- //非标参数显示/匹配命中标价的数据
- currentChoosedItem.nonGlassListShow = nonGlassListShowTemp.join(',')
- }
- currentChoosedItem.pricePromotion = obj[0].itemPrice
- }
- currentChoosedItem.priceStandard = currentChoosedItem.priceStandard ? currentChoosedItem.priceStandard : 0
- currentChoosedItem.priceSale = currentChoosedItem.priceSale ? currentChoosedItem.priceSale : 0
- currentChoosedItem.itemAmount = currentChoosedItem.itemAmount ? currentChoosedItem.itemAmount : 0
- currentChoosedItem.nonStandardList = nonStandardList
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- } else {
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }
- }
- /**
- * @desc : 根据组合促销Id获取促销信息
- * @date : 2022/7/2 16:49
- * @author : 周兴
- */
- function getCombinedByPriceId(e, _this, type) {
- _this.setData({
- skuloading: true
- })
- let param = {}
- param.cpId = app.globalData.user.cpId;
- param.priceId = e.currentTarget.dataset.item.promotionId;
- param.orgId = app.globalData.user.orgId;
- api.request(Constants.PRICE_PROMOTION_ITEM + 'select_combined_by_price_id', 'POST', param).then(res => {
- _this.setData({
- loading: false
- })
- if (res.data.code === 200) {
- let currentChoosedItem = util.copyObj(_this.data.currentChoosedItem)
- let combinedData = res.data.data
- currentChoosedItem.combinedData = combinedData;
- currentChoosedItem.itemQuantity = 1; // 数量默认为1
- currentChoosedItem.itemAmount = currentChoosedItem.priceSale // 金额默认等于销售价格
- currentChoosedItem.discountPromotion = 100; // 默认为100
- if (combinedData.combinedItem != null && combinedData.combinedItem.length > 0) {
- currentChoosedItem.combinedData.combinedItem.forEach(item => {
- if (item.cpFlgGift) {
- item.flgGift = true
- item.priceSale_Temp = item.priceSale
- item.itemAmount_Temp = item.itemAmount
- item.discountStandard_Temp = item.discountStandard
- item.discountPromotion_Temp = item.discountPromotion
- item.priceSale = 0
- item.discountStandard = 0
- item.discountPromotion = 0
- item.itemAmount = 0
- if (item.skuType == 2) {
- if (item.bomItems && item.bomItems.length > 0) {
- item.bomItems.forEach(res => {
- res.priceSale = 0
- res.discountStandard = 0
- res.discountPromotion = 0
- res.itemAmount = 0
- })
- }
- }
- }
- })
- }
- let filterRows = currentChoosedItem.combinedData.combinedItem.filter(it => it.infotype == 'info');
- if (filterRows && filterRows.length > 0) {
- currentChoosedItem.combinedList = filterRows;// 把组合赋值给选择数据
- let itemAmountTemp = 0
- currentChoosedItem.combinedList.forEach(it => {
- // if (!it.cpFlgGift) {
- // itemAmountTemp += it.itemAmount
- // }
- if (!it.cpFlgGift) {
- itemAmountTemp += it.itemAmount * it.orderItemQuantity
- }
- })
- currentChoosedItem.priceSale = itemAmountTemp
- currentChoosedItem.itemAmount = Number(currentChoosedItem.priceSale * currentChoosedItem.itemQuantity).toFixed(2)
- // 判断是否有可换件
- getReplaceFlag(filterRows, _this);
- if (type == 'sale') {
- changeCombinedItemCommonSale(filterRows[0], currentChoosedItem, _this)
- }
- }
- _this.setData({
- skuData: [],
- skuSpecsList: [],
- defSkuId: null,
- currentChoosedItem: currentChoosedItem
- })
- // 计算折扣
- getDiscount(_this);
- }
- setTimeout(() => {
- _this.setData({
- skuloading: false
- })
- }, 100)
- })
- }
- /**
- * @desc : 改变组合促销明细后,重新计算价格
- * @date : 2022/7/5 16:49
- * @author : 周兴
- */
- function getCombinedPriceByChange(_this) {
- if (_this.data.currentChoosedItem) {
- let currentChoosedItem = _this.data.currentChoosedItem;
- if (currentChoosedItem.combinedData && currentChoosedItem.combinedData.combinedItem && currentChoosedItem.combinedData.combinedItem.length > 0) {
- let combinedData = currentChoosedItem.combinedData;
- let filterRows = combinedData.combinedItem.filter(it => it.infotype == 'info');
- if (filterRows && filterRows.length > 0) {
- let pricePromotion = 0;
- filterRows.forEach(row => {
- pricePromotion += Number(row.pricePromotion) * Number(row.orderItemQuantity)
- })
- currentChoosedItem.pricePromotion = pricePromotion;
- currentChoosedItem.combinedList = filterRows;// 把组合赋值给选择数据
- _this.changeSalesPrice(pricePromotion, _this); // 修改价格后修改相关金额
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }
- }
- }
- }
- /**
- * @desc : 把sku信息处理成对应的格式
- * @date : 2022/7/2 16:49
- * @author : 周兴
- */
- function setSkuData(_this) {
- let skuSpecsData = []
- let currentChoosedItem = _this.data.currentChoosedItem;
- let skuData = currentChoosedItem.skuData;
- if (skuData.length > 0 && skuData) {
- skuData.forEach(it => {
- let specs = {}
- specs.skuId = it.skuId;
- let specsValuesList = it.specsValues
- if (specsValuesList && specsValuesList.length > 0) {
- let title = ''
- it.specsValues.forEach(row => {
- specs['specsId_' + row.specsId] = row.specsValues
- title = title + (row.specsId + ':' + row.specsValues[0]) + ","
- })
- // 在前面拼上, 方便进行匹配,要带逗号进行匹配这样才是准确的
- if (title && title != ',') {
- title = ',' + title
- }
- specs.title = title;
- }
- skuSpecsData.push(specs);
- currentChoosedItem.skuSpecsData = skuSpecsData
- })
- _this.setData({
- skuSpecsData: skuSpecsData,
- currentChoosedItem: currentChoosedItem
- })
- }
- }
- /**
- * @desc : 判断规格是否可用
- * @date : 2022/7/2 16:49
- * @author : 周兴
- */
- function getSkuSpecs(defSkuId, _this) {
- let currentChoosedItem = _this.data.currentChoosedItem
- let skuSpecsList = currentChoosedItem.skuSpecsList
- let skuData = currentChoosedItem.skuData
- let defSku = []
- if (defSkuId) {
- defSku = skuData.filter(it => it.skuId == defSkuId)[0];
- }
- // 查询是否有未设置标价的商品
- // let noPriceStandardFlag = false;
- // let noPriceStandardList = skuData.filter(it => it.disabled);
- // if(noPriceStandardList && noPriceStandardList.length > 0){
- // noPriceStandardFlag = true;
- // }
- let defSkuValues = [] // 默认sku的规格
- //处理规格
- if (skuSpecsList && skuSpecsList.length > 0) {
- skuSpecsList.forEach(it => {
- it.specsList = [];
- let defaultFlag = false;
- it.specsValues.forEach(item => {
- let defSkuValue = {}
- let specs = {};
- specs.specsId = it.specsId;
- specs.key = item;
- specs.specsValue = item;
- specs.default = false;
- // 如果没有商品,那么规格都设置为不可用
- if (!skuData || skuData.length == 0) {
- specs.disabled = true;
- }
- // 设置默认值
- if (defSku && defSku.specsValues && defSku.specsValues.length > 0) {
- let filterRows = defSku.specsValues.filter(row => row.specsId == it.specsId
- && row.specsValues && row.specsValues.indexOf(item) >= 0);
- if (filterRows && filterRows.length > 0) {
- if (!defaultFlag) {
- specs.default = true;
- defaultFlag = true;
- //记录默认sku的规格信息
- defSkuValue.specsId = it.specsId;
- defSkuValue.specsValue = item;
- defSkuValues.push(defSkuValue);
- }
- }
- }
- it.specsList.push(specs);
- })
- })
- _this.setData({
- skuSpecsList: skuSpecsList
- })
- if (defSkuValues && defSkuValues.length > 0) {
- // defSkuValues.forEach(it => {
- // // 判断规格是否可用
- // checkSpecsIsEnable(it.specsId, it.specsValue, false, _this);
- // })
- checkSpecsIsEnableNew(_this, defSkuValues, false);
- }
- }
- // 设置选中的sku信息
- chooseSkuItem(_this)
- }
- /**
- * @desc : 判断规格是否可用
- * @date : 2022/9/25 16:49
- * @author : 周兴
- */
- function checkSpecsIsEnableNew(_this, defSkuValues, changeDefSkuId) {
- let currentChoosedItem = _this.data.currentChoosedItem
- let skuSpecsList = currentChoosedItem.skuSpecsList;
- let skuSpecsData = currentChoosedItem.skuSpecsData;
- // 获取当前已经选中规格
- if (!defSkuValues || defSkuValues.length == 0) {
- defSkuValues = []
- skuSpecsList.forEach(it => {
- defSkuValues = defSkuValues.concat(it.specsList.filter(it2 => it2.default))
- })
- }
- defSkuValues = defSkuValues ? defSkuValues : []
- console.log('defSkuValues',defSkuValues)
- // let filterSkus = []
- if (defSkuValues && defSkuValues.length > 0) {
- let title = ''
- defSkuValues.forEach(it => {
- // filterSkus = skuSpecsData.filter(row => row['specsId_' + it.specsId]
- // && row['specsId_' + it.specsId].indexOf(it.specsValue) >= 0);
- if (it.specsValue) {
- // 设置当前sku
- title = title + it.specsId + ":" + it.specsValue + ","
- }
- })
- // 在前面拼上, 方便进行匹配,要带逗号进行匹配这样才是准确的
- if (title && title != ',') {
- title = ',' + title
- }
- // 根据选择sku信息
- if (changeDefSkuId && title) {
- let filterRows = skuSpecsData.filter(it => it.title == title);
- if (filterRows && filterRows.length > 0) {
- _this.setData({
- defSkuId: filterRows[0].skuId
- })
- console.log('filterRows ')
- // 设置选中的sku信息
- chooseSkuItem(_this)
- } else {
- console.log('filterRows 空 根据选择sku信息')
- let currentChoosedItem = _this.data.currentChoosedItem;
- currentChoosedItem.skuId = null;
- currentChoosedItem.skuCode = null;
- currentChoosedItem.skuName = null;
- currentChoosedItem.skuModel = null;
- currentChoosedItem.priceStandard = Number(0);
- currentChoosedItem.itemAmount = Number(0);
- currentChoosedItem.priceSale = Number(0);
- currentChoosedItem.discountStandard = Number(0);
- //HC0129DT
- _this.setData({
- defSkuId: null,
- currentChoosedItem: currentChoosedItem
- })
- }
- }
- }
- // 如果都没有选中的sku则全部清空
- if (defSkuValues.length == 0) {
- clearDefaultCommon(_this);
- } else {
- skuSpecsList.forEach(it => {
- // 判断时要去掉当前规格进行判断
- let filterRows = defSkuValues.filter(d => d.specsId != it.specsId);
- if (!filterRows || filterRows.length == 0) {
- // 说明其他规格没有选中的了,那么这个规格下都可用
- it.specsList.forEach(item => {
- // 未设置标价的不允许可用
- if (!item.noPriceStandardFlag) {
- item.disabled = false;
- }
- })
- } else {
- let title = ''
- let skuSpecsDataTmp = JSON.parse(JSON.stringify(skuSpecsData))
- filterRows.forEach(d => {
- if (d.specsValue) {
- // 设置当前sku
- title = ',' + d.specsId + ":" + d.specsValue + ","
- skuSpecsDataTmp = filterDataByTitle(skuSpecsDataTmp, title);
- }
- })
- it.specsList.forEach(item => {
- let itemFilters = skuSpecsDataTmp.filter(row => row['title'] && !row.noPriceStandardFlag
- && row['title'].indexOf("," + item.specsId + ":" + item.specsValue + ",") >= 0);
- if (itemFilters && itemFilters.length > 0) {
- item.disabled = false;
- } else {
- item.disabled = true;
- }
- })
- }
- })
- let currentChoosedItem = _this.data.currentChoosedItem;
- currentChoosedItem.skuSpecsList = skuSpecsList;
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }
- }
- /**
- * @desc : 根据内容进行匹配数据
- * @date : 2022/7/2 16:49
- * @author : 周兴
- */
- function filterDataByTitle(data, title) {
- if (data && data.length > 0) {
- let filters = data.filter(row => row['title']
- && row['title'].indexOf(title) >= 0);
- return filters;
- }
- return data;
- }
- /**
- * @desc : 判断规格是否可用
- * @date : 2022/7/2 16:49
- * @author : 周兴
- */
- function checkSpecsIsEnable(specsId, specsValue, changeDefSkuId, _this) {
- let currentChoosedItem = _this.data.currentChoosedItem
- let skuSpecsList = currentChoosedItem.skuSpecsList;
- let skuSpecsData = currentChoosedItem.skuSpecsData;
- // 先获取符合当前规格的商品
- let filterSkus = skuSpecsData.filter(row => row['specsId_' + specsId] && row['specsId_' + specsId].indexOf(specsValue) >= 0);
- //判断其他规格分类是否可用
- let otherSpecsList = skuSpecsList.filter(it => it.specsId != specsId)
- if (otherSpecsList && otherSpecsList.length > 0) {
- otherSpecsList.forEach(it => {
- it.specsList.forEach(item => {
- // 设置是否可用
- if (filterSkus && filterSkus.length > 0) {
- let filterRows = filterSkus.filter(row => row['specsId_' + it.specsId] && row['specsId_' + it.specsId].indexOf(item.key) >= 0);
- if (filterRows && filterRows.length > 0) {
- // 设置默认的skuId
- if (changeDefSkuId && item.default) {
- _this.setData({
- defSkuId: filterRows[0].skuId
- })
- // 设置选中的sku信息
- chooseSkuItem(_this)
- }
- //说明存在
- item.disabled = false;
- } else {
- item.disabled = true;
- }
- }
- })
- });
- } else {
- if (changeDefSkuId && filterSkus && filterSkus.length > 0) {
- _this.setData({
- defSkuId: filterSkus[0].skuId
- })
- // 设置选中的sku信息
- chooseSkuItem(_this)
- }
- }
- currentChoosedItem.skuSpecsList = skuSpecsList;
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }
- /**
- * @desc : 选择sku,记录sku相关信息
- * @date : 2022/9/1 13:49
- * @author : 于继渤
- */
- function chooseSkuItem(_this) {
- let currentChoosedItem = _this.data.currentChoosedItem;
- let defSkuId = _this.data.defSkuId;
- let skuData = currentChoosedItem.skuData;
- let filterRows = skuData.filter(it => it.skuId == defSkuId);
- console.log('chooseSkuItem')
- if (filterRows && filterRows.length > 0) {
- console.log('filterRows 111',filterRows)
- let row = filterRows[0];
- currentChoosedItem.titleTag = row.titleTag
- currentChoosedItem.orderItemQuantity = row.orderItemQuantity
- currentChoosedItem.activityId = row.activityId ? row.activityId : null
- currentChoosedItem.promotionItemId = row.promotionItemId
- currentChoosedItem.promotionPriceType = row.promotionPriceType
- currentChoosedItem.skuId = row.skuId
- currentChoosedItem.promotionId = row.promotionId
- currentChoosedItem.promotionType = row.promotionType
- currentChoosedItem.promotionTypeName = row.promotionTypeName
- currentChoosedItem.hasChild = row.hasChild
- currentChoosedItem.id = row.id
- currentChoosedItem.cpFlgGift = row.cpFlgGift ? row.cpFlgGift : null
- currentChoosedItem.parentId = row.parentId
- currentChoosedItem.skuType = row.skuType
- currentChoosedItem.skuCode = row.skuCode
- currentChoosedItem.skuName = row.skuName
- currentChoosedItem.spuCode = row.spuCode
- currentChoosedItem.priceCost = (row.priceCost == 0 || row.priceCost) ? row.priceCost : null
- currentChoosedItem.spuId = row.spuId
- currentChoosedItem.pricePromotion = row.pricePromotion
- currentChoosedItem.priceStandard = row.priceStandard
- currentChoosedItem.priceSale = row.priceSale ? row.priceSale : 0
- currentChoosedItem.itemAmount = currentChoosedItem.priceSale
- currentChoosedItem.discountPromotion = 100;
- currentChoosedItem.discountStandard = 100;
- if (row.priceStandard == 0) {
- currentChoosedItem.discountStandard = 0;
- }
- //面积公式
- if (row.specialFormulaName) {
- currentChoosedItem.specialFormulaName = row.specialFormulaName
- currentChoosedItem.specialFormula = row.specialFormulaName
- }
- currentChoosedItem.titleTag = row.titleTag
- currentChoosedItem.standardId = row.standardId
- currentChoosedItem.standardItemId = row.standardItemId
- currentChoosedItem.skuVolume = row.skuVolume
- currentChoosedItem.skuWeight = row.skuWeight
- currentChoosedItem.bomItems = row.bomItems
- currentChoosedItem.glassThickness = row.glassThickness
- currentChoosedItem.glassCraft = row.glassCraft
- currentChoosedItem.substrateColor = row.substrateColor
- currentChoosedItem.standardId = row.standardId
- currentChoosedItem.skuModel = row.skuModel
- currentChoosedItem.flgAllowSpecsUndefine = row.flgAllowSpecsUndefine
- // currentChoosedItem.skuSpecsList = _this.data.skuSpecsList
- // currentChoosedItem.skuSpecsData = _this.data.skuSpecsData
- //非标
- if (row.flgNonStandardType == 1 || row.flgNonStandardType == 2) {
- if (row.flgNonStandardType == 1) {
- currentChoosedItem.nonGlassPriceDef = row.nonGlassPriceDef ? row.nonGlassPriceDef : null
- currentChoosedItem.priceStandard = currentChoosedItem.nonGlassPriceDef ? currentChoosedItem.nonGlassPriceDef : 0
- currentChoosedItem.priceSale = currentChoosedItem.nonGlassPriceDef ? currentChoosedItem.nonGlassPriceDef : 0
- currentChoosedItem.itemAmount = currentChoosedItem.nonGlassPriceDef ? currentChoosedItem.nonGlassPriceDef : 0
- }
- if (row.flgNonStandardType == 2) {
- currentChoosedItem.priceStandard = currentChoosedItem.priceStandard
- currentChoosedItem.priceSale = currentChoosedItem.priceStandard
- currentChoosedItem.itemAmount = currentChoosedItem.priceStandard
- }
- currentChoosedItem.nonGlassPriceItems = row.nonGlassPriceItems ? row.nonGlassPriceItems : []
- if (row.nonGlassPriceItems && row.nonGlassPriceItems.length > 0) {
- let flgDefItemList = row.nonGlassPriceItems.filter(res => {
- return res.flgDefItem
- })
- currentChoosedItem.priceStandard = flgDefItemList[0].itemPrice
- currentChoosedItem.priceSale = currentChoosedItem.nonGlassPriceDef ? currentChoosedItem.nonGlassPriceDef : flgDefItemList[0].itemPrice
- currentChoosedItem.itemAmount = currentChoosedItem.nonGlassPriceDef ? currentChoosedItem.nonGlassPriceDef : flgDefItemList[0].itemPrice
- }else{
- console.log('规格没有匹配上sku')
- currentChoosedItem.priceStandard = row.priceStandard
- currentChoosedItem.priceSale = row.priceStandard
- currentChoosedItem.itemAmount = row.priceStandard
- }
- }
- // 设置赠品
- setFlgGift(_this);
- // 判断是否有可换件
- getReplaceFlag([row], _this);
- } else {
- console.log('没有匹配到sku')
- currentChoosedItem.skuId = null
- currentChoosedItem.skuName = null
- currentChoosedItem.skuCode = null
- currentChoosedItem.priceStandard = 0
- currentChoosedItem.itemAmount = Number((currentChoosedItem.itemQuantity ? currentChoosedItem.itemQuantity : 0) * (currentChoosedItem.priceSale ? currentChoosedItem.priceSale : 0));
- }
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }
- /**
- * @desc : 切换sku商品规格
- * @author : 周兴
- * @date : 2022/6/1 10:16
- */
- function changeSkuSpecsCommon(e, _this) {
- let disabled = e.target.dataset.itemt.disabled;
- // 说明是不能用的,就不需要切换
- if (disabled) {
- return;
- }
- let currentChoosedItem = _this.data.currentChoosedItem;
- let specsValue = e.target.dataset.itemt.key;
- let specsId = e.target.dataset.itemt.specsId;
- let skuSpecsList = currentChoosedItem.skuSpecsList;
- let defaultFlag = !e.target.dataset.itemt.default;
- // 默认值取反向
- // 更改默认值
- let filterRows = skuSpecsList.filter(it => it.specsId == specsId);
- if (filterRows && filterRows.length > 0) {
- filterRows[0].specsList.forEach(row => {
- if (row.key == specsValue) {
- row.default = defaultFlag;
- } else {
- row.default = false;
- }
- })
- }
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- // 判断规格是否可用
- // checkSpecsIsEnable(specsId, specsValue, true, _this);
- checkSpecsIsEnableNew(_this, null, true);
- }
- /**
- * @desc : 判断是否可以进行替换
- * @date : 2022/9/1 13:49
- * @author : 于继渤
- */
- function getReplaceFlag(rows, _this) {
- let currentChoosedItem = _this.data.currentChoosedItem;
- currentChoosedItem.replaceFlag = false;
- if (rows && rows.length > 0) {
- for (let j = 0; j < rows.length; j++) {
- if (rows[j].bomItems != null && rows[j].bomItems.length > 0) {
- for (let i = 0; i < rows[j].bomItems.length; i++) {
- if (rows[j].bomItems[i].replaceableSku != null
- && rows[j].bomItems[i].replaceableSku.length > 0) {
- currentChoosedItem.replaceFlag = true;
- return;
- }
- }
- }
- }
- }
- }
- /**
- * @desc : 改变标识
- * @author : 周兴
- * @date : 2022/8/6 17:16
- */
- function changeAllReadyCheckBoxCommon(e, _this) {
- let key = e.currentTarget.dataset.key
- let currentChoosedItem = _this.data.currentChoosedItem
- //根据商品的cpFlgGift赠品标识,如果没有设置,不允许订单明细的售价为0,赠品标识也不修改(bom子级按照总单来,组合是可以按照明细控制)
- //bom
- if (currentChoosedItem.skuType == 2) {
- if (currentChoosedItem.cpFlgGift) {
- currentChoosedItem.flgGift = e.detail
- if (e.detail) {
- currentChoosedItem.priceSale_Temp = currentChoosedItem.priceSale ? currentChoosedItem.priceSale : currentChoosedItem.priceSale_Temp
- currentChoosedItem.itemAmount_Temp = currentChoosedItem.itemAmount ? currentChoosedItem.itemAmount : currentChoosedItem.itemAmount_Temp
- currentChoosedItem.discountStandard_Temp = currentChoosedItem.discountStandard
- currentChoosedItem.discountPromotion_Temp = currentChoosedItem.discountPromotion
- currentChoosedItem.priceSale = 0
- currentChoosedItem.discountStandard = 0
- currentChoosedItem.discountPromotion = 0
- currentChoosedItem.itemAmount = 0
- } else {
- // 取消赠品标识时,价格是0时价格恢复成标价,如价格手动改过,则不变
- if (currentChoosedItem.priceSale == 0) {
- // 恢复到以前的金额
- currentChoosedItem.priceSale = Number(currentChoosedItem.priceSale_Temp)
- currentChoosedItem.itemAmount = Number(currentChoosedItem.itemAmount_Temp)
- currentChoosedItem.discountStandard = Number(currentChoosedItem.discountStandard_Temp)
- currentChoosedItem.discountPromotion = Number(currentChoosedItem.discountPromotion_Temp)
- }
- }
- }
- } else {
- currentChoosedItem.flgGift = e.detail
- if (e.detail) {
- currentChoosedItem.priceSale_Temp = currentChoosedItem.priceSale
- currentChoosedItem.itemAmount_Temp = currentChoosedItem.itemAmount
- currentChoosedItem.discountStandard_Temp = currentChoosedItem.discountStandard
- currentChoosedItem.discountPromotion_Temp = currentChoosedItem.discountPromotion
- currentChoosedItem.priceSale = 0
- currentChoosedItem.discountStandard = 0
- currentChoosedItem.discountPromotion = 0
- currentChoosedItem.itemAmount = 0
- } else {
- // 取消赠品标识时,价格是0时价格恢复成标价,如价格手动改过,则不变
- if (currentChoosedItem.priceSale == 0) {
- // 恢复到以前的金额
- currentChoosedItem.priceSale = currentChoosedItem.priceSale_Temp
- currentChoosedItem.itemAmount = currentChoosedItem.itemAmount_Temp
- currentChoosedItem.discountStandard = currentChoosedItem.discountStandard_Temp
- currentChoosedItem.discountPromotion = currentChoosedItem.discountPromotion_Temp
- }
- }
- }
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }
- /**
- * @desc : 清空选中数据(确定)
- * @date : 2022/7/4 16:49
- * @author : 周兴
- */
- function clearDefaultCommon(_this) {
- let currentChoosedItem = _this.data.currentChoosedItem
- // 清空sku数据
- currentChoosedItem.skuId = null;
- currentChoosedItem.skuName = null;
- currentChoosedItem.skuCode = null;
- currentChoosedItem.skuModel = null;
- currentChoosedItem.pricePromotion = null;
- currentChoosedItem.priceStandard = null;
- let skuSpecsList = currentChoosedItem.skuSpecsList;
- if (skuSpecsList && skuSpecsList.length > 0) {
- skuSpecsList.forEach(it => {
- if (it.specsList && it.specsList.length > 0) {
- it.specsList.forEach(s => {
- s.default = false;
- if (!s.noPriceStandardFlag) {
- s.disabled = false;
- }
- })
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }
- })
- }
- }
- /**
- * @desc : 选择数据(确定)
- * @date : 2022/7/4 16:49
- * @author : 周兴
- */
- function chooseSkuInfoCommon(_this) {
- let currentChoosedItem = _this.data.currentChoosedItem
- currentChoosedItem.goodsSkuList = _this.data.goodsSkuList
- //校验选择商品数量不能为0
- if (currentChoosedItem.itemQuantity === 0 || !currentChoosedItem.itemQuantity) {
- wx.showToast({
- title: '数量不能为0',
- image: '/static/image/warning.png',
- duration: 1000
- })
- return
- }
- // 如果没有sku 那么不允许
- if (currentChoosedItem.promotionType != Constants.PROMOTION_TYPE.COMBINED && (!currentChoosedItem.skuId || currentChoosedItem.skuId == 0)) {
- wx.showToast({
- title: '未选择商品规格',
- image: '/static/image/warning.png',
- duration: 1000
- })
- return
- }
- //非标定制品标价参数赋值
- if (currentChoosedItem.nonStandardList && currentChoosedItem.nonStandardList.length > 0) {
- let nonStandardList = util.copyObj(currentChoosedItem.nonStandardList)
- let nonStandardObjList = []
- nonStandardList.forEach(res => {
- let nonStandardObj = {
- fieldId: null,
- fieldCode: null,
- fieldName: null,
- optionCode: null,
- optionName: null,
- }
- nonStandardObj.fieldId = res.fieldId
- nonStandardObj.fieldCode = res.fieldCode
- nonStandardObj.fieldName = res.fieldName
- nonStandardObj.isScope = res.isScope
- nonStandardObj.fieldType = res.fieldType
- //判断是否是范围值
- if (res.isScope == 1) {
- if (res.optionCode && res.optionCode) {
- nonStandardObj.optionCode = res.optionCode
- nonStandardObj.optionName = res.optionName
- }
- }
- if (res.options && res.options.length > 0) {
- res.options.forEach(it => {
- if (it.infotype == 'info') {
- nonStandardObj.optionCode = it.code
- nonStandardObj.optionName = it.name
- }
- })
- }
- //没有选择的参数不会设置
- if (nonStandardObj.optionCode) {
- nonStandardObjList.push(nonStandardObj)
- }
- })
- currentChoosedItem.nonGlassList = nonStandardObjList //订单明细字段
- //设置显示非标参数 (展示非标text)
- if (nonStandardObjList && nonStandardObjList.length > 0) {
- let nonGlassListShowTemp = []
- nonStandardObjList.forEach(it => {
- if (it.optionName && it.optionName != undefined) {
- nonGlassListShowTemp.push(it.fieldName + ':' + it.optionName)
- }
- })
- //非标参数显示/匹配命中标价的数据
- currentChoosedItem.nonGlassListShow = nonGlassListShowTemp.join(',')
- }
- }
- // 已选商品列表
- let choosedGoodsList = util.copyObj(_this.data.choosedGoodsList)
- let currentChoosedItemCopy = util.copyObj(currentChoosedItem)
- //判断已选是不是修改
- if (_this.data.active == 1 || _this.data.active == '1') {
- if (typeof _this.data.activeOneIndex == 'number') {
- choosedGoodsList[_this.data.activeOneIndex] = {}
- choosedGoodsList[_this.data.activeOneIndex] = currentChoosedItemCopy
- }
- _this.setData({
- choosedGoodsList: choosedGoodsList
- })
- }
- // 判断商品是否在已选列表中存在
- let filterRows = choosedGoodsList.filter(it => it.id == currentChoosedItem.id);
- let currentChoosedItemTemp = { ...currentChoosedItem }
- if (!filterRows || filterRows.length == 0) {
- if (_this.data.active != 1 || _this.data.active != '1') {
- choosedGoodsList.push(currentChoosedItemTemp)
- }
- }
- choosedGoodsList.forEach(it => {
- it.flgInstalled = true
- })
- console.log('choosedGoodsList', choosedGoodsList)
- _this.setData({
- choosedGoodsList: choosedGoodsList,
- choosedGoodsListLength: choosedGoodsList.length,
- showAdd: false,
- show6: false
- })
- // 更新购物车已选数量
- handleChoosedNum(_this);
- //计算合计金额
- getSumAmount(_this);
- }
- /**
- * @desc : 计算合计金额
- * @date : 2022/7/4 16:49
- * @author : 于继渤
- */
- function getSumAmount(_this) {
- // 逸轩商品的数组
- let choosedGoodsList = _this.data.choosedGoodsList
- let sumQuantity = 0 // 合计数量
- let sumGoodsAmount = 0 // 货物金额
- let categoryQuantityList = [] // 品类数
- choosedGoodsList.forEach(item => {
- sumGoodsAmount += Number(item.itemAmount)
- // 如果有子级,计算子级的数量
- if (item.bomItems && item.bomItems.length > 0) {
- item.bomItems.forEach(it => {
- sumQuantity += Number(item.itemQuantity * it.orderItemQuantity);
- if (it.skuSpecs == null) {
- it.skuSpecs = " "
- }
- if (it.skuSpecs && !categoryQuantityList.includes(it.skuSpecs)) {
- categoryQuantityList.push(it.skuSpecs)
- }
- })
- } else if (item.combinedList && item.combinedList.length > 0) {
- item.combinedList.forEach(it => {
- if (it.bomItems && it.bomItems.length > 0) {
- it.bomItems.forEach(itemt => {
- sumQuantity += Number(it.itemQuantity * itemt.orderItemQuantity);
- if (itemt.skuSpecs == null) {
- itemt.skuSpecs = " "
- }
- if (itemt.skuSpecs && !categoryQuantityList.includes(itemt.skuSpecs)) {
- categoryQuantityList.push(itemt.skuSpecs)
- }
- })
- } else {
- sumQuantity += Number(item.itemQuantity * it.orderItemQuantity);
- }
- if (it.skuSpecs == null) {
- it.skuSpecs = " "
- }
- if (it.skuSpecs && !categoryQuantityList.includes(it.skuSpecs)) {
- categoryQuantityList.push(it.skuSpecs)
- }
- })
- } else {
- // 如果没有子级,就加上即可
- sumQuantity += Number(item.itemQuantity);
- if (item.skuSpecs == null) {
- item.skuSpecs = " "
- }
- if (item.skuSpecs && !categoryQuantityList.includes(item.skuSpecs)) {
- categoryQuantityList.push(item.skuSpecs)
- }
- }
- // 如果有组合
- })
- _this.setData({
- sumGoodsAmount: sumGoodsAmount,
- sumQuantity: sumQuantity,
- categoryQuantity: categoryQuantityList.length,
- })
- }
- /**
- * @desc : 确定时处理数据
- * @date : 2022/7/5 16:49
- * @author : 周兴
- */
- function handleData(goodsList, _this) {
- let followFlag = _this.data.followFlag;
- let choosedGoodsList = util.copyObj(_this.data.choosedGoodsList)
- let title = ''
- if (choosedGoodsList != null && choosedGoodsList.length > 0) {
- let skuTypeFlag = false
- choosedGoodsList.forEach(it => {
- if (!it.id) {
- it.id = util.getGuid()
- }
- //判断bom是否有子级
- if (it.skuType == 2 && (it.bomItems == null || it.bomItems.length == 0)) {
- title = it.title
- skuTypeFlag = true
- } else {
- skuTypeFlag = false
- }
- // 父级id
- it.parentId = null;
- it.hasChild = 0; // 默认设置为无子级
- // 处理金额
- it.itemAmount = Number(it.itemAmount).toFixed(2)
- // 跟单处理为实际量
- if (followFlag) {
- it.tItemQuantity = it.itemQuantity
- it.tItemAmount = it.itemAmount
- }
- console.log('it.bomItems前', it.bomItems)
- // ***如果有子级,需要处理子级的数据 TODO
- if (it.bomItems != null && it.bomItems.length > 0) {
- it.hasChild = 1; // 说明有子级
- it.flgInstalled = true
- it.bomItems.forEach(row => {
- row['flgBomCombined'] = false;
- // 父级id
- row.parentId = it.id;
- // 数量的处理
- if (followFlag) {
- row.tItemQuantity = it.itemQuantity * row.orderItemQuantity
- } else {
- row.itemQuantity = it.itemQuantity * row.orderItemQuantity
- }
- console.log('bomItem数量的处理', row.itemQuantity)
- // 如果单品促销
- if (it.promotionType == Constants.PROMOTION_TYPE.PRMOTION ||
- it.promotionType == Constants.PROMOTION_TYPE.COMBINED) {
- // 把促销的信息替换上去
- //设置明细活动ID
- row.activityId = it.activityId
- row.promotionType = it.promotionType;
- row.promotionId = it.promotionId;
- if (it.pricePromotion == 0) {
- row.priceSale = 0
- } else {
- // 销售价(子级)= 销售价(父级)/ 标售售价(父级)* 标售售价(子级)
- row.priceSale = Number((it.priceSale / it.pricePromotion * row.pricePromotion).toFixed(2))
- }
- } else {
- // 正常品
- if (it.priceStandard == 0 || !it.priceStandard) {
- row.priceSale = 0
- } else {
- // 销售价(子级)= 销售价(父级)/ 标售售价(父级)* 标售售价(子级)
- row.priceSale = Number((it.priceSale / it.priceStandard * row.priceStandard).toFixed(2))
- }
- }
- if (followFlag) {
- row.tItemAmount = Number((row.priceSale * row.tItemQuantity).toFixed(2))
- row.itemAmount = row.tItemAmount
- } else {
- row.itemAmount = Number((row.priceSale * row.itemQuantity).toFixed(2))
- }
- // 设置标题
- getTitle(it, row);
- // 处理图标
- common.setRowImagePath(row);
- })
- it.goodsSkuList = it.bomItems
- }
- // **** 如果有组合促销,需要进行数据的处理
- if (it.combinedList != null && it.combinedList.length > 0) {
- it.flgInstalled = true
- it.hasChild = 1; // 说明有子级
- it.goodsSkuList = []
- let priceStandard = 0; // 重新计算标价
- it.combinedList.forEach(row => {
- row.activityId = it.activityId
- row.parentId = it.id;
- row.hasChild = 0;
- if (row.bomItems == null || row.bomItems.length == 0) {
- if (row.cpFlgGift) {
- row.priceSale = 0
- row.discountStandard = 0
- row.discountPromotion = 0
- row.itemAmount = 0
- } else {
- // 重新计算价格
- row.priceSale = getCombinedSalePrice(it, row);
- }
- // 重新计算折扣
- getCombinedDiscount(row);
- // 计算数量
- row.itemQuantity = Number(it.itemQuantity) * Number(row.orderItemQuantity)
- row.itemAmount = Number(row.itemQuantity) * Number(row.priceSale)
- // 跟单处理为实际量
- if (followFlag) {
- row.tItemQuantity = row.itemQuantity
- row.tItemAmount = row.itemAmount
- }
- // 把促销的信息替换上去
- row.promotionType = it.promotionType;
- row.promotionId = it.promotionId;
- // 设置标题
- getTitle(it, row);
- // 处理图标
- common.setRowImagePath(row);
- row.flgBomCombined = false;
- it.goodsSkuList.push(row);
- // 计算标价
- priceStandard += Number(row.orderItemQuantity) * Number(row.priceStandard)
- } else {
- let bomAmount = 0;
- // bom也需要保存进去,方便报表统计
- row.itemQuantity = it.itemQuantity * row.orderItemQuantity;
- row.itemAmount = bomAmount;
- row.bomItems.forEach(bRow => {
- // 父级id
- bRow.parentId = it.id;
- bRow.hasChild = 0;
- if (row.cpFlgGift) {
- bRow.priceSale = 0
- bRow.discountStandard = 0
- bRow.discountPromotion = 0
- bRow.itemAmount = 0
- } else {
- // 重新计算价格
- bRow.priceSale = getCombinedSalePrice(it, bRow);
- }
- // 重新计算折扣
- getCombinedDiscount(bRow);
- // 数量的处理
- bRow.itemQuantity = Number(row.itemQuantity) * Number(bRow.orderItemQuantity)
- bRow.itemAmount = Number(bRow.priceSale) * Number(bRow.itemQuantity).toFixed(2)
- bomAmount += bRow.itemAmount;
- if (followFlag) {
- bRow.tItemQuantity = bRow.itemQuantity
- bRow.tItemAmount = bRow.itemAmount
- }
- bRow.activityId = it.activityId
- // 把促销的信息替换上去
- bRow.promotionType = it.promotionType;
- bRow.promotionId = it.promotionId;
- // 设置标题
- getTitle(it, bRow);
- // 处理图标
- common.setRowImagePath(bRow);
- bRow.flgBomCombined = false;
- it.goodsSkuList.push(bRow);
- // 计算标价
- priceStandard += Number(bRow.orderItemQuantity) * Number(bRow.priceStandard)
- })
- row.priceSale = row.itemQuantity == 0 ? 0 : (Number(row.itemAmount) / Number(row.itemQuantity)).toFixed(2)
- if (followFlag) {
- row.tItemQuantity = row.itemQuantity
- row.tItemAmount = row.itemAmount
- }
- row.hasChild = 1;
- row.flgBomCombined = true;
- it.goodsSkuList.push(row);
- }
- })
- // 给组合的标价总额赋值
- it.priceStandard = priceStandard
- }
- // 计算品类数
- it.categoryQuantity = common.getCategoryQuantity(it.goodsSkuList);
- getCombinedPriceByChange(_this)
- it['flgBomCombined'] = false;
- })
- // 重新计算最后一条数据的金额,用父级金额-其他条金额合计
- common.countLastAmount(choosedGoodsList, followFlag);
- // 把选择的数据加到明细中
- for (let i = 0; i < choosedGoodsList.length; i++) {
- let newGood = choosedGoodsList[i];
- let alreadyExists = false;
- for (let j = 0; j < goodsList.length; j++) {
- if (goodsList[j].id === newGood.id) {
- alreadyExists = true;
- break;
- }
- }
- if (!alreadyExists) {
- goodsList.push(newGood);
- }
- }
- // goodsList = goodsList.concat(choosedGoodsList);
- if (skuTypeFlag) {
- wx.showToast({
- title: title + '该BOM没有子件',
- icon: 'none'
- })
- }
- }
- goodsList.forEach(res => {
- res.skuVolume = 0
- res.skuWeight = 0
- if (res.goodsSkuList && res.goodsSkuList.length > 0) {
- res.goodsSkuList.forEach(item => {
- res.skuVolume += item.skuVolume
- res.skuWeight += item.skuWeight
- })
- }
- })
- console.log('goodsList==>', goodsList)
- return goodsList;
- }
- /**
- * @desc : 重新计算组合子件的价格
- * @date : 2022/7/6 16:49
- * @author : 周兴
- */
- function getCombinedSalePrice(pRow, row) {
- let priceSale = 0;
- // 销售价(子级)= 销售价(父级)/ 标售售价(父级)* 标售售价(子级)
- if (pRow.pricePromotion == 0) {
- priceSale = 0
- } else {
- // 销售价(子级)= 销售价(父级)/ 标售售价(父级)* 标售售价(子级)
- priceSale = Number(pRow.priceSale / pRow.pricePromotion * row.pricePromotion).toFixed(2)
- }
- return priceSale;
- }
- /**
- * @desc : 计算折扣
- * @date : 2022/7/6 16:49
- * @author : 周兴
- */
- function getCombinedDiscount(row) {
- let discountStandard = 0;
- let discountPromotion = 0;
- // 标价折扣= 售价/标价
- if (!row.priceStandard || row.priceStandard == 0) {
- discountStandard = 0;
- } else {
- discountStandard = Number(row.priceSale * 100 / row.priceStandard).toFixed(2)
- }
- // 促销折扣= 售价/促销价
- if (!row.pricePromotion || row.pricePromotion == 0) {
- discountPromotion = 100;
- } else {
- discountPromotion = Number(row.priceSale * 100 / row.pricePromotion).toFixed(2)
- }
- row.discountPromotion = discountPromotion;
- row.discountStandard = discountStandard;
- }
- /**
- * @desc : 设置子级设置标题等信息
- * @date : 2022/7/6 16:49
- * @author : 周兴
- */
- function getTitle(pRow, row) {
- // titleTag 标题标签
- if (pRow.promotionType == Constants.PROMOTION_TYPE.COMBINED) {
- row.titleTag = '组合促销';
- } else if (pRow.promotionType == Constants.PROMOTION_TYPE.PRMOTION) {
- row.titleTag = '单品促销';
- } else {
- // 显示品牌
- row.titleTag = row.brandName;
- }
- // title
- row.title = row.skuName;
- row.desc = row.skuCode;
- }
- /**
- * @desc : 切换组合促销明细
- * @date : 2022/7/5 16:49
- * @author : 周兴
- */
- function changeCombinedItemCommon(e, _this) {
- let itemt = e.currentTarget.dataset.itemt;
- let currentChoosedItem = _this.data.currentChoosedItem;
- let combinedData = currentChoosedItem.combinedData
- let combinedItem = combinedData.combinedItem
- // 切换默认项
- combinedItem.forEach(it => {
- //相同类别进行处理
- if (it.combinedTypeId === itemt.combinedTypeId) {
- it.infotype = 'default';
- if (it.id == itemt.id) {
- it.infotype = 'info'
- }
- }
- })
- currentChoosedItem.combinedData = combinedData;
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- // 修改相关价格
- getCombinedPriceByChange(_this);
-
- }
- function changeCombinedItemCommonSale(itemt, currentChoosedItem, _this) {
- let combinedData = currentChoosedItem.combinedData
- let combinedItem = combinedData.combinedItem
- // 切换默认项
- combinedItem.forEach(it => {
- //相同类别进行处理
- if (it.combinedTypeId === itemt.combinedTypeId) {
- it.infotype = 'default';
- if (it.id == itemt.id) {
- it.infotype = 'info'
- }
- }
- })
- currentChoosedItem.combinedData = combinedData;
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- // 修改相关价格
- getCombinedPriceByChange(_this);
-
- }
- /**
- * @desc : 设置查询参数
- * @date : 2022/7/5 16:49
- * @author : 周兴
- */
- function setParam(_this) {
- let param = {}
- param.specsId = undefined;
- if (_this.data.specsId) {
- param.specsId = Number(_this.data.specsId);
- } else if (_this.data.specsId == 0) {
- param.specsId = 0;
- }
- param.pageSize = _this.data.pageInfo.pageSize;
- param.currentPage = _this.data.pageInfo.currentPage;
- param.orgId = app.globalData.user.orgId
- param.searchText = _this.data.searchText
- param.cpId = app.globalData.user.cpId
- let searchText = _this.data.searchText;
- if (searchText) {
- param.spuQuerys = JSON.stringify({
- queryText: searchText,
- })
- }
- return param;
- }
- /**
- * @desc : 删除选中的数据
- * @author : 周兴
- * @date : 2022/7/4 20:16
- */
- function delChoosedGoodsItemCommon(e, _this, flag) {
- let focusIndex = e.target.dataset.index;
- let choosedGoodsList = _this.data.choosedGoodsList;
- // 根据行号进行删除
- choosedGoodsList = choosedGoodsList.filter((it, index) => index != focusIndex);
- _this.setData({
- choosedGoodsList: choosedGoodsList,
- choosedGoodsListLength: choosedGoodsList.length
- })
- if (flag) {
- // 统计已选数量
- handleChoosedNum(_this);
- }
- // 计算合计金额
- getSumAmount(_this);
- }
- /**
- * @desc : 设置已选数据
- * @author : 周兴
- * @date : 2022/11/10 20:16
- */
- function handleChoosedNum(_this) {
- let choosedGoodsList = _this.data.choosedGoodsList;
- choosedGoodsList = choosedGoodsList ? choosedGoodsList : []
- wx.setStorageSync('choosedGoodsList', choosedGoodsList)
- let cartNum = choosedGoodsList.length //默认数据
- if (cartNum != 0) {
- //设置角标
- wx.setTabBarBadge({
- index: 2, //第几个tab
- text: cartNum.toString()
- })
- } else {
- //移除角标
- wx.removeTabBarBadge({
- index: 2,
- })
- }
- }
- /**
- * @desc : 打开选择明细
- * @author : 周兴
- * @date : 2022/7/4 20:16
- */
- function openChoosedItemInfoCommon(e, _this) {
- let currentChoosedItem = e.currentTarget.dataset.item;
- if (_this.data.active && (_this.data.active == 1 || _this.data.active == '1')) {
- _this.setData({
- activeOneIndex: e.currentTarget.dataset.index //已选触发位置索引
- })
- }
- // 根据类型显示对应的数据
- if (currentChoosedItem.promotionType == Constants.PROMOTION_TYPE.COMBINED) {
- _this.setData({
- show4: true,
- show1: false,
- show6: false,
- show7: false,
- })
- } else {
- _this.setData({
- show1: true,
- show4: false,
- show6: false,
- show7: false,
- })
- }
- if (currentChoosedItem.flgNonStandardType == 1 || currentChoosedItem.flgNonStandardType == 2) {
- _this.setData({
- show6: false,
- show7: true,
- })
- }
- if (currentChoosedItem.specsData && currentChoosedItem.specsData.length == 0 && currentChoosedItem.skuData && currentChoosedItem.skuData.length > 1) {
- _this.setData({
- show6: true
- })
- }
- _this.setData({
- showAdd: true,
- currentChoosedItem: currentChoosedItem
- })
- }
- //关闭poup商品
- function closeAddItemInfoCommon(_this) {
- _this.setData({
- showAdd: false,
- currentChoosedItem: {},
- })
- }
- /**
- * @desc : 修改销售价格
- * @author : 周兴
- * @date : 2022/7/6 14:45
- */
- function changeSalesPriceCommon(priceSale, _this, flag) {
- let currentChoosedItem = _this.data.currentChoosedItem
- currentChoosedItem.priceSale = priceSale // 销售价格赋值
- let itemAmountTemp = null
- if (flag && currentChoosedItem.combinedList && currentChoosedItem.combinedList.length > 0) {
- currentChoosedItem.combinedList.forEach(it => {
- if (!it.cpFlgGift) {
- itemAmountTemp += it.itemAmount * it.orderItemQuantity
- }
- })
- }
- currentChoosedItem.priceSale = itemAmountTemp ? itemAmountTemp : priceSale
- if (currentChoosedItem.nonStandardArea) {
- currentChoosedItem.itemAmount = Number(currentChoosedItem.priceSale * currentChoosedItem.itemQuantity * currentChoosedItem.nonStandardArea).toFixed(2)
- } else {
- currentChoosedItem.itemAmount = Number(currentChoosedItem.priceSale * currentChoosedItem.itemQuantity).toFixed(2)
- }
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- // 计算折扣
- getDiscount(_this);
- }
- /**
- * @desc : 修改销售金额
- * @author : 周兴
- * @date : 2022/7/4 14:45
- */
- function changeItemAmountFieldCommon(e, _this) {
- let currentChoosedItem = _this.data.currentChoosedItem
- let key = e.currentTarget.dataset.key
- // currentChoosedItem.itemAmount = e.detail.value // 销售金额赋值
- if (currentChoosedItem.priceStandard < 0 || currentChoosedItem.pricePromotion < 0) {
- currentChoosedItem.itemAmount = Number(0 - e.detail.value)
- } else {
- currentChoosedItem.itemAmount = e.detail.value // 销售金额赋值
- }
- if (currentChoosedItem.flgNonStandardType == 1 || currentChoosedItem.flgNonStandardType == 2) {
- let nonStandardArea = Number(currentChoosedItem.nonStandardArea)
- //非标
- if (currentChoosedItem.itemQuantity && (currentChoosedItem.itemQuantity > 0) && nonStandardArea && (nonStandardArea > 0)) {
- let tempNumber = Number(currentChoosedItem.itemAmount / currentChoosedItem.itemQuantity).toFixed(2)
- currentChoosedItem.priceSale = Number(tempNumber / currentChoosedItem.nonStandardArea).toFixed(2)
- }
- } else {
- if (currentChoosedItem.itemQuantity && currentChoosedItem.itemQuantity > 0) {
- currentChoosedItem.priceSale = Number(currentChoosedItem.itemAmount / currentChoosedItem.itemQuantity).toFixed(2)
- }
- }
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- // 计算折扣
- getDiscount(_this);
- }
- /**
- * @desc : 编辑商品算折扣
- * @author : 于继渤
- * @date : 2022/5/31 18:16
- */
- function getDiscount(_this) {
- let currentChoosedItem = _this.data.currentChoosedItem
- //标价计算折扣
- if (currentChoosedItem.priceStandard && currentChoosedItem.priceStandard != 0) {
- // 售价/标价
- if (currentChoosedItem.priceSale < 0) {
- //负数
- currentChoosedItem.discountStandard = Number((currentChoosedItem.priceSale / currentChoosedItem.priceStandard)).toFixed(2)
- } else {
- currentChoosedItem.discountStandard = Number((currentChoosedItem.priceSale / currentChoosedItem.priceStandard) * 100).toFixed(2)
- }
- } else {
- currentChoosedItem.discountStandard = 0
- }
- //促销价计算折扣
- if (currentChoosedItem.discountPromotion && currentChoosedItem.pricePromotion != 0) {
- // 售价/促销价
- currentChoosedItem.discountPromotion = Number((currentChoosedItem.priceSale / currentChoosedItem.pricePromotion) * 100).toFixed(2)
- } else {
- currentChoosedItem.discountPromotion = 100
- }
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }
- /**
- * @desc : 单品促销单选
- * @author : 于继渤
- * @date : 2022/5/31 18:16
- */
- function clickDPCommon(e, _this) {
- let currentChoosedItem = _this.data.currentChoosedItem
- let itemt = e.currentTarget.dataset.itemt;
- let PricePromotionData = _this.data.PricePromotionData
- let infotype = itemt.infotype
- currentChoosedItem.pricePromotion = itemt.priceStandard
- PricePromotionData.forEach(it => {
- if (it.typeId === itemt.typeId) {
- it.infotype = 'default'
- }
- })
- if (infotype == 'default') {
- infotype = 'info'
- } else {
- infotype = 'default'
- }
- PricePromotionData.forEach(it => {
- if (it.skuId === itemt.skuId && it.typeId === itemt.typeId) {
- it.infotype = infotype
- }
- })
- _this.setData({
- PricePromotionData: PricePromotionData,
- })
- let PricePromotionList = []
- PricePromotionData.forEach(it => {
- if (it.infotype === 'info') {
- PricePromotionList.push(it)
- }
- })
- currentChoosedItem.PricePromotionList = PricePromotionList
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }
- //定制品单选
- function clickDZPCommon(e, _this) {
- let itemt = e.target.dataset.itemt;
- let pindex = e.target.dataset.pindex;
- let indext = e.target.dataset.indext;
- let formDZP = _this.data.formDZP
- let infotype = formDZP[pindex].tags[indext].infotype
- infotype = 'default'
- formDZP[pindex].tags.forEach(res => {
- res.infotype = 'default'
- })
- if (infotype == 'default') {
- infotype = 'info'
- } else {
- infotype = 'default'
- }
- formDZP[pindex].tags[indext].infotype = infotype
- _this.setData({
- formDZP
- })
- }
- //主柜规格单选
- function clickZGGGCommon(e, _this) {
- let itemt = e.target.dataset.itemt;
- let pindex = e.target.dataset.pindex;
- let indext = e.target.dataset.indext;
- let formZGGG = _this.data.formZGGG
- let infotype = formZGGG[pindex].tags[indext].infotype
- infotype = 'default'
- formZGGG[pindex].tags.forEach(res => {
- res.infotype = 'default'
- })
- if (infotype == 'default') {
- infotype = 'info'
- } else {
- infotype = 'default'
- }
- formZGGG[pindex].tags[indext].infotype = infotype
- _this.setData({
- formZGGG
- })
- }
- /**
- *@desc:设置默认的标价
- *@date:2022/9/149:56
- *@author:周兴
- */
- function setFlgGift(_this) {
- let currentChoosedItem = _this.data.currentChoosedItem
- if (currentChoosedItem.cpFlgGift) {
- currentChoosedItem.flgGift = true
- currentChoosedItem.priceSale_Temp = currentChoosedItem.priceSale
- currentChoosedItem.itemAmount_Temp = currentChoosedItem.itemAmount
- currentChoosedItem.discountStandard_Temp = currentChoosedItem.discountStandard
- currentChoosedItem.discountPromotion_Temp = currentChoosedItem.discountPromotion
- currentChoosedItem.priceSale = 0
- currentChoosedItem.discountStandard = 0
- currentChoosedItem.discountPromotion = 0
- currentChoosedItem.itemAmount = 0
- if (currentChoosedItem.skuType == 2) {
- if (currentChoosedItem.bomItems && currentChoosedItem.bomItems.length > 0) {
- currentChoosedItem.bomItems.forEach(res => {
- res.priceSale_Temp = res.priceSale
- res.discountStandard_Temp = res.discountStandard
- res.discountPromotion_Temp = res.discountPromotion
- res.itemAmount_Temp = res.itemAmount
- res.priceSale = 0
- res.discountStandard = 0
- res.discountPromotion = 0
- res.itemAmount = 0
- })
- }
- }
- _this.setData({
- currentChoosedItem: currentChoosedItem,
- })
- }
- }
- /**
- * @desc : 计算折扣反算销售价格
- * @author : 于继渤
- * @date : 2022/7/4 14:45
- */
- function changeDiscountFieldCommon(e, _this, returnFlag) {
- let key = e.currentTarget.dataset.key
- let currentChoosedItem = _this.data.currentChoosedItem
- let priceSale = 0
- if (key == 'discountStandard') {
- let discountStandard = e.detail.value ? Number(e.detail.value) : 0
- if (!currentChoosedItem.priceStandard || currentChoosedItem.priceStandard == 0) {
- priceStandard = 0;
- } else {
- // 售价 = 标价折扣* 标价
- priceSale = Number((discountStandard / 100) * currentChoosedItem.priceStandard).toFixed(2)
- }
- currentChoosedItem.discountStandard = Number(e.detail.value)
- }
- if (key == 'discountPromotion') {
- let discountPromotion = e.detail.value ? Number(e.detail.value) : 0
- if (!currentChoosedItem.pricePromotion || currentChoosedItem.pricePromotion == 0) {
- pricePromotion = 0;
- } else {
- // 售价= 促销折扣 * 促销价
- priceSale = Number((discountPromotion / 100) * currentChoosedItem.pricePromotion).toFixed(2)
- }
- currentChoosedItem.discountPromotion = Number(e.detail.value)
- }
- currentChoosedItem.priceSale = priceSale
- //退还补
- if (returnFlag) {
- currentChoosedItem.tItemAmount = Number(priceSale) * Number(currentChoosedItem.tItemQuantity)
- } else {
- currentChoosedItem.itemAmount = Number(priceSale) * Number(currentChoosedItem.itemQuantity)
- }
- _this.setData({
- currentChoosedItem: currentChoosedItem
- })
- }
- //chooseGoodsCommon
- module.exports = {
- openAddItemInfoCommon: openAddItemInfoCommon,
- chooseSkuItem: chooseSkuItem,
- getReplaceFlag: getReplaceFlag,
- getSkuBySpuId: getSkuBySpuId,
- checkSpecsIsEnable: checkSpecsIsEnable,
- getCombinedByPriceId: getCombinedByPriceId,
- getSumAmount: getSumAmount,
- getCombinedPriceByChange: getCombinedPriceByChange,
- chooseSkuInfoCommon: chooseSkuInfoCommon,
- changeDiscountFieldCommon: changeDiscountFieldCommon,
- handleData: handleData,
- handleChoosedNum: handleChoosedNum,
- changeCombinedItemCommon: changeCombinedItemCommon,
- changeSkuSpecsCommon: changeSkuSpecsCommon,
- setParam: setParam,
- changeAllReadyCheckBoxCommon: changeAllReadyCheckBoxCommon,
- delChoosedGoodsItemCommon: delChoosedGoodsItemCommon,
- openChoosedItemInfoCommon: openChoosedItemInfoCommon,
- changeSalesPriceCommon: changeSalesPriceCommon,
- changeItemAmountFieldCommon: changeItemAmountFieldCommon,
- getDiscount: getDiscount,
- clickDPCommon: clickDPCommon,
- clickDZPCommon: clickDZPCommon,
- clickZGGGCommon: clickZGGGCommon,
- closeAddItemInfoCommon: closeAddItemInfoCommon,
- clearDefaultCommon: clearDefaultCommon,
- //非标
- nonStandardTap: nonStandardTap,
- nonGlassSpuItemsTap: nonGlassSpuItemsTap,
- bindInputIsScopeOne: bindInputIsScopeOne,
- bindBlurIsScopeOne: bindBlurIsScopeOne,
- bindBlurNonStantardArea: bindBlurNonStantardArea,
- bindInputNonStantardArea: bindInputNonStantardArea,
- calculateFormulaItemAmount: calculateFormulaItemAmount,
- bindBlurIsScopeOne_t: bindBlurIsScopeOne_t
- }
|