|
|
@@ -0,0 +1,735 @@
|
|
|
+/*******************************************************************************
|
|
|
+ * Copyright(c) 2022 dongke All rights reserved. / Confidential
|
|
|
+ * 类的信息:
|
|
|
+ * 1.程序名称:
|
|
|
+ * 2.功能描述:商品选择
|
|
|
+ * 编辑履历:
|
|
|
+ * 作者 日期 版本 修改内容
|
|
|
+ * 于继渤 2022-05-13 1.00
|
|
|
+ *******************************************************************************/
|
|
|
+const api = require('../../utils/api.js');
|
|
|
+const Constants = require('../../utils/Constants.js');
|
|
|
+const common = require('../../utils/common.js');
|
|
|
+const chooseGoodsCommon = require('../../utils/chooseGoodsCommon.js');
|
|
|
+const app = getApp()
|
|
|
+Page({
|
|
|
+ /**
|
|
|
+ * 页面的初始数据
|
|
|
+ */
|
|
|
+ data: {
|
|
|
+ showFlag: false,
|
|
|
+ nonStandardListFlag: true,
|
|
|
+ skuloading: false,
|
|
|
+ specsId: undefined,
|
|
|
+ orderType: '',
|
|
|
+ followFlag: false, // 退换补标识
|
|
|
+ loading: false,
|
|
|
+ list: [],
|
|
|
+ pageInfo: {
|
|
|
+ pageSize: 10,
|
|
|
+ currentPage: 1
|
|
|
+ },
|
|
|
+ noMore: false,
|
|
|
+ choosedGoodsList: [], //已选商品列表
|
|
|
+ goodsList: [], //商品列表
|
|
|
+ goodsSkuList: [],//SPU对应的SKU
|
|
|
+ //------------------------
|
|
|
+ sumGoodsAmount: '0',//合计金额
|
|
|
+ sumQuantity: '0', // 合计数量
|
|
|
+ categoryQuantity: 0,// 品类数
|
|
|
+ mainActiveIndex: 0,
|
|
|
+ numNum: 0,
|
|
|
+ sideKey: 0,
|
|
|
+ search: '',
|
|
|
+ noMore: false,
|
|
|
+ loading: false,
|
|
|
+ pageInfo: {
|
|
|
+ pageSize: 10,
|
|
|
+ currentPage: 1
|
|
|
+ },
|
|
|
+ active: 0,
|
|
|
+ specsActive: -1, // 个别分类
|
|
|
+ showAdd: false,
|
|
|
+ showChoosed: false,
|
|
|
+ showAllSpecs: false,// 是否显示商品分类
|
|
|
+ updateIndex: null,
|
|
|
+ skuData: [], // 根据spuId查询出的sku信息
|
|
|
+ defSkuId: 0, // 默认的skuId
|
|
|
+ // 商品分类
|
|
|
+ typeList: [
|
|
|
+ {
|
|
|
+ name: "全部分类",
|
|
|
+ id: ''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "促销套餐",
|
|
|
+ id: 0
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ // sku规格
|
|
|
+ skuSpecsList: [],
|
|
|
+ // 可用的sku规格
|
|
|
+ skuSpecsData: [],
|
|
|
+ //单品促销
|
|
|
+ PricePromotionData: [],
|
|
|
+ tagList: [
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ name: '原木柜'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ name: '古典柜'
|
|
|
+ }, {
|
|
|
+ id: 3,
|
|
|
+ name: '金属柜'
|
|
|
+ }
|
|
|
+ , {
|
|
|
+ id: 4,
|
|
|
+ name: '生态柜'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 0,
|
|
|
+ name: '更多'
|
|
|
+ },
|
|
|
+
|
|
|
+ ],
|
|
|
+ infoTypeFlag: false,
|
|
|
+ infoTypeFlag1: false,
|
|
|
+ show_spec: false,
|
|
|
+ show_glassParameters: false,
|
|
|
+ },
|
|
|
+
|
|
|
+ changeTag(e) {
|
|
|
+ this.setData({
|
|
|
+ active: e.detail.index
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ closeChoosedItemInfo_spec() {
|
|
|
+ this.setData({
|
|
|
+ show_spec: false
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 允许从相机和相册扫码
|
|
|
+ * @param {*} e
|
|
|
+ */
|
|
|
+ scanQRCode(e) {
|
|
|
+ // 允许从相机和相册扫码
|
|
|
+ wx.scanCode({
|
|
|
+ success(res) {
|
|
|
+ let scancode = res.result
|
|
|
+ // 调转商品选品
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '../choose-goods/choose-goods?searchText=' + scancode.length > 14 ? scancode.substring(0, 14) : scancode,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 改变标识
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2022/8/6 17:16
|
|
|
+ */
|
|
|
+ changeAllReadyCheckBox(e) {
|
|
|
+ chooseGoodsCommon.changeAllReadyCheckBoxCommon(e, this)
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 分类切换
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2022/5/26 20:16
|
|
|
+ */
|
|
|
+ changeSidebar(e) {
|
|
|
+ let id = this.data.typeList[e.detail].id
|
|
|
+ if (id == "" && typeof (id) != 'number') {
|
|
|
+ this.setData({
|
|
|
+ sideKey: null,
|
|
|
+ specsId: null
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.setData({
|
|
|
+ sideKey: e.detail,
|
|
|
+ specsId: id
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ searchText: ''
|
|
|
+ })
|
|
|
+ // 查询
|
|
|
+ this.doSearch()
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 打开商品
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2022/7/2 20:16
|
|
|
+ */
|
|
|
+ openAddItemInfo(e) {
|
|
|
+ chooseGoodsCommon.openAddItemInfoCommon(e, this, 'shopping')
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 关闭产品
|
|
|
+ * @param {*} e
|
|
|
+ */
|
|
|
+ closeAddItemInfo() {
|
|
|
+ chooseGoodsCommon.closeAddItemInfoCommon(this)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 打开选择明细
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2022/7/4 20:16
|
|
|
+ */
|
|
|
+ openChoosedItemInfo(e) {
|
|
|
+ chooseGoodsCommon.openChoosedItemInfoCommon(e, this)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 删除选中的数据
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2022/7/4 20:16
|
|
|
+ */
|
|
|
+ delChoosedGoodsItem(e) {
|
|
|
+ chooseGoodsCommon.delChoosedGoodsItemCommon(e, this, true)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 确定
|
|
|
+ * @date : 2022/7/5 16:49
|
|
|
+ * @author : 周兴
|
|
|
+ */
|
|
|
+ submit() {
|
|
|
+ let choosedGoodsList = this.data.choosedGoodsList
|
|
|
+ choosedGoodsList.forEach((res, index) => {
|
|
|
+ if (res.combinedList && res.combinedList.length > 0) {
|
|
|
+ let skuListTemp = []
|
|
|
+ res.combinedList.forEach(item => {
|
|
|
+ skuListTemp = skuListTemp.concat(item.skuList)
|
|
|
+ })
|
|
|
+ res.goodsSkuList = skuListTemp
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ let goodsListTemp = []
|
|
|
+ // 处理数据
|
|
|
+ let list = chooseGoodsCommon.handleData(goodsListTemp, this);
|
|
|
+ //处理使用位置
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ list.forEach((it, index) => {
|
|
|
+ //过滤数量为零的数据
|
|
|
+ if (it.itemQuantity == 0) {
|
|
|
+ list.splice(index, 1)
|
|
|
+ }
|
|
|
+ if (it.goodsSkuList && it.goodsSkuList.length > 0) {
|
|
|
+ it.goodsSkuList.forEach(obj => {
|
|
|
+ obj.usedLocation = it.usedLocation
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ wx.setStorageSync('choosedGoodsList', this.data.choosedGoodsList)
|
|
|
+
|
|
|
+
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/package4/pages/order-billing/add/add?orderType=' + 1 + '&goodsList=' + encodeURIComponent(JSON.stringify(list)) + '&customerItem=' + this.data.customerItem + '&chooseFlag=true' + '&page=shopping',
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 查询
|
|
|
+ * @date : 2022/5/12 16:49
|
|
|
+ * @author : 于继渤
|
|
|
+ */
|
|
|
+ doSearch() {
|
|
|
+ let pageInfo = this.data.pageInfo;
|
|
|
+ pageInfo.pageSize = 10;
|
|
|
+ pageInfo.currentPage = 1;
|
|
|
+ this.setData({
|
|
|
+ show: false,
|
|
|
+ noMore: false,
|
|
|
+ pageInfo: pageInfo,
|
|
|
+ list: [],
|
|
|
+ goodsList: []
|
|
|
+ })
|
|
|
+ this.getData()
|
|
|
+ },
|
|
|
+
|
|
|
+ onSearchText(e) {
|
|
|
+ this.setData({
|
|
|
+ searchText: e.detail,
|
|
|
+ sideKey: 0,
|
|
|
+ specsId: null
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 获取商品数据
|
|
|
+ * @date : 2022/5/13 16:49
|
|
|
+ * @author : 于继渤
|
|
|
+ */
|
|
|
+ getData(e) {
|
|
|
+ this.setData({
|
|
|
+ loading: true
|
|
|
+ })
|
|
|
+ // 设置参数
|
|
|
+ let param = chooseGoodsCommon.setParam(this);
|
|
|
+ api.request(Constants.GOODS_SPU_API + 'get_spu_by_page', 'POST', param).then(res => {
|
|
|
+ this.setData({
|
|
|
+ loading: false
|
|
|
+ })
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ let tList = this.data.list;
|
|
|
+ let list = res.data.data.list; //后台返回数据
|
|
|
+ if (!list || list.length == 0) {
|
|
|
+ // 如果不是翻页,需要清空
|
|
|
+ if (e != 'more') {
|
|
|
+ this.setData({
|
|
|
+ list: [],
|
|
|
+ noMore: false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.setData({
|
|
|
+ noMore: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (list.length < this.data.pageInfo.pageSize) {
|
|
|
+ this.setData({
|
|
|
+ noMore: false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ tList = tList.concat(list)
|
|
|
+ // 设置图标绝对路径
|
|
|
+ common.setSkuIcon(tList);
|
|
|
+ this.setData({
|
|
|
+ list: tList,
|
|
|
+ goodsList: tList
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 数量的变化事件
|
|
|
+ * @param {*}
|
|
|
+ */
|
|
|
+ changeAllreadyChooseQuantityPop(e) {
|
|
|
+ let currentChoosedItem = this.data.currentChoosedItem
|
|
|
+ currentChoosedItem.itemQuantity = e.detail
|
|
|
+ if (currentChoosedItem.nonStandardArea) {
|
|
|
+ currentChoosedItem.itemAmount = Number(currentChoosedItem.priceSale * currentChoosedItem.itemQuantity * currentChoosedItem.nonStandardArea).toFixed(2)
|
|
|
+ currentChoosedItem.itemAmount = isNaN(currentChoosedItem.itemAmount) ? 0 : currentChoosedItem.itemAmount
|
|
|
+ } else {
|
|
|
+ currentChoosedItem.itemAmount = Number(currentChoosedItem.priceSale * currentChoosedItem.itemQuantity).toFixed(2)
|
|
|
+ currentChoosedItem.itemAmount = isNaN(currentChoosedItem.itemAmount) ? 0 : currentChoosedItem.itemAmount
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ currentChoosedItem: currentChoosedItem
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 生命周期函数--监听页面加载
|
|
|
+ * @date : 2022/5/13 16:49
|
|
|
+ * @author : 于继渤
|
|
|
+ */
|
|
|
+ onLoad: function (options) {
|
|
|
+ //订单新建
|
|
|
+ let ORDER_Add = common.hasButtonRight(Constants.ORDER_Add)
|
|
|
+ this.setData({
|
|
|
+ ORDER_Add: ORDER_Add,
|
|
|
+ })
|
|
|
+ let _this = this;
|
|
|
+ wx.getSystemInfo({
|
|
|
+ success: function (res) {
|
|
|
+ _this.setData({
|
|
|
+ windowHeight: res.windowHeight,
|
|
|
+ windowWidth: res.windowWidth
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let choosedGoodsList = wx.getStorageSync('choosedGoodsList')
|
|
|
+ let homeData = wx.getStorageSync('homeData')
|
|
|
+
|
|
|
+ if (choosedGoodsList.length > 0) {
|
|
|
+ this.setData({
|
|
|
+ skuData: homeData.skuData,
|
|
|
+ skuSpecsData: homeData.skuSpecsData,
|
|
|
+ skuSpecsList: homeData.skuSpecsList,
|
|
|
+ choosedGoodsList: choosedGoodsList
|
|
|
+ })
|
|
|
+ chooseGoodsCommon.getSumAmount(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ //设置来源
|
|
|
+ if (options.orderType) {
|
|
|
+ this.setData({
|
|
|
+ orderType: options.orderType
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 是否是退换补单(退换补单按照实际量进行处理)
|
|
|
+ if (options.followFlag) {
|
|
|
+ this.setData({
|
|
|
+ followFlag: options.followFlag
|
|
|
+ })
|
|
|
+ }
|
|
|
+ //预算报价客户信息
|
|
|
+ if (options.customerItem) {
|
|
|
+ this.setData({
|
|
|
+ customerItem: options.customerItem
|
|
|
+ })
|
|
|
+ }
|
|
|
+ //扫码搜索
|
|
|
+ if (options.searchText) {
|
|
|
+ this.setData({
|
|
|
+ searchText: options.searchText
|
|
|
+ })
|
|
|
+ }
|
|
|
+ //执行查询
|
|
|
+ this.doSearch()
|
|
|
+ this.getGoodsClassification()
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 加载商品分类
|
|
|
+ * @date : 2022/5/15 16:49
|
|
|
+ * @author : 于继渤
|
|
|
+ */
|
|
|
+ getGoodsClassification() {
|
|
|
+ let param = {
|
|
|
+ dataSourceCode: '商品规格分类',
|
|
|
+ cpId: app.globalData.user.cpId,
|
|
|
+ }
|
|
|
+ api.request(Constants.BASIC_COMMON_API + 'get_wx_init_data', 'POST', param).then(res => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+
|
|
|
+ let typeList = this.data.typeList
|
|
|
+ let list = res.data.data
|
|
|
+ list.forEach(item2 => {
|
|
|
+ let item = {
|
|
|
+ id: item2.id,
|
|
|
+ name: item2.name,
|
|
|
+ }
|
|
|
+ typeList.push(item)
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ typeList: typeList
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 选择数据
|
|
|
+ * @date : 2022/7/4 16:49
|
|
|
+ * @author : 周兴
|
|
|
+ */
|
|
|
+ chooseSkuInfo() {
|
|
|
+ chooseGoodsCommon.chooseSkuInfoCommon(this);
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 清空default
|
|
|
+ * @date : 2022/7/4 16:49
|
|
|
+ * @author : 周兴
|
|
|
+ */
|
|
|
+ clearDefault() {
|
|
|
+ chooseGoodsCommon.clearDefaultCommon(this);
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 已选商品更改数量计算合计
|
|
|
+ * @date : 2022/7/4 16:49
|
|
|
+ * @author : 周兴
|
|
|
+ */
|
|
|
+ changeAllreadyChooseQuantity(e) {
|
|
|
+ let choosedGoodsList = this.data.choosedGoodsList
|
|
|
+ let index = e.currentTarget.dataset.index
|
|
|
+ choosedGoodsList[index].itemQuantity = e.detail
|
|
|
+ choosedGoodsList[index].itemAmount = Number(choosedGoodsList[index].priceSale * choosedGoodsList[index].itemQuantity)
|
|
|
+ this.setData({
|
|
|
+ choosedGoodsList: choosedGoodsList,
|
|
|
+ })
|
|
|
+ // 计算合计金额
|
|
|
+ chooseGoodsCommon.getSumAmount(this);
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+* @desc : 标价折扣输入事件
|
|
|
+* @author : 于继渤
|
|
|
+* @date : 2022/5/31 17:16
|
|
|
+*/
|
|
|
+ changeDiscountStandardField(e) {
|
|
|
+ let currentChoosedItem = this.data.currentChoosedItem
|
|
|
+ currentChoosedItem.discountStandard = e.detail
|
|
|
+ this.setData({
|
|
|
+ currentChoosedItem: currentChoosedItem
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 销售价格编辑
|
|
|
+ * @author : 常皓宁
|
|
|
+ * @date : 2022/5/31 14:45
|
|
|
+ */
|
|
|
+ changeSalesPriceField(e) {
|
|
|
+ let priceSale = e.detail.value;
|
|
|
+ //优惠卷(标价负数)
|
|
|
+ if (this.data.currentChoosedItem.priceSale < 0) {
|
|
|
+ priceSale = Number(0 - e.detail.value)
|
|
|
+ }
|
|
|
+
|
|
|
+ chooseGoodsCommon.changeSalesPriceCommon(priceSale, this, false)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 修改销售价格
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2022/7/6 14:45
|
|
|
+ */
|
|
|
+ changeSalesPrice(priceSale) {
|
|
|
+ chooseGoodsCommon.changeSalesPriceCommon(priceSale, this, true)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 修改销售金额
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2022/7/4 14:45
|
|
|
+ */
|
|
|
+ changeItemAmountField(e) {
|
|
|
+ chooseGoodsCommon.changeItemAmountFieldCommon(e, this)
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 切换sku商品规格
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2022/6/1 10:16
|
|
|
+ */
|
|
|
+ changeSkuSpecs(e) {
|
|
|
+ chooseGoodsCommon.changeSkuSpecsCommon(e, this);
|
|
|
+ },
|
|
|
+
|
|
|
+ //主柜规格单选
|
|
|
+ clickZGGG(e) {
|
|
|
+ chooseGoodsCommon.clickZGGGCommon(e, this)
|
|
|
+ },
|
|
|
+
|
|
|
+ //定制品单选
|
|
|
+ clickDZP(e) {
|
|
|
+ chooseGoodsCommon.clickDZPCommon(e, this)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 切换组合促销明细
|
|
|
+ * @date : 2022/7/5 16:49
|
|
|
+ * @author : 周兴
|
|
|
+ */
|
|
|
+ changeCombinedItem(e) {
|
|
|
+ chooseGoodsCommon.changeCombinedItemCommon(e, this)
|
|
|
+ },
|
|
|
+
|
|
|
+ //单品促销单选
|
|
|
+ clickDP(e) {
|
|
|
+ chooseGoodsCommon.clickDPCommon(e, this)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 使用位置相关事件
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2022/5/26 12:16
|
|
|
+ */
|
|
|
+ changeUseLocation(e) {
|
|
|
+ let currentChoosedItem = this.data.currentChoosedItem
|
|
|
+ currentChoosedItem.usedLocation = e.detail
|
|
|
+ this.setData({
|
|
|
+ currentChoosedItem: currentChoosedItem
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 点击全部分类
|
|
|
+ * @date : 2022/7/8 16:49
|
|
|
+ * @author : 周兴
|
|
|
+ */
|
|
|
+ clickAllSpecs() {
|
|
|
+ // 让其他分类的标识置为-1
|
|
|
+ this.setData({
|
|
|
+ specsActive: -1,
|
|
|
+ specsId: null
|
|
|
+ })
|
|
|
+ // 查询数据
|
|
|
+ this.doSearch()
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 点击全部单个分类
|
|
|
+ * @date : 2022/7/8 16:49
|
|
|
+ * @author : 周兴
|
|
|
+ */
|
|
|
+ changeSpecsTabs(e) {
|
|
|
+ let index = e.detail.index;
|
|
|
+ this.setData({
|
|
|
+ specsActive: index,
|
|
|
+ })
|
|
|
+ let id = this.data.typeList[index].id
|
|
|
+ this.setData({
|
|
|
+ specsId: id
|
|
|
+ })
|
|
|
+ // 查询数据
|
|
|
+ this.doSearch()
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 是否显示商品分类页面
|
|
|
+ * @date : 2022/7/9 16:49
|
|
|
+ * @author : 周兴
|
|
|
+ */
|
|
|
+ displayAllSpecs() {
|
|
|
+ this.setData({
|
|
|
+ showAllSpecs: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 页面上拉触底事件的处理函数
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2022/8/1 12:16
|
|
|
+ */
|
|
|
+ scrollToLower() {
|
|
|
+ if (this.data.loading || this.data.noMore) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ pageInfo: {
|
|
|
+ pageSize: this.data.pageInfo.pageSize,
|
|
|
+ currentPage: this.data.pageInfo.currentPage + 1
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.getData('more')
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 页面上拉触底事件的处理函数
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2022/5/24 12:16
|
|
|
+ */
|
|
|
+ onReachBottom: function () {
|
|
|
+
|
|
|
+ if (this.data.loading || this.data.noMore || this.data.active == 1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ pageInfo: {
|
|
|
+ pageSize: this.data.pageInfo.pageSize,
|
|
|
+ currentPage: this.data.pageInfo.currentPage + 1
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.getData('more')
|
|
|
+ },
|
|
|
+
|
|
|
+ onCloseDel(event) {
|
|
|
+ const { position, instance } = event.detail;
|
|
|
+ let indexdata = event.currentTarget.dataset.index
|
|
|
+ let form = this.data.form
|
|
|
+ let arr = this.data.goodsList
|
|
|
+
|
|
|
+ Dialog.confirm({
|
|
|
+ message: '确定删除吗?',
|
|
|
+ }).then(() => {
|
|
|
+ if (arr[indexdata].itemId) {
|
|
|
+ let orderItemDeleteVOListIds = []
|
|
|
+ //包含所有明细id
|
|
|
+ orderItemDeleteVOListIds.push(arr[indexdata].itemId)
|
|
|
+ if (arr[indexdata].goodsSkuList && arr[indexdata].goodsSkuList.length > 0) {
|
|
|
+ arr[indexdata].goodsSkuList.forEach(it => {
|
|
|
+ orderItemDeleteVOListIds.push(it.itemId)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ form.orderItemDeleteVOList = form.orderItemDeleteVOList.concat(orderItemDeleteVOListIds)
|
|
|
+ }
|
|
|
+
|
|
|
+ arr.splice(indexdata, 1)
|
|
|
+ this.setData({
|
|
|
+ goodsList: arr,
|
|
|
+ form: form
|
|
|
+ })
|
|
|
+ //计算
|
|
|
+ this.calculation()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onShow: function () {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let choosedGoodsListTemp = wx.getStorageSync('choosedGoodsList')
|
|
|
+ if (choosedGoodsListTemp.length > 0) {
|
|
|
+ let choosedGoodsList = this.data.choosedGoodsList.concat(choosedGoodsListTemp)
|
|
|
+
|
|
|
+ let map = new Map();
|
|
|
+ for (let item of choosedGoodsList) {
|
|
|
+ map.set(item.id, item);
|
|
|
+ }
|
|
|
+ choosedGoodsList = [...map.values()];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ this.setData({
|
|
|
+ choosedGoodsList: choosedGoodsList
|
|
|
+ })
|
|
|
+ chooseGoodsCommon.getSumAmount(this);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 选择非标参数事件
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2022/8/24 13:16
|
|
|
+ */
|
|
|
+ nonStandardTap(e) {
|
|
|
+ chooseGoodsCommon.nonStandardTap(e, this)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 设置非标匹配参数
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2022/8/24 13:16
|
|
|
+ */
|
|
|
+ setNonStandardMatchingParameters() {
|
|
|
+ chooseGoodsCommon.setNonStandardMatchingParameters(e, this)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 非标商品选择事件
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2022/8/24 13:16
|
|
|
+ */
|
|
|
+ nonGlassSpuItemsTap(e) {
|
|
|
+ chooseGoodsCommon.nonGlassSpuItemsTap(e, this)
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 非标商品非标参数输入事件
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2022/8/24 13:16
|
|
|
+ */
|
|
|
+ bindInputIsScopeOne(e) {
|
|
|
+ chooseGoodsCommon.bindInputIsScopeOne(e, this)
|
|
|
+ },
|
|
|
+ bindBlurIsScopeOne(e) {
|
|
|
+ chooseGoodsCommon.bindBlurIsScopeOne(e, this)
|
|
|
+ },
|
|
|
+ changeFlgAllowSpecsUndefine(e) {
|
|
|
+
|
|
|
+ let currentChoosedItem = this.data.currentChoosedItem
|
|
|
+ currentChoosedItem.flgSpecsUndefine = e.detail
|
|
|
+ this.setData({
|
|
|
+ currentChoosedItem: currentChoosedItem
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ bindInputNonStantardArea(e) {
|
|
|
+
|
|
|
+ chooseGoodsCommon.bindInputNonStantardArea(e, this)
|
|
|
+ },
|
|
|
+ //面积离焦
|
|
|
+ bindBlurNonStantardArea(e) {
|
|
|
+
|
|
|
+ chooseGoodsCommon.bindBlurNonStantardArea(e, this)
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 计算折扣反算销售价格
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2022/7/4 14:45
|
|
|
+ */
|
|
|
+ changeDiscountField(e) {
|
|
|
+ chooseGoodsCommon.changeDiscountFieldCommon(e, this)
|
|
|
+ }
|
|
|
+})
|