|
|
@@ -0,0 +1,65 @@
|
|
|
+const _Http = getApp().globalData.http;
|
|
|
+Page({
|
|
|
+ data: {
|
|
|
+ result: [],
|
|
|
+ "content": {
|
|
|
+ "sa_contractid": 1,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 20,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ this.setData({
|
|
|
+ "content.sa_contractid": options.sa_contractid
|
|
|
+ })
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ toggle(e) {
|
|
|
+ const {
|
|
|
+ itemclassid
|
|
|
+ } = e.currentTarget.dataset.item;
|
|
|
+ let result = this.data.result;
|
|
|
+ let index = result.findIndex(v => v == itemclassid);
|
|
|
+ index == -1 ? result.push(itemclassid + "") : result.splice(index, 1);
|
|
|
+ this.setData({
|
|
|
+ result
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getList(init = false) {
|
|
|
+ let content = this.data.content;
|
|
|
+ if (init) content.pageNumber = 1;
|
|
|
+ if (content.pageNumber > content.pageTotal) return;
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20221124140102,
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("可添加类别", res)
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
|
|
|
+ "paging.pageNumber": res.pageNumber + 1,
|
|
|
+ "paging.pageTotal": res.pageTotal,
|
|
|
+ "paging.total": res.total,
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ submit() {
|
|
|
+ let page = getCurrentPages().find(v => v.__route__ == 'packageA/contract/detail');
|
|
|
+ if (page) page.selectComponent("#PiscountType").handleAdd(this.data.result.map(v => {
|
|
|
+ return {
|
|
|
+ "sa_contract_itemsaleclassid": 0,
|
|
|
+ "itemclassid": v,
|
|
|
+ "discountrate": 1
|
|
|
+ }
|
|
|
+ }))
|
|
|
+ },
|
|
|
+ onReachBottom() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+})
|