|
|
@@ -0,0 +1,146 @@
|
|
|
+const _Http = getApp().globalData.http,
|
|
|
+ currency = require("../../utils/currency"),
|
|
|
+ CNY = value => currency(value, {
|
|
|
+ symbol: "¥",
|
|
|
+ precision: 2
|
|
|
+ }).format();
|
|
|
+
|
|
|
+
|
|
|
+Page({
|
|
|
+ data: {
|
|
|
+ list: [],
|
|
|
+ "content": {
|
|
|
+ nocache: true,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageTotal": 1,
|
|
|
+ "pageSize": 20,
|
|
|
+ "where": {
|
|
|
+ "condition": "",
|
|
|
+ "status": ""
|
|
|
+ },
|
|
|
+ },
|
|
|
+ filtratelist: [{
|
|
|
+ label: "状态",
|
|
|
+ index: null,
|
|
|
+ showName: "value", //显示字段
|
|
|
+ valueKey: "status", //返回Key
|
|
|
+ selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
|
|
|
+ value: "", //选中值
|
|
|
+ list: [{
|
|
|
+ value: "新建"
|
|
|
+ }, {
|
|
|
+ value: "撤回"
|
|
|
+ }, {
|
|
|
+ value: "提交"
|
|
|
+ }, {
|
|
|
+ value: "确认"
|
|
|
+ }, {
|
|
|
+ value: "审核"
|
|
|
+ }, {
|
|
|
+ value: "已入库"
|
|
|
+ }, {
|
|
|
+ value: "关闭"
|
|
|
+ }]
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ this.setData({
|
|
|
+ userrole: wx.getStorageSync('userrole'),
|
|
|
+ insert: wx.getStorageSync('auth').wrepair.options.some(v => v == 'insert'), //查询新增权限
|
|
|
+ })
|
|
|
+ this.getList(true)
|
|
|
+ },
|
|
|
+ /* 获取产品 */
|
|
|
+ getList(init = false) {
|
|
|
+ if (init.detail != undefined) init = init.detail;
|
|
|
+ let content = this.data.content;
|
|
|
+ if (init) content.pageNumber = 1;
|
|
|
+ if (content.pageNumber > content.pageTotal) return;
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20230105161503,
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("返修退货申请单", res)
|
|
|
+ this.selectComponent('#ListBox').RefreshToComplete();
|
|
|
+ this.selectComponent("#ListBox").setHeight(".tab", this);
|
|
|
+ res.data = res.data.map(v => {
|
|
|
+ v.returnamount = CNY(v.returnamount)
|
|
|
+ return v
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
|
|
|
+ "content.pageNumber": res.pageNumber + 1,
|
|
|
+ "content.pageTotal": res.pageTotal,
|
|
|
+ "content.sort": res.sort,
|
|
|
+ "content.total": res.total,
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ updateList() {
|
|
|
+ let content = JSON.parse(JSON.stringify(this.data.content));
|
|
|
+ content.pageSize = (content.pageNumber - 1) * content.pageSize;
|
|
|
+ content.pageNumber = 1;
|
|
|
+ _Http.basic({
|
|
|
+ id: '20230105161503',
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("更新", res);
|
|
|
+ if (res.code == '1') {
|
|
|
+ res.data = res.data.map(v => {
|
|
|
+ v.returnamount = CNY(v.returnamount)
|
|
|
+ return v
|
|
|
+ })
|
|
|
+ page.setData({
|
|
|
+ list: res.data
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onSearch({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ if (detail != this.data.content.where.condition) {
|
|
|
+ this.setData({
|
|
|
+ "content.where.condition": detail
|
|
|
+ })
|
|
|
+ this.getList(true)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ toAdd() {
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20230105110003,
|
|
|
+ content: {
|
|
|
+ pageSize: 1
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("选择序列号", res)
|
|
|
+ if (res.msg == '成功') {
|
|
|
+ if (res.total == 1) {
|
|
|
+ _Http.skuItem = res.data[0];
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/packageA/repair/insert',
|
|
|
+ })
|
|
|
+ } else if (res.total == 0) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '无可选择序列号',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/packageA/repair/select'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 处理筛选 */
|
|
|
+ handleFilter(e) {
|
|
|
+ e.detail.condition = this.data.content.where.condition;
|
|
|
+ e.detail.begindate = e.detail.startdate
|
|
|
+ this.setData({
|
|
|
+ "content.where": e.detail
|
|
|
+ })
|
|
|
+ console.log("this.data.content", this.data.content)
|
|
|
+ this.getList(true)
|
|
|
+ },
|
|
|
+})
|