Browse Source

订单变更申请

xiaohaizhao 2 days ago
parent
commit
de1c2acd84

+ 1 - 0
E-service/serviceBillList/insert.js

@@ -237,6 +237,7 @@ Page({
         sa_orderid: data.sa_orderid ? [data.sonum, [data.sa_orderid]] : ''
       })
       this.selectComponent("#Form").confirm()
+      
     }
     this.setOrdeForm();
   },

+ 1 - 0
app.json

@@ -28,6 +28,7 @@
         "shopping/index",
         "orderForm/index",
         "orderForm/detail",
+        "orderForm/alteration",
         "orderForm/add/add",
         "orderForm/modules/setBrand/index",
         "shipment/index",

+ 208 - 0
packageA/orderForm/alteration.js

@@ -0,0 +1,208 @@
+const _Http = getApp().globalData.http;
+Page({
+    data: {
+        loading: false,
+        disabled: true,
+        showAll: false,
+        selectedProducts: [],
+        sa_orderid: null,
+        today: '',
+        form: [{
+            label: "服务类型",
+            error: false,
+            errMsg: "",
+            hint: "",
+            type: "radio",
+            value: "",
+            radioList: [],
+            valueName: "typeclass", //绑定的字段名称
+            required: true, //必填
+            checking: `base`,
+        }, {
+            label: "原因描写",
+            error: false,
+            errMsg: "",
+            type: "textarea",
+            value: "",
+            placeholder: "请填写",
+            valueName: "remarks",
+            required: true,
+            checking: "base"
+        }]
+    },
+    onLoad(options) {
+        // 设置今天的日期,用于日期选择器的start值
+        const today = new Date();
+        const year = today.getFullYear();
+        const month = String(today.getMonth() + 1).padStart(2, '0');
+        const day = String(today.getDate()).padStart(2, '0');
+        const todayStr = `${year}-${month}-${day}`;
+
+        this.setData({
+            sa_orderid: options.id,
+            today: todayStr
+        });
+        this.getDetail();
+        getApp().globalData.Language.getLanguagePackage(this, '订单变更申请');
+        const form = this.data.form;
+        _Http.basic({
+            "classname": "sysmanage.develop.optiontype.optiontype",
+            "method": "optiontypeselect",
+            "content": {
+                "pageNumber": 1,
+                "pageSize": 1000,
+                "typename": "orderchangereason",
+            },
+        }).then(res => {
+            console.log("变更类型", res)
+            if (res.code == 1) {
+                let data = form.find(v => v.valueName == 'typeclass');
+                data.radioList = res.data.map(v => {
+                    return {
+                        id: v.value,
+                        name: v.value,
+                    }
+                });;
+                data.value = data.value || data.radioList[0].id;
+                this.setData({
+                    form
+                })
+            }
+        })
+    },
+    getDetail() {
+        // 从详情页面获取选中的商品
+        let pages = getCurrentPages();
+        let detailPage = pages.find(v => v.__route__ == 'packageA/orderForm/detail');
+        this.setData({
+            selectedProducts: detailPage.data.selectedProducts || []
+        });
+
+        if (this.data.selectedProducts.length == 0) {
+            wx.showToast({
+                title: '请先选择要变更的商品',
+                icon: 'none'
+            });
+            setTimeout(() => {
+                wx.navigateBack();
+            }, 1000);
+        }
+    },
+    onConfirm({
+        detail
+    }) {
+        this.setData({
+            disabled: detail
+        })
+    },
+    /* 处理变更数量 */
+    onChangeValue(e) {
+        const {
+            index
+        } = e.currentTarget.dataset;
+        const value = e.detail.value;
+        let selectedProducts = [...this.data.selectedProducts];
+        selectedProducts[index].newvalue = value;
+        this.setData({
+            selectedProducts
+        });
+    },
+    /* 处理变更交期 */
+    onChangeDate(e) {
+        const {
+            index
+        } = e.currentTarget.dataset;
+        const value = e.detail.value;
+        let selectedProducts = [...this.data.selectedProducts];
+        selectedProducts[index].newdeliverydate = value;
+        this.setData({
+            selectedProducts
+        });
+    },
+    /* 取消按钮点击事件 */
+    cancel() {
+        wx.showModal({
+            title: '提示',
+            content: '确定要取消订单变更申请吗?',
+            cancelText: '取消',
+            confirmText: '确定',
+            success: (res) => {
+                if (res.confirm) {
+                    wx.navigateBack();
+                }
+            }
+        });
+    },
+    /* 提交按钮点击事件 */
+    submit() {
+        // 二次确认
+        wx.showModal({
+            title: '提示',
+            content: '确定要提交订单变更申请吗?',
+            cancelText: '取消',
+            confirmText: '确定',
+            success: (res) => {
+                if (res.confirm) {
+                    this.doSubmit();
+                }
+            }
+        });
+    },
+    /* 执行提交操作 */
+    doSubmit() {
+        // 提交申请
+        this.setData({
+            loading: true,
+            disabled: true
+        });
+        // 构建itemifnos数组
+        let itemifnos = this.data.selectedProducts.map(item => {
+            return {
+                sa_orderitemsid: item.sa_orderitemsid,
+                itemid: item.itemid,
+                newvalue: item.newvalue || item.qty,
+                newdeliverydate: item.newdeliverydate || item.deliverydate || ''
+            };
+        });
+        _Http.basic({
+            "id": "2026033114502902",
+            "content": {
+                sa_orderid: this.data.sa_orderid,
+                type: "",
+                ...this.selectComponent("#Form").submit(),
+                itemifnos
+            }
+        }).then(res => {
+            console.log('提交订单变更申请', res);
+            this.setData({
+                loading: false,
+                disabled: false
+            });
+
+            if (res.code == '1') {
+                wx.showToast({
+                    title: '提交成功',
+                    icon: 'success'
+                });
+                setTimeout(() => {
+                    wx.navigateBack();
+                }, 1000);
+            } else {
+                wx.showToast({
+                    title: res.msg,
+                    icon: 'none'
+                });
+            }
+        }).catch(err => {
+            console.error('提交订单变更申请失败', err);
+            this.setData({
+                loading: false,
+                disabled: false
+            });
+            wx.showToast({
+                title: '提交失败,请重试',
+                icon: 'none'
+            });
+        });
+    }
+})

+ 10 - 0
packageA/orderForm/alteration.json

@@ -0,0 +1,10 @@
+{
+  "navigationBarTitleText": "订单变更申请",
+  "usingComponents": {
+    "Yl_Headline": "../../components/Yl_Headline/index",
+    "Yl_Field": "../../components/Yl_Field/index",
+    "van-button": "@vant/weapp/button",
+    "van-image": "@vant/weapp/image",
+    "van-loading": "@vant/weapp/loading"
+  }
+}

+ 188 - 0
packageA/orderForm/alteration.scss

@@ -0,0 +1,188 @@
+.product-title {
+  font-size: 28rpx;
+  font-weight: 600;
+  color: #333;
+  margin: 20rpx 30rpx;
+  padding-bottom: 10rpx;
+  border-bottom: 1rpx solid #ddd;
+}
+
+.product-item {
+  background-color: #fff;
+  box-sizing: border-box;
+  border-bottom: 1rpx solid #DDDDDD;
+  margin-top: 20rpx;
+
+  .product {
+    padding: 20rpx 30rpx;
+    box-sizing: border-box;
+
+    .mian {
+      position: relative;
+      display: flex;
+      align-items: center;
+      width: 100%;
+      box-sizing: border-box;
+
+      .img {
+        position: relative;
+        flex-shrink: 0;
+        width: 112rpx;
+        height: 112rpx;
+        border-radius: 16rpx;
+        margin-right: 20rpx;
+
+        .err {
+          display: flex;
+          width: 100%;
+          height: 100%;
+          align-items: center;
+          justify-content: center;
+          font-size: 22rpx;
+          border: 1px solid #ddd;
+          box-sizing: border-box;
+          color: #666;
+          border-radius: 16rpx;
+        }
+      }
+
+      .dec {
+        flex: 1;
+        width: 0;
+        min-height: 128rpx;
+        height: 100%;
+        font-size: 24rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #999999;
+
+        .title {
+          display: flex;
+          width: 90%;
+          height: 40rpx;
+          font-size: 28rpx;
+          font-weight: 600;
+          color: #333333;
+
+          .line-1 {
+            max-width: 380rpx;
+          }
+
+          .tag {
+            display: inline-block;
+            color: #fff;
+            background-color: #F80700;
+            padding: 0 20rpx;
+            margin-left: 20rpx;
+            border-radius: 20rpx;
+            font-weight: normal;
+            font-size: 22rpx;
+            line-height: 40rpx;
+          }
+        }
+
+        .subfield {
+          display: flex;
+          margin-top: 8rpx;
+          height: 34rpx;
+          line-height: 34rpx;
+
+          text {
+            display: inline-block;
+            width: 48%;
+          }
+        }
+
+        .price {
+          font-size: 30rpx;
+          color: #FF3B30;
+        }
+
+      }
+
+    }
+  }
+
+  .bot {
+    width: 690rpx;
+    border-top: 1rpx solid #ddd;
+    margin: 0 auto;
+    padding-bottom: 20rpx;
+
+    .row {
+      display: flex;
+      width: 100%;
+      margin-top: 20rpx;
+
+      view {
+        display: flex;
+        height: 54rpx;
+        align-items: center;
+        width: 50%;
+
+        .label {
+          width: 110rpx;
+          font-size: 24rpx;
+          font-family: PingFang SC-Regular, PingFang SC;
+          color: #666666;
+        }
+      }
+
+      .input {
+        height: 54rpx;
+        background: #FFFFFF;
+        border-radius: 8rpx;
+        border: 1rpx solid #CCCCCC;
+        font-size: 28rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #333333;
+        line-height: 44px;
+        text-align: center;
+      }
+
+      .money {
+        flex: 1;
+        display: flex;
+        justify-content: flex-end;
+        font-size: 24rpx;
+        font-family: PingFang SC-Medium, PingFang SC;
+        color: #666666;
+        margin-right: 20rpx;
+
+        text {
+          font-size: 28rpx;
+          color: #FF3B30;
+          font-weight: 600;
+        }
+      }
+
+    }
+  }
+}
+
+.new-footer {
+  display: flex;
+  align-items: center;
+  justify-content: flex-end;
+  position: fixed;
+  width: 100vw;
+  height: 130rpx;
+  background: #FFFFFF;
+  box-shadow: 0px -4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+  bottom: 0;
+  z-index: 9999;
+
+  .new-submit {
+    background: #3874F6;
+    color: #FFFFFF;
+    font-weight: bold;
+  }
+
+  .but {
+    margin-right: 30rpx;
+    width: 156rpx;
+    height: 90rpx;
+    border-radius: 8rpx;
+    font-size: 28rpx;
+    font-family: PingFang SC-Bold, PingFang SC;
+  }
+}

+ 61 - 0
packageA/orderForm/alteration.wxml

@@ -0,0 +1,61 @@
+<Yl_Field id='Form' form='{{form}}' showAll='{{!showAll}}' bind:onConfirm='onConfirm' bind:interrupt="interrupt" />
+
+<view wx:for="{{selectedProducts}}" wx:key="itemid" class="product-item">
+    <navigator class="product" url="#">
+        <view class="mian">
+            <view class="img" data-file="{{item.attinfos}}">
+                <van-image width="100%" height="100%" wx:if="{{item.cover}}" src="{{item.cover}}" use-loading-slot lazy-load>
+                    <van-loading slot="loading" type="spinner" size="20" vertical />
+                </van-image>
+                <text wx:else class="err">{{language['暂无图片']||'暂无图片'}}</text>
+            </view>
+            <view class="dec">
+                <view class="title">
+                    <text class="line-1">{{item.itemname}}</text>
+                </view>
+                <view class="subfield">
+                    {{language['编号']||'编号'}}:{{item.itemno}}
+                </view>
+                <view class="subfield">
+                    <text class="line-1" style="margin-right: 6rpx;">{{language['型号']||'型号'}}:{{language[item.model]||item.model||' --'}}</text>
+                    <text class="line-1" wx:if="{{siteid!='HY'}}">{{language['规格']||'规格'}}:{{language[item.spec]||item.spec||' --'}}</text>
+                </view>
+                <view class="subfield" wx:if="{{siteid=='HY'}}">
+                    <text class="line-1" style="margin-right: 6rpx;">{{language['公称通径']||'公称通径'}}:{{language[item.caliber]||item.caliber||' --'}}</text>
+                    <text class="line-1">{{language['公称压力']||'公称压力'}}:{{join.formatting(item.nominalpressure)}}</text>
+                </view>
+                <view class="subfield">
+                    <text class="line-1" style="margin-right: 6rpx;">{{language['已发货数量']||'已发货数量'}}:{{item.deliedqty||'0'}}</text>
+                    <text class="line-1" style="margin-right: 6rpx;">{{language['未发货数量']||'未发货数量'}}:{{item.undeliqty||'0'}}</text>
+                </view>
+                <view class="subfield">
+                    <text class="line-1" style="margin-right: 6rpx;">{{language['订单数量']||'订单数量'}}:{{item.qty}}</text>
+                    <text class="line-1">{{language['回复交期']||'回复交期'}}:{{item.deliverydate || ' --'}}</text>
+                </view>
+            </view>
+        </view>
+    </navigator>
+    <view class="bot">
+        <view class="row">
+            <view>
+                <view class="label">{{language['变更数量']||'变更数量'}}<text wx:if="{{item.auxunit}}">({{item.auxunit}})</text></view>
+                <input class="input" style="width: 180rpx;" type="digit" value="{{item.newvalue || item.qty}}" data-index="{{index}}" bindinput="onChangeValue" />
+            </view>
+            <view>
+                <view class="label">{{language['变更交期']||'变更交期'}}</view>
+                <picker mode="date" value="{{item.newdeliverydate || item.deliverydate}}" start="{{today}}" bindchange="onChangeDate" data-index="{{index}}">
+                    <view class="input" style="width: 156rpx;padding:0 30rpx;">
+                        {{item.newdeliverydate || item.deliverydate || language['选择日期']||'选择日期'}}
+                    </view>
+                </picker>
+            </view>
+        </view>
+    </view>
+</view>
+
+<view style="height: 150rpx;" />
+<view class="new-footer">
+    <van-button custom-class='but' bindclick='cancel'>{{language['取消']||'取消'}}</van-button>
+    <van-button custom-class='new-submit but' disabled='{{disabled || loading}}' loading='{{loading}}' bindclick='submit'>{{language['提交']||'提交'}}</van-button>
+</view>
+<wxs src="../../../utils/nominalpressure.wxs" module="join"></wxs>

+ 34 - 0
packageA/orderForm/detail.js

@@ -26,6 +26,7 @@ Page({
         saletypeList: null,
         showMYModel: false,
         reminddays: 0,
+        selectedProducts: [],
     },
     onLoad(options) {
         const authOptions = wx.getStorageSync('auth').worderform.options;
@@ -71,6 +72,16 @@ Page({
         })
         getApp().globalData.Language.getLanguagePackage(this, '订单详情');
     },
+    alteration() {
+        if (this.data.selectedProducts.length == 0) {
+            getApp().globalData.Language.showToast('请至少选择一个产品');
+            return;
+        }
+        // 跳转到订单变更申请页面
+        wx.navigateTo({
+            url: './alteration?id=' + this.data.sa_orderid
+        });
+    },
     /* 设置回签单 */
     changeSignbackstatus(e) {
         if (this.isEdit()) return this.setData({
@@ -853,4 +864,27 @@ Page({
             })
         })
     },
+    /* 处理产品选中状态变化 */
+    onCheckboxChange(e) {
+        const {
+            item,
+            checked
+        } = e.detail;
+        let selectedProducts = [...this.data.selectedProducts];
+
+        if (checked) {
+            // 添加到选中列表
+            if (!selectedProducts.some(p => p.itemid == item.itemid)) {
+                selectedProducts.push(item);
+            }
+        } else {
+            // 从选中列表移除
+            selectedProducts = selectedProducts.filter(p => p.itemid != item.itemid);
+        }
+
+        this.setData({
+            selectedProducts
+        });
+        console.log("selectedProducts", selectedProducts)
+    },
 })

+ 8 - 1
packageA/orderForm/detail.wxml

@@ -121,10 +121,14 @@
 			<van-radio icon-size='14px' custom-class='label-class' name="扫描件">{{language['扫描件']||'扫描件'}}</van-radio>
 		</van-radio-group>
 	</view>
+	<view class="row">
+		<view class="label">{{language['订单变更申请驳回原因']||'订单变更申请驳回原因'}}</view>
+		<view class="label" style="flex:1;color:#333;">{{language[detail.reject_reason]||detail.reject_reason || '--' }}</view>
+	</view>
 </view>
 <view style="height: 20rpx;" />
 <Yl_FunTabs list='{{tabsList}}' active='{{tabsActive}}' bind:onChenge="tabsChange">
-	<Product slot='产品明细' id='Product' disabled="{{detail.status!='新建'||detail.type=='特殊订单'}}" />
+	<Product slot='产品明细' id='Product' showCheckbox disabled="{{detail.status!='新建'||detail.type=='特殊订单'}}" bind:checkboxChange="onCheckboxChange" />
 	<Yl_Attachment slot='附件' id='Yl_Attachment' ownertable="sa_order" ownerid="{{detail.sa_orderid}}" disabled="{{detail.status!='新建'}}" />
 	<Progress slot='订单进度' id='Progress' />
 	<Invoice slot='发票' id='Invoice' apiId='20221229154102' />
@@ -166,6 +170,9 @@
 			<block wx:if="{{isSubmit}}">
 				<van-button custom-class='but' wx:if="{{detail.status=='新建'}}" bind:click="submit">{{language['提交订单']||'提交订单'}}</van-button>
 			</block>
+			<block>
+				<van-button disabled="{{selectedProducts.length == 0}}" custom-class='but' wx:if="{{detail.status=='审核'}}" bind:click="alteration">{{language['订单变更申请']||'订单变更申请'}}</van-button>
+			</block>
 			<block wx:if="{{fixATime}}">
 				<van-button custom-class='but' wx:if="{{detail.status=='交期待确认'}}" bind:click="notarize">{{language['确认交期']||'确认交期'}}</van-button>
 			</block>

+ 8 - 0
packageA/orderForm/modules/product/index.js

@@ -15,6 +15,10 @@ Component({
         disabled: {
             type: Boolean
         }, //禁用
+        showCheckbox: {
+            type: Boolean,
+            value: false
+        }
     },
     data: {
         actionShow: false,
@@ -302,6 +306,10 @@ Component({
         updateThePrice() {
             let page = getCurrentPages().find(v => v.__route__ == 'packageA/orderForm/detail');
             page.getDetail();
+        },
+        /* 处理多选框变化 */
+        checkboxChange(e) {
+            this.triggerEvent("checkboxChange", e.detail);
         }
     }
 })

+ 1 - 1
packageA/orderForm/modules/product/index.wxml

@@ -11,6 +11,6 @@
     </navigator>
   </view>
 </view>
-<List list='{{list}}' disabled='{{disabled}}' bindchangeProduct='changeProduct' binddeleteItem="deleteItem" />
+<List list='{{list}}' disabled='{{disabled}}' showCheckbox='{{showCheckbox}}' bindchangeProduct='changeProduct' binddeleteItem="deleteItem" bindcheckboxChange="checkboxChange" />
 
 <van-action-sheet show="{{ actionShow }}" actions="{{ actions }}" bind:select='selectorMode' bind:cancel='cancelSelector' bind:click-overlay='cancelSelector' z-index='999999999'cancel-text="{{language['取消']||'取消'}}" />

+ 20 - 0
packageA/orderForm/modules/product/list/index.js

@@ -16,6 +16,10 @@ Component({
 		}, //修改队列
 		disabled: {
 			type: Boolean
+		},
+		showCheckbox: {
+			type: Boolean,
+			value: false
 		}
 	},
 	lifetimes: {
@@ -166,6 +170,22 @@ Component({
 		},
 		isEdit() {
 			if (this.data.disabled) getApp().globalData.Language.showToast('当前状态不可编辑!')
+		},
+		onCheckboxChange(e) {
+			const {
+				item
+			} = e.currentTarget.dataset;
+			const checked = item.checked ? false : true;
+			let i = this.data.list.findIndex(v => v.itemid == item.itemid);
+			if (i != -1) {
+				this.setData({
+					[`list[${i}].checked`]: checked
+				});
+				this.triggerEvent("checkboxChange", {
+					item: this.data.list[i],
+					checked
+				});
+			}
 		}
 	}
 })

+ 7 - 0
packageA/orderForm/modules/product/list/index.scss

@@ -14,6 +14,13 @@
       width: 100%;
       box-sizing: border-box;
 
+      .checkbox-wrapper {
+        position: absolute;
+        right: 0rpx;
+        top: 10rpx;
+        z-index: 1;
+      }
+
       .img {
         position: relative;
         flex-shrink: 0;

+ 4 - 1
packageA/orderForm/modules/product/list/index.wxml

@@ -1,6 +1,9 @@
 <view class="product-item" wx:for="{{list}}" wx:key="sa_quotedprice_itemsid">
-    <navigator class="product" url="#">
+    <navigator class="product" url="#" bind:tap="onCheckboxChange" data-item="{{item}}">
         <view class="mian">
+            <view wx:if="{{showCheckbox}}" class="checkbox-wrapper">
+                <van-checkbox value="{{item.checked}}" shape="square" />
+            </view>
             <view class="img" data-file="{{item.attinfos}}" catchtap="viewImage">
                 <van-image width="100%" height="100%" wx:if="{{item.cover}}" src="{{item.cover}}" use-loading-slot lazy-load>
                     <van-loading slot="loading" type="spinner" size="20" vertical />

+ 9 - 2
project.private.config.json

@@ -24,12 +24,19 @@
   "condition": {
     "miniprogram": {
       "list": [
+        {
+          "name": "packageA/orderForm/detail",
+          "pathName": "packageA/orderForm/detail",
+          "query": "id=76295",
+          "scene": null,
+          "launchMode": "default"
+        },
         {
           "name": "E-service/serviceImprovement/detail",
           "pathName": "E-service/serviceImprovement/detail",
           "query": "id=35",
-          "scene": null,
-          "launchMode": "default"
+          "launchMode": "default",
+          "scene": null
         },
         {
           "name": "Eservice/nodeDetail/index",