| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689 |
- /*******************************************************************************
- * 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 //子对象
- 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{
- }
- }
- /**
- * @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) {
- 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) {
- 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) {
- currentChoosedItem.priceStandard = objItems[0].itemPrice
- } else {
- //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 {
- 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 {
- 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) {
- //数字类型
- if (!checkNumber(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 => {
- 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) {
- 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 : []
- // 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
- })
- // 设置选中的sku信息
- chooseSkuItem(_this)
- } else {
- 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);
- if (filterRows && filterRows.length > 0) {
- 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{
- currentChoosedItem.priceStandard = row.priceStandard
- currentChoosedItem.priceSale = row.priceStandard
- currentChoosedItem.itemAmount = row.priceStandard
- }
- }
- // 设置赠品
- setFlgGift(_this);
- // 判断是否有可换件
- getReplaceFlag([row], _this);
- } else {
- 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
- })
- _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
- }
- // ***如果有子级,需要处理子级的数据 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
- }
- // 如果单品促销
- 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
- })
- }
- })
- 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
- }
|