Browse Source

派件签收基本完成

sunChengjie 11 months ago
parent
commit
4743cf1576

+ 43 - 0
src/api/index.js

@@ -49,3 +49,46 @@ export function appGeLogisticsList(data, config) {
         ...config
     })
 }
+
+//快件入库-入库
+export function appSaveExpressRecord(data, config) {
+    return request({
+        url: '/tianzong/express/appSaveExpressRecord',
+        method: 'post',
+        data: data,
+        ...config
+    })
+}
+
+
+
+//快件签收-快递单号查询
+export function appFindYourShipmentList(data, config) {
+    return request({
+        url: '/tianzong/express/appFindYourShipmentList ',
+        method: 'post',
+        data: data,
+        ...config
+    })
+}
+
+//快件签收-图片上传
+export function appUploadTheSignature(data) {
+    return request({
+        url: '/tianzong/express/appUploadTheSignature',
+        method: 'post',
+        data: data,
+        // ...config
+    })
+}
+
+
+//快件签收-提件
+export function appDelivery(data, config) {
+    return request({
+        url: '/tianzong/express/appDelivery',
+        method: 'post',
+        data: data,
+        ...config
+    })
+}

+ 8 - 6
src/pages/components/HomePage.vue

@@ -273,15 +273,17 @@ export default {
 
 		async wxScanCodeA() {
 			const res = await appFindYourShipment({ expressNo: 'SF202303221917' }, { emulateJSON: true })
+			if (res.msg == 'success') {
+				this.$store.state.shipment = res
+				this.$router.push('ScannerResult')
+			} else {
+				Toast('找不到此单号')
+			}
 			console.log(res, '+++++++++==')
-			this.$store.state.shipment = res
-			this.$router.push('ScannerResult')
-		},
 
-		//打印面单
-		print() {
-			Toast('该功能正在开发中,敬请期待!');
 		},
+
+
 		//单号搜索
 		onSearch(val) {
 			this.$router.push({

+ 73 - 35
src/pages/new/combine.vue

@@ -1,36 +1,48 @@
 <template>
-    <div class="container">
-        <div style="padding: 20px 0;">找到n个属于"xxx"&部门xxx&xxx的快件:</div>
+    <div>
+        <div class="container" v-if="isCombine === true">
+            <div style="padding: 20px 0;">找到n个属于"xxx"&部门xxx&xxx的快件:</div>
 
-        <van-checkbox style="margin-bottom: 10px;" v-model="isAllChecked" >全选</van-checkbox>
+            <van-checkbox :disabled="allCheckedDisable" style="margin-bottom: 10px;" v-model="isAllChecked"
+                shape="square">全选</van-checkbox>
 
-        <van-checkbox-group v-model="checkedGoods">
-            <van-checkbox style="margin-bottom: 10px;" @change="onChange(good)" :checked="good.checked"
-                v-for="good in goods" :name="good.id" :key="good.id">
-                {{ good.name }}
-            </van-checkbox>
-        </van-checkbox-group>
+            <van-form @submit="onSubmit">
+                <van-field name="checkboxGroup">
+                    <template #input>
+                        <van-checkbox-group v-model="checkedGoods">
+                            <van-checkbox style="margin-bottom: 10px;" :disabled="checkDisabled(good)"
+                                :checked="good.checked" v-for="good in goods" :name="good.id" :key="good.id"
+                                shape="square">
+                                {{ good.dispatchBatchNo }} & {{ good.expressType }} & {{ good.expressQuantity }}件 &{{
+            good.isPayOnDelivery == '否' ? '非到付' : '到付' }}
+                            </van-checkbox>
+                        </van-checkbox-group>
+                    </template>
+                </van-field>
 
-        <van-button class="sureSign" type="info" @click="sureSign">合并签收</van-button>
-        <van-button style="height: 40px; width: 150px; border-radius: 8px;" type="default"
-            @click="back">返回上一级</van-button>
+                <van-button class="sureSign" type="info" native-type="submit">合并签收</van-button>
+                <van-button style="height: 40px; width: 150px; border-radius: 8px;" type="default"
+                    @click="back">返回上一级</van-button>
+            </van-form>
 
+        </div>
+        <SureCombine v-else :isCombine="isCombine" :goodsList="goodsList" @isCombine="sureCombine"></SureCombine>
     </div>
 </template>
 
 <script>
+import SureCombine from './sureCombine.vue'
 export default {
+    props: ['isSign', 'signList'],
+    components: {
+        SureCombine
+    },
     data() {
         return {
-            goods: [
-                // 假设的商品列表
-                { id: 1, name: '商品1', checked: false },
-                { id: 2, name: '商品2', checked: false },
-                { id: 3, name: '商品3', checked: false },
-                { id: 4, name: '商品4', checked: false },
-                // ...更多商品
-            ],
+            goods: this.signList,
+            isCombine: true,
             checkedGoods: [], // 选中的商品ID集合
+            goodsList: [],//筛选后的数据
         };
     },
     methods: {
@@ -40,30 +52,52 @@ export default {
         },
         // 返回
         back() {
-            this.$router.go(-1)
+            this.$emit('isSign', true);
+            console.log('sign')
         },
-        sureSign() {
-            this.$router.push('SureCombine')
+        // 合并签收
+        onSubmit(values) {
+            if (this.checkedGoods.length > 0) {
+                this.isCombine = false
+                console.log('submit', values);
+                // let data = this.goods.filter((good) => values.checkboxGroup.includes(good.id))
+                let data = []
+                this.goods.forEach((good) => {
+                    if (values.checkboxGroup.find((goodId) => goodId === good.id)) {
+                        data.push(good)
+                    }
+                })
+                this.goodsList = data
+                console.log('data', data);
+            } else {
+                this.$toast('请至少选择一个')
+            }
+
+
         },
-        // 选中的选项
-        onChange(good) {
-            // 更新单个商品的选中状态
-             good.checked = !good.checked;
-            // 检查是否全选
-            this.isAllChecked = this.goods.every(g => g.checked);
-            // 更新选中的商品ID集合
-            this.checkedGoods = this.goods.filter(g => g.checked).map(g => g.id);
+        // 控制页面
+        sureCombine(value) {
+            console.log(value)
+            this.isCombine = value
         },
+
+        checkDisabled(good) {
+            return good.expressStatus !== "1" && good.expressStatus !== "4"
+        }
+
     },
     computed: {
+        allCheckedDisable() {
+            return this.goods.filter((good) => !this.checkDisabled(good)).length === 0
+        },
         isAllChecked: {
             // 计算是否全选
             get() {
-                return this.goods.length === this.checkedGoods.length;
+                return this.goods.filter((good) => !this.checkDisabled(good)).length === this.checkedGoods.length && this.checkedGoods.length;
             },
             // 设置全选
             set(value) {
-                this.checkedGoods = value ? this.goods.map(good => good.id) : [];
+                this.checkedGoods = value ? this.goods.filter((good) => !this.checkDisabled(good)).map(good => good.id) : [];
             }
         }
     },
@@ -76,10 +110,14 @@ export default {
     font-size: 16px;
 }
 
+.van-cell {
+    padding: 0;
+}
+
 .container {
-    margin: 20px 10px 0 10px;
+    padding: 2px 10px 0 10px;
     background-color: #fff;
-    height: 640px;
+    height: 100%;
 
     .sureSign {
         height: 40px;

+ 4 - 1
src/pages/new/removal.vue

@@ -58,7 +58,7 @@ export default {
         },
         // 生成批次
         async onBatch() {
-            this.isRemoval = false
+
 
             let data = {
                 deliveryPeopleId: localStorage.getItem('courierId'), //派送员id
@@ -66,6 +66,9 @@ export default {
                 dispatchBatchNo: '202403261971'    //批次号
             }
             const res = await appDeliveryPersonDeliveries({ ...data }, { emulateJSON: true })
+            if (res.msg == 'success') {
+                this.isRemoval = false
+            }
             console.log(res, 'res')
         },
         onDelete(qwe) {

+ 45 - 21
src/pages/new/sign.vue

@@ -1,33 +1,56 @@
 <template>
     <div>
         <back :title="titlename"></back>
-        <div class="container">
-        <!-- <back :title="titlename"></back> -->
-        <van-search v-model="value" placeholder="请输入快件单号" />
-        <img @click="onImg" src="@/assets/user/u4.png" alt="">
-        <van-search v-model="phone" placeholder="请输入手机单号" />
-        <van-button style="width: 200px; border-radius: 6px; margin-left: 10px;" type="info" @click="check">查询</van-button>
-    </div>
+        <div class="container" v-if="isSign">
+            <van-search v-model="value" placeholder="请输入快件单号或手机单号" />
+            <img @click="onImg" src="@/assets/user/u4.png" alt="">
+
+            <van-button style="width: 200px; border-radius: 6px; margin-left: 10px;" type="info"
+                @click="check">查询</van-button>
+        </div>
+
+
+        <Combine :isSign="isSign" :signList="signList" @isSign="isCombine" v-else></Combine>
     </div>
 </template>
 
 <script>
+import { appFindYourShipmentList, appFindYourShipment } from '@/api/index'
+import Combine from './combine.vue'
+import { Toast } from 'vant'
 export default {
     name: 'Sign',
+    components: {
+        Combine
+    },
     data() {
         return {
             titlename: "派件签收",
             value: '',
-            phone:'',
+            isSign: true,
+            signList: []
         };
     },
     methods: {
         onImg() {
-            console.log('111')
+            this.value = 'SF202303221917'
         },
         // 查询
-        check() {
-            this.$router.push('Combine')
+        async check() {
+            const Shipment = await appFindYourShipment({ expressNo: 'SF202303221917' }, { emulateJSON: true })
+
+            const res = await appFindYourShipmentList({ userId: Shipment.data.user_id }, { emulateJSON: true })
+            if (res.code == '0') {
+                this.isSign = false
+                res.data[1].expressStatus = "0"
+                this.signList = res.data
+            } else {
+                Toast('快递单号不正确')
+            }
+        },
+        isCombine(value) {
+            console.log(value)
+            this.isSign = value
         }
     }
 
@@ -35,15 +58,16 @@ export default {
 </script>
 
 <style lang="less" scoped>
-    .container {
-        background-color: #fff;
-        height: 640px;
-        img {
-            position: fixed;
-            height: 20px;
-            width: 20px;
-            right: 22px;
-            top: 62px;
-        }
+.container {
+    background-color: #fff;
+    height: 640px;
+
+    img {
+        position: fixed;
+        height: 20px;
+        width: 20px;
+        right: 22px;
+        top: 62px;
     }
+}
 </style>

+ 63 - 37
src/pages/new/storage.vue

@@ -4,23 +4,24 @@
             <back :title="titlename"></back>
             <van-form @submit="onSubmit">
                 <div style="display: flex; justify-content: space-between; background-color: #fff;">
-                    <van-field style="width: 100%;" v-model="object.a" name="快递单号" label="快递单号" placeholder="快递单号"
-                        :rules="[{ required: true }]" />
+                    <van-field style="width: 100%;" v-model="object.expressNo" name="expressNo" label="快递单号"
+                        placeholder="快递单号" :rules="[{ required: true }]" />
                     <img style="width: .4rem;height: .4rem ;margin-top: 10px; margin-right: 0.3rem;"
                         @click="wxScanCodeB()" src="@/assets/user/u4.png" alt="">
 
                 </div>
 
-                <van-field readonly clickable name="快递公司" label="快递公司" :value="value" placeholder="请选择快递公司"
+                <van-field readonly clickable name="expressCompany" label="快递公司" :value="value" placeholder="请选择快递公司"
                     @click="onShowPicker" />
                 <van-popup v-model="showPicker" position="bottom">
-                    <van-picker show-toolbar :columns="columns" @confirm="onConfirm" @cancel="showPicker = false" />
+                    <van-picker show-toolbar :columns="GeLogisticsList" @confirm="onConfirm"
+                        @cancel="showPicker = false" />
                 </van-popup>
 
-                <van-field :value="onGroupObject.phones" @focus="onFocus" name="手机号码" label="收件人手机号"
+                <van-field :value="onGroupObject.phones" @focus="onFocus" name="phone" label="收件人手机号"
                     placeholder="后四位" />
 
-                <van-field :value="onGroupObject.NAME" readonly name="收件人姓名" label="收件人姓名" placeholder="占位" />
+                <van-field :value="onGroupObject.NAME" readonly name="NAME" label="收件人姓名" placeholder="占位" />
 
                 <van-field :value="onGroupObject.departmentName" name="departmentId" label="收件人部门" placeholder="占位"
                     readonly />
@@ -33,15 +34,15 @@
                 <van-field name="expressType" label="快件类型">
                     <template #input>
                         <van-radio-group v-model="object.radio" direction="horizontal">
-                            <van-radio name="1">文件</van-radio>
-                            <van-radio name="2">物品</van-radio>
+                            <van-radio name="文件">文件</van-radio>
+                            <van-radio name="物品">物品</van-radio>
                         </van-radio-group>
                     </template>
                 </van-field>
 
                 <van-field value="1" name="expressQuantity" placeholder="请输入快递数量" label="快递数量" readonly />
 
-                <van-field readonly clickable name="picker" label="货架信息" :value="value4" placeholder="请选择货架"
+                <van-field readonly clickable name="shelfInformation" label="货架信息" :value="value4" placeholder="请选择货架"
                     @click="shelf = true" />
                 <van-popup v-model="shelf" position="bottom">
                     <van-picker show-toolbar :columns="shelfs" @confirm="onShelf" @cancel="shelf = false" />
@@ -53,10 +54,10 @@
                             <van-checkbox v-model="checkbox" @change="onCheckboxChange" shape="square" /><span>到付</span>
                         </template>
                     </van-field>
-                    <van-field :disabled="isdisabled" v-model="object.e" name="到付备注" placeholder="请输入到付备注" />
+                    <van-field :disabled="isdisabled" v-model="object.payMoney" name="payMoney" placeholder="请输入到付备注" />
                 </div>
 
-                <van-field v-model="object.f" label="快递备注" name="快递备注" placeholder="请输入快递备注"
+                <van-field v-model="object.remark" label="快递备注" name="remark" placeholder="请输入快递备注"
                     :rules="[{ required: true, message: '' }]" />
 
                 <div style=" display: flex; justify-content: space-between; background-color: #fff;  padding: 10px 0;">
@@ -78,13 +79,15 @@
                 </div>
 
                 <van-cell-group @click="onGroup(item)" v-for="(item, index) in searchKeyList" :key="index" inset
-                    style="border: 1px solid #ccc; margin-bottom: 10px">
+                    style="border: 1px solid #ccc; margin-bottom: 10px ;height: 90px ; overflow: hidden;">
                     <van-cell title="手机号" :value="item.phones" />
                     <van-cell title="收件人姓名" :value="item.NAME" />
                     <van-cell title="收件人部门" :value="item.departmentName" />
                     <van-cell title="所属收发室" :value="item.mailRoomName" />
                     <van-cell title="收件人楼层" :value="item.mailFloor" />
                     <van-cell title="收件人座位" :value="item.seat_no" />
+                    <van-cell title="收发室Id" :value="item.ROOM_ID" style="display: none;" />
+                    <van-cell title="收件人userID" :value="item.USER_ID" style="display: none;" />
                 </van-cell-group>
 
                 <div style="height: 60px; width: 100%; background-color: #fff;"></div>
@@ -98,7 +101,7 @@
 </template>
 
 <script>
-import { appGetEmployeeInfoByPhone, appGeLogisticsList } from '@/api/index'
+import { appGetEmployeeInfoByPhone, appGeLogisticsList, appSaveExpressRecord } from '@/api/index'
 export default {
     data() {
         return {
@@ -108,28 +111,28 @@ export default {
             searchKey: '9270',//搜索关键
             searchKeyList: [], // 搜索后存储的数据
             onGroupObject: {},//点击后映射的参数
+            GeLogisticsList: [],//存放快递公司
             object: {
-                username: '',
-                a: '',
-                b: '',
-                c: '',
-                d: '',
-                e: '',
-                f: '',
-                set: '',
-                radio: '1',
+                remark: '',
+                radio: '文件',
+                payMoney: '',//应付金额
+                expressNo: '',//快递单号
             },
             checkbox: false,
             isdisabled: true,//是否选中多选
             value: '', //快递公司
-            columns: ['杭州', '宁波', '温州', '嘉兴', '湖州'], //快递公司
             showPicker: false, //快递公司
             value4: '', //快递公司
-            shelfs: ['杭州', '宁波', '温州', '嘉兴', '湖州'], //收发室
+            shelfs: ['货架A', '货架B', '货架C'], //收发室
             shelf: false, //收发室
         };
     },
     methods: {
+        // 快递单号
+        wxScanCodeB() {
+            this.object.expressNo = 'QW132456789'
+        },
+        // 手机号点击聚焦
         onFocus() {
             this.phoneShow = true
         },
@@ -146,8 +149,10 @@ export default {
         },
         // 选择快递公司
         async onShowPicker() {
-            const res = await appGeLogisticsList({ qwe: 123 }, { emulateJSON: true })
-            console.log(res, 'appGeLogisticsList')
+            const res = await appGeLogisticsList({ page: '', limit: '' }, { emulateJSON: true })
+            this.GeLogisticsList = res.data.map((item) => {
+                return item.expressCompany
+            })
             this.showPicker = true
         },
         // 选择快递公司
@@ -155,24 +160,45 @@ export default {
             this.value = value;
             this.showPicker = false;
         },
-
-        wxScanCodeB() {
-            this.object.a = 'QW132456789'
-        },
-
-        onFloor(value) {
-            this.value3 = value;
-            this.floor = false;
-        },
+        // 货架信息
         onShelf(value) {
             this.value4 = value;
             this.shelf = false;
         },
         // 提交
-        onSubmit(values) {
+        async onSubmit(values) {
+            // console.log(this.onGroupObject, 'onGroupObject')
+            const params = {
+                isCompany: '否',
+                mailRoomId: this.onGroupObject.ROOM_ID,//收发室Id
+                // payMoney,
+                userId: this.onGroupObject.USER_ID,//收件人userID
+                // shelfInformation,
+                // expressNo,
+                // mailRoom,
+                // departmentId,
+                // sendSeat,
+                // isPayOnDelivery,
+                // expressType,
+                // expressQuantity,
+                // expressCompany,
+                // phone
+                // remark,
+            }
+            const originalObj = {
+                isPayOnDelivery: values.isPayOnDelivery == true ? '是' : '否',
+            };
+            const value = {
+                ...values,
+                ...originalObj
+            }
+
+            const res = await appSaveExpressRecord({ ...params, ...value }, { emulateJSON: true })
+            console.log(res, '123')
             console.log('submit', values);
-            this.$router.push('/')
+            // this.$router.push('/')
         },
+        // 到付change
         onCheckboxChange() {
             this.isdisabled = !this.isdisabled
         },

+ 73 - 20
src/pages/new/sureCombine.vue

@@ -1,37 +1,87 @@
 <template>
     <div class="container">
-        <div style="padding: 20px 0;">合并签收以下快件</div>
-        <van-checkbox-group v-model="result" ref="checkboxGroup">
-            <van-checkbox style="margin-bottom: 10px;" name="a" shape="square">复选框 a</van-checkbox>
-            <van-checkbox style="margin-bottom: 10px;" name="b" shape="square">复选框 a</van-checkbox>
-            <van-checkbox style="margin-bottom: 10px;" name="c" shape="square">复选框 a</van-checkbox>
-            <van-checkbox style="margin-bottom: 10px;" name="f" shape="square">复选框 a</van-checkbox>
-            <van-checkbox style="margin-bottom: 10px;" name="d" shape="square">复选框 a</van-checkbox>
-        </van-checkbox-group>
-        <div style="color: #169bd5; margin-bottom: 50px;">拍照或上传图片</div>
-        <van-button style="height: 40px; width: 150px; border-radius: 8px; margin-right: 20px;" type="info"
-            @click="sureSign">确定签收</van-button>
-        <van-button style="height: 40px; width: 150px; border-radius: 8px;" type="default"
-            @click="back">返回上一级</van-button>
+        <div style="padding: 20px 0;">合并签收以下快件:</div>
+        <van-form @submit="onSubmit">
+            <van-field name="checkboxGroup">
+                <template #input>
+                    <van-checkbox-group v-model="checkboxGroup">
+                        <van-checkbox disabled style="margin-bottom: 10px;" :name="item.id" shape="square"
+                            v-for="item in goodsList" :key="item.id"> {{ item.dispatchBatchNo }} & {{ item.expressType
+                            }} & {{ item.expressQuantity }}件 &{{ item.isPayOnDelivery == '否' ? '非到付' : '到付' }}
+                        </van-checkbox>
+                    </van-checkbox-group>
+                </template>
+            </van-field>
 
+            <van-field name="uploader" label="上传照片">
+                <template #input>
+                    <van-uploader v-model="uploader" :after-read="afterRead" :before-read="beforeRead" :max-count="1" />
+                </template>
+            </van-field>
+
+            <van-button style="height: 40px; width: 150px; border-radius: 8px; margin-right: 20px;" type="info"
+                native-type="submit">确定签收</van-button>
+
+            <van-button style="height: 40px; width: 150px; border-radius: 8px;" type="default"
+                @click="back">返回上一级</van-button>
+        </van-form>
     </div>
 </template>
 
 <script>
+import { appDelivery, appUploadTheSignature } from '@/api/index'
+import axios from 'axios';
 export default {
     name: 'sureCombine',
+    props: ['isCombine', 'goodsList'],
     data() {
         return {
-            result: [],
+            checkbox: false,
+            checkboxGroup: [],
+            uploader: [],//图片
         };
     },
+    mounted() {
+        // 在组件挂载后,设置默认选中的值  
+        this.checkboxGroup = this.goodsList.map(item => item.id);
+    },
     methods: {
-        sureSign() {
-            this.$router.push('/')
+        beforeRead(file) {
+            // 在这里可以添加对文件的校验逻辑
+            // 如果返回 true, 则继续读取文件
+            return true;
+        },
+        // 文件读取完成后的钩子
+        async afterRead(file) {
+            console.log(file)
+            const formData = new FormData();
+            formData.append('file', file.file); // 这里的 'file' 是后端接收文件的字段名
+            const res = await appUploadTheSignature(formData)
+            console.log(res, 'res')
+
+        },
+        async onSubmit(values) {
+            console.log(values, 'values')
+            let data = []
+            this.goodsList.forEach((item) => {
+                if (values.checkboxGroup.find((itemA) => itemA === item.id)) {
+                    data.push(item.dispatchBatchNo)
+                }
+            })
+            console.log(data, 'data')
+
+            // const params = {
+            //     signEnclosureImg: '',//签署图片
+            //     deliveryId: data,//快递单号逗号隔开
+            //     deliveryPeopleId: localStorage.getItem('courierId'),// 派件员id
+            // }
+            // const res = await appDelivery({ ...params }, { emulateJSON: true })
+            // console.log(res, 'res')
+
+            // this.$router.push('/')
         },
         back() {
-            // this.$router.push('Combine')
-            this.$router.go(-1)
+            this.$emit('isCombine', true)
         },
     }
 
@@ -45,9 +95,12 @@ export default {
     font-size: 16px;
 }
 
+.van-field__label {
+    width: 4rem;
+}
+
 .container {
-    margin: 20px 10px 0 10px;
+    padding: 2px 10px 0 10px;
     background-color: #fff;
-    height: 640px;
 }
 </style>