|
@@ -25,10 +25,10 @@ Page({
|
|
|
searchList: [],
|
|
|
dialogShow: false,
|
|
|
submitQty: 1,
|
|
|
+ packagetypemxrows: [],
|
|
|
modification: false, //是否为修改套餐数量
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
- console.log(options)
|
|
|
if (options.params) {
|
|
|
let params = JSON.parse(options.params);
|
|
|
if (!params.content.pageNumber || !params.content.pageTotal) {
|
|
@@ -49,13 +49,32 @@ Page({
|
|
|
})
|
|
|
let packageList = []
|
|
|
try {
|
|
|
- packageList = res.data.find(v => v.value == params.content.packagetype).subvalues
|
|
|
- } catch (error) {}
|
|
|
+ let packagetypemxrows = [];
|
|
|
+
|
|
|
+ if (options.packagetypemxrows) {
|
|
|
+ this.data.packagetypemxrows = JSON.parse(options.packagetypemxrows);
|
|
|
+ packagetypemxrows = this.data.packagetypemxrows.map(v => v.packagetypemx);
|
|
|
+ }
|
|
|
+ packageList = res.data.find(v => v.value == params.content.packagetype).subvalues;
|
|
|
+ if (packagetypemxrows.length != 0) {
|
|
|
+ if (options.butText == '调整套数') {
|
|
|
+ packageList = packagetypemxrows
|
|
|
+ this.setData({
|
|
|
+ "submitQty": this.data.packagetypemxrows[0].packagetypeqty
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ packageList = packageList.filter(v => !packagetypemxrows.includes(v))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error("error", error)
|
|
|
+ }
|
|
|
let getListPa = "";
|
|
|
if (options.getListPa) {
|
|
|
getListPa = JSON.parse(options.getListPa);
|
|
|
getListPa.content.pageNumber = 1;
|
|
|
getListPa.content.pageSize = 9999;
|
|
|
+ getListPa.content.onlyquery = 1;
|
|
|
getListPa.content.where = {
|
|
|
packagetypemx: ''
|
|
|
}
|
|
@@ -114,21 +133,22 @@ Page({
|
|
|
}.bind(this)
|
|
|
},
|
|
|
async getList(init = false) {
|
|
|
- wx.showLoading({
|
|
|
- title: '加载中...',
|
|
|
- mask: true
|
|
|
- })
|
|
|
//init 用于初始化分页
|
|
|
if (init.detail != undefined) init = init.detail;
|
|
|
let params = this.data.params;
|
|
|
if (init) params.content.pageNumber = 1
|
|
|
params.content.pageSize = 9999;
|
|
|
if (params.content.pageNumber > params.content.pageTotal) return;
|
|
|
-
|
|
|
let res = {},
|
|
|
- submitQty = 1,
|
|
|
CompleteCustomization = false,
|
|
|
modification = false;
|
|
|
+ if (params.content.where.packagetypemx == '') return this.setData({
|
|
|
+ loading: false
|
|
|
+ })
|
|
|
+ wx.showLoading({
|
|
|
+ title: '加载中...',
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
if (this.data.getListPa) {
|
|
|
this.data.getListPa.content.where.packagetypemx = params.content.where.packagetypemx;
|
|
|
res = await _Http.basic(this.data.getListPa);
|
|
@@ -156,8 +176,6 @@ Page({
|
|
|
}).format();
|
|
|
let newPrice = this.data.newPrice,
|
|
|
oldPrice = this.data.oldPrice;
|
|
|
-
|
|
|
- if (res.data.length) submitQty = res.data[0].qty ? res.data[0].qty / res.data[0].orderminqty : 1;
|
|
|
res.data = res.data.map(value => {
|
|
|
if (value.attinfos.length != 0) {
|
|
|
value.attinfos = file.fileList(value.attinfos)
|
|
@@ -187,7 +205,6 @@ Page({
|
|
|
'params.content.pageNumber': res.pageNumber + 1,
|
|
|
'params.content.pageTotal': res.pageTotal,
|
|
|
'params.content.total': res.total,
|
|
|
- submitQty,
|
|
|
modification,
|
|
|
list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
|
|
|
loading: false
|
|
@@ -198,6 +215,13 @@ Page({
|
|
|
this.setData({
|
|
|
"params.content.where.packagetypemx": e.detail.name
|
|
|
})
|
|
|
+ try {
|
|
|
+ this.setData({
|
|
|
+ "submitQty": this.data.packagetypemxrows.find(v => v.packagetypemx == e.detail.name).packagetypeqty || 1
|
|
|
+ })
|
|
|
+ } catch (error) {
|
|
|
+
|
|
|
+ }
|
|
|
this.getList(true)
|
|
|
},
|
|
|
changeQtySte({
|
|
@@ -231,7 +255,7 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- if (this.data.modification) {
|
|
|
+ /* if (this.data.modification) {
|
|
|
wx.showModal({
|
|
|
title: '提示',
|
|
|
content: '您已添加过此套餐,是否需要重新调整套数?',
|
|
@@ -245,7 +269,8 @@ Page({
|
|
|
})
|
|
|
} else {
|
|
|
handle()
|
|
|
- }
|
|
|
+ } */
|
|
|
+ handle()
|
|
|
|
|
|
function handle() {
|
|
|
that.setData({
|