|
|
@@ -0,0 +1,745 @@
|
|
|
+@extends("layouts.app")
|
|
|
+@section('title','批量创建工单')
|
|
|
+@section('head')
|
|
|
+@endsection
|
|
|
+
|
|
|
+@section("content")
|
|
|
+ <div class="container" id="batch_container">
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="logistic_numbers">请输入快递单号</label>
|
|
|
+ <textarea class="form-control" name="logistic_numbers" id="logistic_numbers" cols="30" rows="2"
|
|
|
+ v-model="logisticNumbers"
|
|
|
+ ref="logistic_numbers"></textarea>
|
|
|
+ <small id="emailHelp" class="form-text text-muted">如添加多个单号,请将快递单号以“空格”、“,”等分隔符隔开</small>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="">工单类型</label>
|
|
|
+ <select name="issueType" id="issueType" class="form-control" v-model="issueType">
|
|
|
+ <option value=""></option>
|
|
|
+ <option v-for="item in issueTypes" :value="item.name">@{{ item.name }}</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="form-group" id="remark-div" v-if="showRemarkDiv">
|
|
|
+ <label for="">请填写问题描述</label>
|
|
|
+ <textarea class="form-control" name="remark" id="remark" cols="30" rows="2" ref="remark"
|
|
|
+ v-model="remark"></textarea>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="form-group" id="info-edit" v-if="'信息更改' === issueType">
|
|
|
+ <div class="alert alert-info" v-for="(item,index) in infoChange">
|
|
|
+ <div class="form-row">
|
|
|
+ <div class="col-sm-3">
|
|
|
+ <label>订单</label>
|
|
|
+ <p v-text="item.code"></p>
|
|
|
+ </div>
|
|
|
+ <div class="col-sm-9 ">
|
|
|
+ <label class="text-dark font-weight-bolder"><span class="text-danger">*</span>请填写新的收方信息</label>
|
|
|
+ <textarea class="form-control form-control-sm col-12" name="" id="" cols="30" rows="2"
|
|
|
+ v-model="item.remark"></textarea>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <div class="form-group" id="info-edit" v-if="'错漏发' === issueType">
|
|
|
+ <p for="" class="">商品信息:<span class="text-primary float-right">注意需要勾选商品列才能正确提交!</span></p>
|
|
|
+ <div class="alert alert-info" v-for="(mistake,index) in mistakes">
|
|
|
+ <div class="form-row">
|
|
|
+ <label class="text-dark font-weight-bolder" v-text="'订单号:'+index"></label>
|
|
|
+ <table class="table table-bordered table-hover bg-white">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th scope="col">勾选</th>
|
|
|
+ <th scope="col">快递单号</th>
|
|
|
+ <th scope="col">商品条码</th>
|
|
|
+ <th scope="col">商品名称</th>
|
|
|
+ <th scope="col">订单数量</th>
|
|
|
+ <th scope="col">异常类型</th>
|
|
|
+ <th scope="col">客户实收数</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr v-for="(item,index) in mistake">
|
|
|
+ <td>
|
|
|
+ <div class="form-group form-check">
|
|
|
+ <input type="checkbox" class="form-check-input" v-model="item.select">
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ <td v-text="item.logistic_number"></td>
|
|
|
+ <td v-text="item.sku"></td>
|
|
|
+ <td v-text="item.sku_name"></td>
|
|
|
+ <td v-text="item.amount"></td>
|
|
|
+ <td v-text="item.abnormal_type"></td>
|
|
|
+ <td>
|
|
|
+ <input type="number" class="form-control form-control-sm"
|
|
|
+ v-model="item.abnormal_amount"
|
|
|
+ @input="mistakeAbnormalType(item)">
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+
|
|
|
+ </table>
|
|
|
+ <table>
|
|
|
+ <tbody>
|
|
|
+ <tr class="add-mistake">
|
|
|
+ <td><input type="text" placeholder="快递单号" class="logistic_number form-control"
|
|
|
+ :ref="'logistic_number'+index"></td>
|
|
|
+ <td><input type="text" placeholder="商品条码" class="sku form-control"
|
|
|
+ :ref="'sku'+index"></td>
|
|
|
+ <td><input type="text" placeholder="实收数量" class="abnormal_amount form-control"
|
|
|
+ :ref="'abnormal_amount'+index"></td>
|
|
|
+ <td>
|
|
|
+ <button class="btn btn-sm btn-outline-success" @click="addMistakeItem(mistake,index)">
|
|
|
+ 添加
|
|
|
+ </button>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group" id="express-abnormal-edit" v-if="'快递异常' === issueType"
|
|
|
+ v-for="(item,index) in expressAbnormalData">
|
|
|
+ <p class="text-dark">异常信息</p>
|
|
|
+ <div class="alert alert-info">
|
|
|
+ <p class="text-dark font-weight-bolder" v-text="'订单号:'+item.order_no"></p>
|
|
|
+ <div class="form-row">
|
|
|
+ <div class="col-sm-3">
|
|
|
+ <label class="text-dark">快递单号</label>
|
|
|
+ <div class="form-group form-check" v-for="package in item.packages">
|
|
|
+ <input type="checkbox" class="form-check-input"
|
|
|
+ :id=" item.code+':'+ package.logistic_number" v-model="package.select">
|
|
|
+ <label class="text-dark " v-text="package.logistic_number"
|
|
|
+ :for="item.code+':'+ package.logistic_number"></label>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="col-sm-3 ">
|
|
|
+ <label class="text-dark "><span class="text-danger">*</span>请选择异常类型</label>
|
|
|
+ <select name="" id="" class="form-control" v-model="item.abnormal_type">
|
|
|
+ <option v-for="type in expressAbnormalType" v-text="type" :value="type"></option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="col-sm-6 ">
|
|
|
+ <label class="text-dark"><span class="text-danger">*</span>交易截图</label>
|
|
|
+ <div class="h-auto border border-secondary bg-white rounded" id="package-image"
|
|
|
+ style="min-height: 75px"
|
|
|
+ contenteditable="true"
|
|
|
+ @paste="pasteImage($event,item.dealImages)">
|
|
|
+ <div v-for="(image,i) in item.dealImages"
|
|
|
+ class="d-inline-block col-4 position-relative card">
|
|
|
+ <div class="card-body">
|
|
|
+ <img :src="image.src" class="card-img-top" :alt="image.file.name">
|
|
|
+ <div class="float-right position-relative">
|
|
|
+ <button type="button" class="btn btn-sm btn-outline-danger"
|
|
|
+ @click="spliceImage(i,item.dealImages)">取消
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <div class="form-group" id="damage-edit" v-if="'破损' === issueType">
|
|
|
+ <p class="text-dark">破损信息</p>
|
|
|
+ <div class="alert alert-info" v-for="(item,index) in damages">
|
|
|
+ <div class="form-row">
|
|
|
+ <label>订单:</label>
|
|
|
+ <p class="text-dark" v-text="item.order_no"></p>
|
|
|
+ </div>
|
|
|
+ <div class="damage-table">
|
|
|
+ <table class="table table-bordered bg-white">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>快递单号</th>
|
|
|
+ <th>商品条码</th>
|
|
|
+ <th>异常类型</th>
|
|
|
+ <th>商品名称</th>
|
|
|
+ <th>订单数量</th>
|
|
|
+ <th>异常数量</th>
|
|
|
+ <th>破损单价</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr v-for="(commodity,i) in item.commodities">
|
|
|
+ <td v-text="commodity.logistic_number"></td>
|
|
|
+ <td v-text="commodity.sku"></td>
|
|
|
+ <td v-text="commodity.sku_name"></td>
|
|
|
+ <td v-text="commodity.amount"></td>
|
|
|
+ <td v-text="commodity.abnormal_amount"></td>
|
|
|
+ <td v-text="commodity.price"></td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ <div class="form-row">
|
|
|
+ <div class="col-sm-2">
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <div class="col-sm-3 ">
|
|
|
+ <label class="text-dark"><span class="text-danger">*</span>外包装图片</label>
|
|
|
+ <div class="h-auto border border-secondary bg-white rounded" id="package-image"
|
|
|
+ style="min-height: 75px"
|
|
|
+ contenteditable="true"
|
|
|
+ @paste="pasteImage($event,item.dealImages)">
|
|
|
+ <div v-for="(image,i) in item.dealImages"
|
|
|
+ class="d-inline-block col-4 position-relative card">
|
|
|
+ <div class="card-body">
|
|
|
+ <img :src="image.src" class="card-img-top" :alt="image.file.name">
|
|
|
+ <div class="float-right position-relative">
|
|
|
+ <button type="button" class="btn btn-sm btn-outline-danger"
|
|
|
+ @click="spliceImage(i,item.dealImages)">取消
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="col-sm-3 ">
|
|
|
+ <label class="text-dark"><span class="text-danger">*</span>内物破损图</label>
|
|
|
+ <div class="h-auto border border-secondary bg-white rounded" id="package-image"
|
|
|
+ style="min-height: 75px"
|
|
|
+ contenteditable="true"
|
|
|
+ @paste="pasteImage($event,item.dealImages)">
|
|
|
+ <div v-for="(image,i) in item.dealImages"
|
|
|
+ class="d-inline-block col-4 position-relative card">
|
|
|
+ <div class="card-body">
|
|
|
+ <img :src="image.src" class="card-img-top" :alt="image.file.name">
|
|
|
+ <div class="float-right position-relative">
|
|
|
+ <button type="button" class="btn btn-sm btn-outline-danger"
|
|
|
+ @click="spliceImage(i,item.dealImages)">取消
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="col-sm-3 ">
|
|
|
+ <label class="text-dark"><span class="text-danger">*</span>交易截图</label>
|
|
|
+ <div class="h-auto border border-secondary bg-white rounded" id="package-image"
|
|
|
+ style="min-height: 75px"
|
|
|
+ contenteditable="true"
|
|
|
+ @paste="pasteImage($event,item.dealImages)">
|
|
|
+ <div v-for="(image,i) in item.dealImages"
|
|
|
+ class="d-inline-block col-4 position-relative card">
|
|
|
+ <div class="card-body">
|
|
|
+ <img :src="image.src" class="card-img-top" :alt="image.file.name">
|
|
|
+ <div class="float-right position-relative">
|
|
|
+ <button type="button" class="btn btn-sm btn-outline-danger"
|
|
|
+ @click="spliceImage(i,item.dealImages)">取消
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="form-group" id="submit-div">
|
|
|
+ <button class="btn btn-primary" @click="submit">提交</button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+@endsection
|
|
|
+
|
|
|
+@section("lastScript")
|
|
|
+ <script>
|
|
|
+ new Vue({
|
|
|
+ el: "#batch_container",
|
|
|
+ data: {
|
|
|
+ issueTypes: {!! $types !!},
|
|
|
+ issueType: null,
|
|
|
+ logisticNumbers: null,
|
|
|
+ remark: null,
|
|
|
+ expressAbnormalType: ['在途异常', '签收未收到'],
|
|
|
+ infoChange: [],
|
|
|
+ mistakes: [],
|
|
|
+ expressAbnormalData: [],
|
|
|
+ damages:[],
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ showRemarkDiv() {
|
|
|
+ return '信息更改' !== this.issueType;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ issueType: function (val) {
|
|
|
+ if (val === "信息更改") {
|
|
|
+ this.getInfoChangeData();
|
|
|
+ } else if (val === "错漏发") {
|
|
|
+ this.getMistakeData();
|
|
|
+ } else if (val === "快递异常") {
|
|
|
+ this.getExpressAbnormalData();
|
|
|
+ } else if(val === "破损"){
|
|
|
+ this.getDamages();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ submit() {
|
|
|
+ if (!this.checkSubmitData()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.submitData();
|
|
|
+ },
|
|
|
+ checkSubmitData() {
|
|
|
+ let {issueType} = this;
|
|
|
+ if (issueType === "拦截" || issueType === "取消拦截" || issueType === "快递丢件") {
|
|
|
+ if (!this.checkRemark()) {
|
|
|
+ this.errorTempTip("问题描述为必填项")
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else if (issueType === "信息更改") {
|
|
|
+ if (!this.checkInfoChange()) {
|
|
|
+ this.errorTempTip("信息更改项不能为空,且列不能为空")
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else if (issueType === "错漏发") {
|
|
|
+ if (!this.checkMistakes()) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else if (issueType === "快递异常") {
|
|
|
+ if (!this.checkExpressAbnormal()) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ submitData() {
|
|
|
+ let {issueType} = this;
|
|
|
+ if (issueType === "拦截") {
|
|
|
+ this.intercept()
|
|
|
+ } else if (issueType === "取消拦截") {
|
|
|
+ this.cancelIntercept();
|
|
|
+ } else if (issueType === "快递丢件") {
|
|
|
+ this.loss();
|
|
|
+ } else if (issueType === "信息更改") {
|
|
|
+ this.informationChange();
|
|
|
+ } else if (issueType === "错漏发") {
|
|
|
+ this.mistake()
|
|
|
+ } else if (issueType === "快递异常") {
|
|
|
+ this.expressAbnormal()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ loss() {
|
|
|
+ let {remark, logisticNumbers} = this;
|
|
|
+ let data = {
|
|
|
+ logistic_numbers: logisticNumbers,
|
|
|
+ remark: remark
|
|
|
+ };
|
|
|
+ this.waitingTempTip("处理中");
|
|
|
+ let url = '{{ route("workOrder.loss.createBatchApi") }}';
|
|
|
+ axios.post(url, data).then(res => {
|
|
|
+ this.cancelWaitingTempTip();
|
|
|
+ if (res.data.success === true) {
|
|
|
+ this.successTempTip("添加成功");
|
|
|
+ this.cancelSubData();
|
|
|
+ } else {
|
|
|
+ this.errorTempTip(res.data.message ? res.data.message : "创建出现异常");
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.cancelWaitingTempTip();
|
|
|
+ this.errorTempTip(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ intercept() {
|
|
|
+ let {remark, logisticNumbers} = this;
|
|
|
+ let data = {
|
|
|
+ logistic_numbers: logisticNumbers,
|
|
|
+ remark: remark
|
|
|
+ };
|
|
|
+ this.waitingTempTip("处理中");
|
|
|
+ let url = '{{ route("workOrder.intercept.createBatchApi") }}';
|
|
|
+ axios.post(url, data).then(res => {
|
|
|
+ this.cancelWaitingTempTip();
|
|
|
+ if (res.data.success === true) {
|
|
|
+ this.successTempTip("添加成功");
|
|
|
+ this.cancelSubData();
|
|
|
+ } else {
|
|
|
+ this.errorTempTip(res.data.message ? res.data.message : "创建出现异常");
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.cancelWaitingTempTip();
|
|
|
+ this.errorTempTip(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ cancelIntercept() {
|
|
|
+ let url = '{{ route("workOrder.cancelIntercept.createBatchApi") }}';
|
|
|
+ let {remark, logisticNumbers} = this;
|
|
|
+ let data = {
|
|
|
+ logistic_numbers: logisticNumbers,
|
|
|
+ remark: remark
|
|
|
+ };
|
|
|
+ this.waitingTempTip("处理中");
|
|
|
+ axios.post(url, data).then(res => {
|
|
|
+ this.cancelWaitingTempTip();
|
|
|
+ if (res.data.success === true) {
|
|
|
+ this.successTempTip("添加成功");
|
|
|
+ this.cancelSubData();
|
|
|
+ } else {
|
|
|
+ this.errorTempTip(res.data.message ? res.data.message : "创建出现异常");
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.cancelWaitingTempTip();
|
|
|
+ this.errorTempTip(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ informationChange() {
|
|
|
+ let url = '{{route('workOrder.informationChange.createBatchApi')}}';
|
|
|
+ let {logisticNumbers, infoChange, remark} = this;
|
|
|
+ let data = {
|
|
|
+ logistic_numbers: logisticNumbers,
|
|
|
+ remark: remark,
|
|
|
+ data: infoChange,
|
|
|
+ };
|
|
|
+ axios.post(url, data).then(res => {
|
|
|
+ this.cancelWaitingTempTip();
|
|
|
+ if (res.data.success === true) {
|
|
|
+ this.successTempTip("添加成功");
|
|
|
+ this.cancelSubData();
|
|
|
+ } else {
|
|
|
+ this.errorTempTip(res.data.message ? res.data.message : "创建出现异常");
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.cancelWaitingTempTip();
|
|
|
+ this.errorTempTip(err);
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+ mistake() {
|
|
|
+ let url = '{{route('workOrder.mistake.createBatchApi')}}';
|
|
|
+ let {logisticNumbers, mistakes, remark} = this;
|
|
|
+ let mistakesCommodities = [];
|
|
|
+ for (let key in mistakes) {
|
|
|
+ let commodities = mistakes[`${key}`] ? mistakes[`${key}`] : [];
|
|
|
+ commodities = commodities.map(item => JSON.stringify(item));
|
|
|
+ mistakesCommodities.push({
|
|
|
+ order_no: key,
|
|
|
+ commodities: commodities,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ let data = {
|
|
|
+ logistic_numbers: logisticNumbers,
|
|
|
+ remark: remark,
|
|
|
+ data: mistakesCommodities,
|
|
|
+ };
|
|
|
+ this.waitingTempTip("提交中");
|
|
|
+ axios.post(url, data).then(res => {
|
|
|
+ this.cancelWaitingTempTip();
|
|
|
+ if (res.data.success === true) {
|
|
|
+ this.successTempTip("添加成功");
|
|
|
+ this.cancelSubData();
|
|
|
+ } else {
|
|
|
+ this.errorTempTip(res.data.message ? res.data.message : "创建出现异常");
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.cancelWaitingTempTip();
|
|
|
+ this.errorTempTip(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ expressAbnormal() {
|
|
|
+ let {expressAbnormalData, remark} = this;
|
|
|
+ let message = '';
|
|
|
+ this.waitingTempTip("处理中");
|
|
|
+ for (let i = 0; i < expressAbnormalData.length; i++) {
|
|
|
+ let expressAbnormal = expressAbnormalData[i];
|
|
|
+ let data = new FormData();
|
|
|
+ let packages = expressAbnormal.packages ? expressAbnormal.packages : [];
|
|
|
+ data.append('order_no', expressAbnormal.order_no);
|
|
|
+ data.append('remark', remark);
|
|
|
+ data.append('type', expressAbnormal.abnormal_type);
|
|
|
+ data.append('process_progress', expressAbnormal.abnormal_type);
|
|
|
+ packages = packages.filter(item => item.select);
|
|
|
+ packages.forEach(e=>{
|
|
|
+ data.append('commodities[]',JSON.stringify({logistic_number:e.logistic_number}));
|
|
|
+ })
|
|
|
+ let dealImages = this.getImages(expressAbnormal.dealImages);
|
|
|
+ this.setFormDataImagePrefix(data, 'dealImages', dealImages);
|
|
|
+ this.syncExpressAbnormal(data).then(res=>{
|
|
|
+ if(i === (expressAbnormalData.length -1)){
|
|
|
+ this.cancelWaitingTempTip();
|
|
|
+ this.cancelSubData();
|
|
|
+ }
|
|
|
+ this.successTempTip(`${expressAbnormal.order_no}创建完成`);
|
|
|
+ }).catch(err => {
|
|
|
+ message += err + '\\n';
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ syncExpressAbnormal(data) {
|
|
|
+ let url = "{{route('workOrder.expressAbnormal.storeApi')}}";
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ axios.post(url, data).then(res => {
|
|
|
+ if (res.data.success) {
|
|
|
+ resolve(true)
|
|
|
+ } else {
|
|
|
+ reject(res.data.message ? res.data.message : '创建工单异常');
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ reject(err);
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getInfoChangeData() {
|
|
|
+ let url = '{{route('workOrder.informationChange.checkLogisticNumberApi')}}';
|
|
|
+ let data = {
|
|
|
+ 'logistic_numbers': this.logisticNumbers,
|
|
|
+ };
|
|
|
+ axios.post(url, data).then(res => {
|
|
|
+ if (res.data.success) {
|
|
|
+ this.infoChange = res.data.data.map(item => {
|
|
|
+ item.remark = '';
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.errorTempTip(res.data.message ? res.data.message : "获取订单号异常");
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.errorTempTip(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getMistakeData() {
|
|
|
+ let url = '{{route('workOrder.mistake.checkLogisticNumberApi')}}';
|
|
|
+ let data = {
|
|
|
+ 'logistic_numbers': this.logisticNumbers
|
|
|
+ };
|
|
|
+ axios.post(url, data).then(res => {
|
|
|
+ if (res.data.success) {
|
|
|
+ res.data.data.forEach((item) => {
|
|
|
+ item.abnormal_amount = item.amount;
|
|
|
+ item.abnormal_type = '未错漏发';
|
|
|
+ item.select = false;
|
|
|
+ });
|
|
|
+ let mistakes = {};
|
|
|
+ for (let i = 0; i < res.data.data.length; i++) {
|
|
|
+ let data = res.data.data[i];
|
|
|
+ let order_code = data['order_code'];
|
|
|
+ if (mistakes[order_code] == null) {
|
|
|
+ mistakes[order_code] = []
|
|
|
+ }
|
|
|
+ mistakes[order_code].push(data);
|
|
|
+ }
|
|
|
+ this.mistakes = mistakes;
|
|
|
+ } else {
|
|
|
+ this.errorTempTip(res.data.message ? res.data.message : "获取订单号异常");
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.errorTempTip(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getExpressAbnormalData() {
|
|
|
+ let url = '{{route('workOrder.expressAbnormal.checkLogisticNumberApi')}}';
|
|
|
+ let data = {
|
|
|
+ 'logistic_numbers': this.logisticNumbers
|
|
|
+ };
|
|
|
+ axios.post(url, data).then(res => {
|
|
|
+ if (res.data.success) {
|
|
|
+ this.expressAbnormalData = res.data.data.map(item => {
|
|
|
+ item.abnormal_type = null;
|
|
|
+ item.dealImages = [];
|
|
|
+ item.packages.forEach(item => item.select = false);
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.errorTempTip(res.data.message ? res.data.message : "获取订单号异常");
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.errorTempTip(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getDamages(){
|
|
|
+ let url = '{{route('workOrder.damage.checkLogisticNumberApi')}}';
|
|
|
+ let data = {
|
|
|
+ 'logistic_numbers': this.logisticNumbers
|
|
|
+ };
|
|
|
+ axios.post(url,data).then(res=>{
|
|
|
+ if(res.data.data){
|
|
|
+ this.damages = res.data.data;
|
|
|
+ } else {
|
|
|
+ this.errorTempTip(res.data.message ? res.data.message : "获取订单号异常");
|
|
|
+ }
|
|
|
+ }).catch(err=>{
|
|
|
+ this.errorTempTip(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ waitingTempTip(message) {
|
|
|
+ window.tempTip.setIndex(2005);
|
|
|
+ window.tempTip.setDuration(9999);
|
|
|
+ window.tempTip.waitingTip(message);
|
|
|
+ },
|
|
|
+ cancelWaitingTempTip() {
|
|
|
+ window.tempTip.cancelWaitingTip();
|
|
|
+ },
|
|
|
+ successTempTip(message) {
|
|
|
+ window.tempTip.setDuration(1500);
|
|
|
+ window.tempTip.setIndex(2005);
|
|
|
+ window.tempTip.showSuccess(message);
|
|
|
+ },
|
|
|
+ errorTempTip(message) {
|
|
|
+ window.tempTip.setDuration(2000);
|
|
|
+ window.tempTip.setIndex(2005);
|
|
|
+ window.tempTip.show(message);
|
|
|
+ },
|
|
|
+ mistakeAbnormalType(item) {
|
|
|
+ let {abnormal_amount, amount} = item;
|
|
|
+ if (abnormal_amount === amount) {
|
|
|
+ item.abnormal_type = "未错漏发";
|
|
|
+ } else if (abnormal_amount > amount) {
|
|
|
+ item.abnormal_type = "多发";
|
|
|
+ } else if (abnormal_amount < amount) {
|
|
|
+ item.abnormal_type = "少发"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ addMistakeItem(mistake, i) {
|
|
|
+ let logisticNumber = $(this.$refs["logistic_number" + i][0]).val();
|
|
|
+ let sku = $(this.$refs["sku" + i][0]).val();
|
|
|
+ let abnormalAmount = $(this.$refs["abnormal_amount" + i][0]).val();
|
|
|
+ let ownerId = mistake[0]['owner_id'] ?? '';
|
|
|
+ if (ownerId === '' || ownerId == null) {
|
|
|
+ this.errorTempTip("添加商品时,校验失败货主异常");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.asyncAddMistakeItem(mistake, i, ownerId, sku, abnormalAmount, logisticNumber);
|
|
|
+ },
|
|
|
+ cancelMistakeItem(i) {
|
|
|
+ $(this.$refs["logistic_number" + i][0]).val("");
|
|
|
+ $(this.$refs["sku" + i][0]).val("");
|
|
|
+ $(this.$refs["abnormal_amount" + i][0]).val("");
|
|
|
+ },
|
|
|
+ asyncAddMistakeItem(mistake, i, ownerId, sku, abnormalAmount, logisticNumber) {
|
|
|
+ let url = "{{route('commodity.getCommodityApi')}}";
|
|
|
+ let data = {
|
|
|
+ owner_id: ownerId,
|
|
|
+ sku: sku
|
|
|
+ }
|
|
|
+ this.waitingTempTip("查询中");
|
|
|
+ axios.post(url, data).then(res => {
|
|
|
+ this.cancelWaitingTempTip();
|
|
|
+ if (res.data.success) {
|
|
|
+ let item = JSON.parse(JSON.stringify(mistake[0]));
|
|
|
+ item.abnormal_amount = abnormalAmount;
|
|
|
+ item.abnormal_type = "多发";
|
|
|
+ item.logistic_number = logisticNumber;
|
|
|
+ item.amount = 0;
|
|
|
+ item.sku_name = res.data.data.name;
|
|
|
+ item.commodity_id = res.data.data.id;
|
|
|
+ mistake.push(item);
|
|
|
+ this.cancelMistakeItem(i);
|
|
|
+ } else {
|
|
|
+ this.errorTempTip(res.data.message ? res.data.message : '查询商品失败')
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.cancelWaitingTempTip();
|
|
|
+ this.errorTempTip(err);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ checkRemark() {
|
|
|
+ let {remark} = this;
|
|
|
+ if (remark == null || remark === "") return false;
|
|
|
+ return remark.trim().length !== 0;
|
|
|
+ },
|
|
|
+ cancelSubData() {
|
|
|
+ this.logisticNumbers = null;
|
|
|
+ this.issueType = null;
|
|
|
+ this.remark = null;
|
|
|
+ this.infoChange = [];
|
|
|
+ this.mistakes = [];
|
|
|
+ this.expressAbnormalData = [];
|
|
|
+ },
|
|
|
+ checkInfoChange() {
|
|
|
+ let {infoChange} = this;
|
|
|
+ if (infoChange.length === 0) return false;
|
|
|
+ return infoChange.filter(item => item.remark == null || item.remark === "" || item.remark.trim().length === 0).length !== 0;
|
|
|
+ },
|
|
|
+ checkMistakes() {
|
|
|
+ let {mistakes} = this;
|
|
|
+ if (mistakes.length === 0) {
|
|
|
+ this.errorTempTip("请校验提交的商品信息是否为勾选")
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for (let orderCode in mistakes) {
|
|
|
+ let mistake = mistakes[`${orderCode}`];
|
|
|
+ if (!mistake) {
|
|
|
+ this.errorTempTip('订单:${orderCode}未有订单商品信息');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ let count = mistake.filter(item => item.select === true).length;
|
|
|
+ if (count === 0) {
|
|
|
+ this.errorTempTip(`订单:${orderCode}未勾选商品列`);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ checkExpressAbnormal() {
|
|
|
+ let {expressAbnormalData} = this;
|
|
|
+ if (expressAbnormalData.length === 0) {
|
|
|
+ this.errorTempTip("提交参数异常!");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for (let i = 0; i < expressAbnormalData.length; i++) {
|
|
|
+ let data = expressAbnormalData[i];
|
|
|
+ let selectCount = data.packages.filter(item => item.select).length;
|
|
|
+ if (selectCount === 0) {
|
|
|
+ this.errorTempTip(`未选中快递单号 订单:${data.code}!`);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ pasteImage(event, imageArray) {
|
|
|
+ for (let i = 0; i < event.clipboardData.items.length; i++) {
|
|
|
+ let item = event.clipboardData.items[i];
|
|
|
+ if (item.kind === 'string') continue;
|
|
|
+ if (item.type.indexOf('image') === -1) continue;
|
|
|
+ if (item.kind === 'file') {
|
|
|
+ let blob = item.getAsFile();
|
|
|
+ let src = null;
|
|
|
+ this.blobToBase64(blob).then(res => {
|
|
|
+ src = res;
|
|
|
+ imageArray.push({src: src, file: blob});
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ event.preventDefault();
|
|
|
+ },
|
|
|
+ spliceImage(i, images) {
|
|
|
+ if (!confirm('是否取消选择该图片')) return;
|
|
|
+ images.splice(i, 1);
|
|
|
+ },
|
|
|
+ blobToBase64(blob) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ const fileReader = new FileReader();
|
|
|
+ fileReader.onload = (e) => {
|
|
|
+ resolve(e.target.result);
|
|
|
+ };
|
|
|
+ fileReader.readAsDataURL(blob);
|
|
|
+ fileReader.onerror = () => {
|
|
|
+ reject(new Error('blobToBase64 error'));
|
|
|
+ };
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getImages(images) {
|
|
|
+ return images.map((item) => {
|
|
|
+ return item.file;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ setFormDataImagePrefix(formData, prefix, images) {
|
|
|
+ images.forEach((item) => {
|
|
|
+ formData.append(`${prefix}[]`, item);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ }
|
|
|
+ })
|
|
|
+ </script>
|
|
|
+@endsection
|