| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- /*******************************************************************************
- * Copyright(c) 2022 dongke All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 王英杰 2024-1-23 1.00 商品档案
- *******************************************************************************/
- const Constants = require('@/utils/Constants.js');
- const util = require('@/utils/util.js')
- const mixins = require('@/mixins/index.js')
- const app = getApp()
- Page({
- mixins: [mixins],
- /**
- * 页面的初始数据
- */
- data: {
- commonService: app.globalData['commonService'],
- flgValidList: null,
- buttonList: [{
- name: 'merge',
- title: mixins.$t("add"), //'保存'
- }],
- //接口
- goodsSeriesService: app.globalData['goodsSeriesService'],
- routeObjName: 'goodsSku',
- tableData: [],
- // 查询条件
- searchContent: [{
- code: 'flgValid',
- title: mixins.$t('flagV'),
- key: 'valueList',
- searchType: Constants.searchType.switch,
- list: [{
- code: 1,
- title: mixins.$t('valid'),
- value: true,
- checked: true
- },
- {
- code: 2,
- title: mixins.$t('invalid'),
- value: false
- }
- ]
- }, ],
- sidebarList: [], //左边系列名字
- contentList: [{ //内容
- name: 'skuName',
- title: mixins.$t('skuName')
- },
- {
- name: 'brandName',
- title: mixins.$t('goodsBrand')
- },
- {
- name: 'seriesName',
- title: mixins.$t('goodsSeries')
- },
- {
- name: 'skuSpec',
- title: mixins.$t('sukSpec')
- }
- ],
- sideKey: 0,
- // 商品品牌
- sidebarList: [{ //增加全部标头
- brandName: mixins.$t('all'),
- brandId: ''
- }],
- // 主键Id
- primaryKey: 'skuId',
- },
- /**
- * @desc : 初始页面加载数据
- * @author : 王英杰
- * @date : 2024/1/23 9:16
- */
- onShow() {
- // 获取品牌
- this.getGoodsBrandNoPage().then(res=>{
- let item = this.data.item
- if(item && item.brandId){
- let sidebarList = this.data.sidebarList;
- let index = sidebarList.findIndex(it=>it.brandId == item.brandId)
- this.setData({
- sideKey:index,
- brandId:item.brandId
- })
- // 重新根据品牌进行查询
- this.searchData();
- }
- })
- },
- /**
- * @desc : 获取品牌
- * @author : 王英杰
- * @date : 2024/1/23 9:16
- */
- getGoodsBrandNoPage() {
- let excute = this.excute(this.data.commonService, this.data.commonService.getGoodsBrandNoPage, {flgValid:true});
- excute.then(res => {
- if (res.data.code === Constants.SUCESS_CODE) {
- let sidebarList = []
- let List = [{ //增加全部标头
- brandName: mixins.$t('all'),
- brandId: ''
- }]
- sidebarList = List.concat(res.data.data);
- this.setData({
- sidebarList: sidebarList
- })
- }
- })
- return excute;
- },
- /**
- * @desc : 设置查询参数
- * @author : 王英杰
- * @date : 2024/1/23 9:16
- */
- setSearchParams(params) {
- params.brandId = this.data.brandId
- //有效标识
- params.flgValidList = params.flgValidList ? params.flgValidList : [true]
- params.brandIds = (params.brandIds && params.brandIds.length > 0) ? params.brandIds.join(',') : undefined
- return params
- },
- /**
- * @desc : 加载数据
- * @author : 王英杰
- * @date : 2024/1/23 9:16
- */
- getData(params) {
- return this.excute(this.data.service, this.data.service.selectByCond, params);
- },
- /**
- * @desc : 启用停用
- * @date : 2024/2/1 15:49
- * @author : 王英杰
- */
- deactivateEnable(e) {
- let item = e.detail.item
- //执行接口
- this.handleMoreDataIsValid(this.data.service, item, 'skuId')
- },
- /**
- * @desc : 分类切换
- * @author : 王英杰
- * @date : 2022/5/26 20:16
- */
- changeSidebar(e) {
- let id = this.data.sidebarList[e.detail].brandId
- this.setData({
- brandId: id,
- sideKey: e.detail
- })
- this.searchData()
- },
- onLoad(){
- let _this = this;
- this.getStickyHeight()
- wx.getSystemInfo({
- success: function (res) {
- _this.setData({
- windowHeight: res.windowHeight,
- windowWidth: res.windowWidth
- })
- }
- })
- }
- })
|