瀏覽代碼

修改订单-部分发货,改成组件

YY 2 年之前
父節點
當前提交
1d7069a99c

+ 24 - 24
src/router/module/platmanag.js

@@ -29,30 +29,30 @@ export default [
     meta: { title: '平台管理-平台订单管理' },
     component: () => import('@/views/platmanag/order/index.vue'),
   },
-  {
-    path: '/platmanag/order/detail_order',
-    name: 'platmanag_order_detail_order',
-    meta: { title: '平台管理-订单管理-详细信息' },
-    component: () => import('@/views/platmanag/order/detail_order.vue'),
-  },
-  {
-    path: '/platmanag/order/detail_orderDetail',
-    name: 'platmanag_order_detail_orderDetail',
-    meta: { title: '平台管理-订单管理-详细信息' },
-    component: () => import('@/views/platmanag/order/detail_orderDetail.vue'),
-  },
-  {
-    path: '/platmanag/order/detail_sales_order',
-    name: 'platmanag_order_detail_sale_orders',
-    meta: { title: '自营店铺-订单管理-售后' },
-    component: () => import('@/views/platmanag/order/detail_sales_order.vue'),
-  },
-  {
-    path: '/platmanag/order/detail_sales_orderDetail',
-    name: 'platmanag_order_detail_sale_orderDetail',
-    meta: { title: '自营店铺-订单管理-售后' },
-    component: () => import('@/views/platmanag/order/detail_sales_orderDetail.vue'),
-  },
+  // {
+  //   path: '/platmanag/order/detail_order',
+  //   name: 'platmanag_order_detail_order',
+  //   meta: { title: '平台管理-订单管理-详细信息' },
+  //   component: () => import('@/views/platmanag/order/detail_order.vue'),
+  // },
+  // {
+  //   path: '/platmanag/order/detail_orderDetail',
+  //   name: 'platmanag_order_detail_orderDetail',
+  //   meta: { title: '平台管理-订单管理-详细信息' },
+  //   component: () => import('@/views/platmanag/order/detail_orderDetail.vue'),
+  // },
+  // {
+  //   path: '/platmanag/order/detail_sales_order',
+  //   name: 'platmanag_order_detail_sale_orders',
+  //   meta: { title: '自营店铺-订单管理-售后' },
+  //   component: () => import('@/views/platmanag/order/detail_sales_order.vue'),
+  // },
+  // {
+  //   path: '/platmanag/order/detail_sales_orderDetail',
+  //   name: 'platmanag_order_detail_sale_orderDetail',
+  //   meta: { title: '自营店铺-订单管理-售后' },
+  //   component: () => import('@/views/platmanag/order/detail_sales_orderDetail.vue'),
+  // },
   {
     path: '/platmanag/goodsRate',
     name: 'platmanag_goodsRate',

+ 24 - 24
src/router/module/selfShop.js

@@ -23,30 +23,30 @@ export default [
     meta: { title: '自营店铺-订单管理' },
     component: () => import('@/views/selfShop/order/index.vue'),
   },
-  {
-    path: '/selfShop/order/detail_order',
-    name: 'selfShop_order_detail_order',
-    meta: { title: '自营店铺-订单管理-详细信息' },
-    component: () => import('@/views/selfShop/order/detail_order.vue'),
-  },
-  {
-    path: '/selfShop/order/detail_orderDetail',
-    name: 'selfShop_order_detail_orderDetail',
-    meta: { title: '自营店铺-订单管理-详细信息' },
-    component: () => import('@/views/selfShop/order/detail_orderDetail.vue'),
-  },
-  {
-    path: '/selfShop/order/detail_sales_order',
-    name: 'selfShop_order_detail_sale_orders',
-    meta: { title: '自营店铺-订单管理-售后' },
-    component: () => import('@/views/selfShop/order/detail_sales_order.vue'),
-  },
-  {
-    path: '/selfShop/order/detail_sales_orderDetail',
-    name: 'selfShop_order_detail_sale_orderDetail',
-    meta: { title: '自营店铺-订单管理-售后' },
-    component: () => import('@/views/selfShop/order/detail_sales_orderDetail.vue'),
-  },
+  // {
+  //   path: '/selfShop/order/detail_order',
+  //   name: 'selfShop_order_detail_order',
+  //   meta: { title: '自营店铺-订单管理-详细信息' },
+  //   component: () => import('@/views/selfShop/order/detail_order.vue'),
+  // },
+  // {
+  //   path: '/selfShop/order/detail_orderDetail',
+  //   name: 'selfShop_order_detail_orderDetail',
+  //   meta: { title: '自营店铺-订单管理-详细信息' },
+  //   component: () => import('@/views/selfShop/order/detail_orderDetail.vue'),
+  // },
+  // {
+  //   path: '/selfShop/order/detail_sales_order',
+  //   name: 'selfShop_order_detail_sale_orders',
+  //   meta: { title: '自营店铺-订单管理-售后' },
+  //   component: () => import('@/views/selfShop/order/detail_sales_order.vue'),
+  // },
+  // {
+  //   path: '/selfShop/order/detail_sales_orderDetail',
+  //   name: 'selfShop_order_detail_sale_orderDetail',
+  //   meta: { title: '自营店铺-订单管理-售后' },
+  //   component: () => import('@/views/selfShop/order/detail_sales_orderDetail.vue'),
+  // },
   {
     path: '/selfShop/sales',
     name: 'selfShop_sales',

+ 8 - 4
src/views/platmanag/order/index.vue

@@ -12,6 +12,9 @@
               <el-tab-pane label="待发货" name="2">
                 <card-2 :statusList="statusList" @toDetails="toDetails" @toSaless="toSaless"></card-2>
               </el-tab-pane>
+              <el-tab-pane label="部分发货" name="5">
+                <card-5 :statusList="statusList" @toDetails="toDetails" @toSaless="toSaless"></card-5>
+              </el-tab-pane>
               <el-tab-pane label="待收货" name="3">
                 <card-3 :statusList="statusList" @toDetails="toDetails" @toSaless="toSaless"></card-3>
               </el-tab-pane>
@@ -43,10 +46,11 @@ export default {
     card2: () => import('./parts/card-2.vue'),
     card3: () => import('./parts/card-3.vue'),
     card4: () => import('./parts/card-4.vue'),
-    detail_order: () => import('./detail_order.vue'),
-    detail_orderDetail: () => import('./detail_orderDetail.vue'),
-    detail_sales_order: () => import('./detail_sales_order.vue'),
-    detail_sales_orderDetail: () => import('./detail_sales_orderDetail.vue'),
+    card5: () => import('./parts/card-5.vue'),
+    detail_order: () => import('./parts/detail/detail_order.vue'),
+    detail_orderDetail: () => import('./parts/detail/detail_orderDetail.vue'),
+    detail_sales_order: () => import('./parts/detail/detail_sales_order.vue'),
+    detail_sales_orderDetail: () => import('./parts/detail/detail_sales_orderDetail.vue'),
   },
   data: function () {
     const that = this;

+ 118 - 0
src/views/platmanag/order/parts/card-5.vue

@@ -0,0 +1,118 @@
+<template>
+  <div id="card-1">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="one">
+          <search-1 :form="searchForm" @onSubmit="search" @toReset="toClose"></search-1>
+        </el-col>
+        <data-table
+          :select="true"
+          :selected="selected"
+          @handleSelect="handleSelect"
+          :fields="fields"
+          :opera="opera"
+          @query="search"
+          :data="list"
+          :total="total"
+          @detail="toDetail"
+          @sales="toSales"
+        >
+        </data-table>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('orderDetail');
+
+export default {
+  name: 'card-1',
+  props: { statusList: { type: Array } },
+  components: { search1: () => import('./search-1.vue') },
+  data: function () {
+    return {
+      searchForm: {},
+      list: [],
+      total: 0,
+      opera: [
+        { label: '详情', method: 'detail' },
+        { label: '售后', method: 'sales', type: 'danger' },
+      ],
+      fields: [
+        { label: '订单号', model: 'no', showTip: false },
+        { label: '下单时间', model: 'buy_time' },
+        { label: '顾客', model: 'customer.name' },
+        { label: '收货人', model: 'address', showTip: false, format: (i) => this.getAddress(i) },
+        { label: '支付金额', model: 'real_pay' },
+        { label: '商品数量', model: 'buy_num_total' },
+        { label: '是否售后', model: 'is_afterSale', format: (i) => (i === true ? '该订单有商品申请售后' : '未申请售后') },
+      ],
+      // 多选值
+      selected: [],
+      skip: 0,
+    };
+  },
+  async created() {
+    await this.search();
+  },
+  methods: {
+    ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    // 查询
+    async search({ skip = this.skip, limit = this.$limit, ...info } = {}) {
+      let condition = _.cloneDeep(this.searchForm);
+      if (condition.buy_time) {
+        condition[`buy_time@start`] = _.head(condition.buy_time);
+        condition[`buy_time@end`] = _.last(condition.buy_time);
+        delete condition.buy_time;
+      }
+      info.status = '2-';
+      let res = await this.query({ skip, limit, ...condition, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `skip`, skip);
+        this.$set(this, 'list', res.data);
+        this.$set(this, 'total', res.total);
+      }
+    },
+    getAddress(i) {
+      let name = i.name + ',' + i.phone;
+      return name;
+    },
+    toDetail({ data }) {
+      this.$emit('toDetails', data._id);
+    },
+    toSales({ data }) {
+      this.$emit('toSaless', { id: data._id, status: '2-' });
+    },
+    toClose() {
+      this.searchForm = {};
+      this.search();
+    },
+    // 多选
+    handleSelect(data) {
+      this.$emit('handleSelect');
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.one {
+  margin: 0 0 10px 0;
+}
+</style>

src/views/platmanag/order/detail_order.vue → src/views/platmanag/order/parts/detail/detail_order.vue


+ 154 - 63
src/views/selfShop/order/detail_orderDetail.vue

@@ -71,7 +71,7 @@
           </el-col>
           <el-col :span="24" class="bode">
             <el-col :span="6">配送方式</el-col>
-            <el-col :span="18" class="other">快递配送</el-col>
+            <el-col :span="18" class="other">{{ form.transport_type_name }}</el-col>
           </el-col>
           <el-col :span="24" class="goods_total bode">
             <el-col :span="6">快递费</el-col>
@@ -101,8 +101,49 @@
             <el-col :span="6">寄出快递公司</el-col>
             <el-col :span="18" class="other">{{ transport.shop_transport_name || '暂无快递信息' }}</el-col>
           </el-col>
-          <el-col :span="24" class="form" v-if="form.status == '1' || form.status == '2'">
+          <el-col :span="24">
+            <el-col v-for="(item, index) in transport" :key="index" class="transport">
+              <el-col :span="24" class="bode">
+                <el-col :span="6">发货商品{{ index + 1 }}</el-col>
+                <el-col :span="18" class="other">{{ item.goods_name }}</el-col>
+              </el-col>
+              <el-col :span="24" class="bode">
+                <el-col :span="6">发货数量</el-col>
+                <el-col :span="18" class="other">{{ item.num }}</el-col>
+              </el-col>
+              <el-col :span="24" class="bode">
+                <el-col :span="6">寄出运单号</el-col>
+                <el-col :span="18" class="other">{{ item.shop_transport_no || '暂无单号' }}</el-col>
+              </el-col>
+              <el-col :span="24" class="bode">
+                <el-col :span="6">寄出快递公司</el-col>
+                <el-col :span="18" class="other">{{ item.shop_transport_name || '暂无快递信息' }}</el-col>
+              </el-col>
+              <el-col :span="24" style="text-align: center">
+                <el-button type="danger" @click="toDel(item)"> 删除 </el-button>
+              </el-col>
+            </el-col>
+          </el-col>
+          <el-col v-if="form.status == '1' || form.status == '2-'">
+            <el-button type="primary" @click="onstatus('0')"> 全部发货 </el-button>
+            <el-button type="primary" @click="onstatus('1')"> 部分发货 </el-button>
+          </el-col>
+          <el-col :span="24" class="form" v-if="form.status == '1' || form.status == '2' || form.status == '2-'">
             <el-form :model="form" ref="form" :rules="rules" label-width="100px" class="demo-ruleForm">
+              <el-form-item label="发货商品" prop="goods_name" v-if="status == '1' && form.transport_type == '0'">
+                <el-select v-model="form.goods_name" clearable filterable placeholder="请选择发货商品" size="small" style="width: 100%" @change="goodsChange">
+                  <el-option v-for="i in list" :key="i._id" :label="getName(i)" :value="i._id"> </el-option>
+                </el-select>
+                <p>
+                  <span style="color: red">用于部分发货 </span>
+                </p>
+              </el-form-item>
+              <el-form-item label="发货商品数量" prop="num" v-if="status == '1' && form.transport_type == '0'">
+                <el-input v-model="form.num" placeholder="请输入发货商品数量" size="small" @input="toNum"></el-input>
+                <p>
+                  用于部分发货:发货最大数量不得超过购买商品最大数量 <span style="color: red"> {{ buy_num }}</span>
+                </p>
+              </el-form-item>
               <el-form-item label="寄出运单号" prop="shop_transport_no" v-if="form.transport_type == '0'">
                 <el-input v-model="form.shop_transport_no" placeholder="请输入运单号,快递公司,同时填入" size="small"></el-input>
               </el-form-item>
@@ -129,7 +170,12 @@
               </el-form-item>
               <el-form-item>
                 <el-col>
-                  <el-button type="primary" @click="onSubmit('form', '2')" v-if="form.status == '1'"> 发货 </el-button>
+                  <el-button type="primary" @click="onSubmit('form', '2')" v-if="(form.status == '1' || form.status == '2-') && status == '0'">
+                    保存
+                  </el-button>
+                  <el-button type="primary" @click="onSubmit('form', '2-')" v-if="(form.status == '1' || form.status == '2-') && status == '1'">
+                    添加保存
+                  </el-button>
                   <el-button type="primary" @click="onSubmit('form', '3')" v-if="form.status == '2'"> 确认收货 </el-button>
                   <el-button type="primary" @click="onSubmit('form', '2')" v-if="form.status == '2'"> 保存 </el-button>
                 </el-col>
@@ -181,7 +227,7 @@ export default {
       // 商铺
       shop: {},
       // 运单号
-      transport: {},
+      transport: [],
       pay: {},
       // 商品列表
       list: [],
@@ -202,6 +248,8 @@ export default {
         transport_type: [{ required: true, message: '请选择快递类型', trigger: 'change' }],
       },
       loadings: true,
+      buy_num: '',
+      status: '0',
     };
   },
   async created() {
@@ -218,6 +266,8 @@ export default {
       let res;
       res = await this.fetch(this.id);
       if (this.$checkRes(res)) {
+        let name = this.transport_typeList.find((i) => i.value == res.data.transport_type);
+        if (name) res.data.transport_type_name = name.label;
         this.$set(this, `form`, res.data);
         if (res.data.transport == undefined) this.$set(this.form, `transport_type`, '0');
         // 地址
@@ -228,25 +278,28 @@ export default {
         // 应付金额
         this.$set(this, `total_detail`, res.data.total_detail);
         this.$set(this, `pay`, res.data.order.pay);
-        if (res.data.transport) {
-          let arr = await this.dictQuery({ code: 'transport_company', value: res.data.transport.shop_transport_type });
-          if (this.$checkRes(arr)) {
-            let type = arr.data.find((i) => i.value == res.data.transport.shop_transport_type);
-            if (type) {
-              res.data.transport.shop_transport_name = type.label;
-              this.querySearch(type.label);
+        if (res.data.transport != undefined) {
+          for (const p1 of res.data.transport) {
+            let goods = this.form.goods.find((i) => i.id == p1.goods);
+            if (goods) p1.goods_name = goods.goods.name + ',' + goods.name;
+            // p1.good = p1.goods;
+            let arr = await this.dictQuery({ code: 'transport_company', value: p1.shop_transport_type });
+            if (this.$checkRes(arr)) {
+              let type = arr.data.find((i) => i.value == p1.shop_transport_type);
+              if (type) {
+                p1.shop_transport_name = type.label;
+                this.querySearch(type.label);
+              }
             }
-            this.$set(this, `transport`, res.data.transport);
-            this.$set(this.form, `shop_transport_type`, this.transport.shop_transport_type);
-            if (this.transport.transport_type == undefined) this.$set(this.form, `transport_type`, '0');
-            else this.$set(this.form, `transport_type`, this.transport.transport_type);
-            this.$set(this.form, `shop_transport_no`, this.transport.shop_transport_no);
+            // p1.shop_transport_type = this.transport.shop_transport_type;
+            // p1.shop_transport_no = this.transport.shop_transport_no;
           }
+          this.$set(this, `transport`, res.data.transport);
           res = await this.sotFetch(this.id);
           if (this.$checkRes(res)) {
             if (res.errcode == '0') {
               let activities = res.data.list;
-              activities[0].color = '#0bbd87';
+              // activities[0].color = '#0bbd87';
               this.$set(this, `activities`, activities);
               this.$set(this, `activit`, res.data);
             }
@@ -270,55 +323,87 @@ export default {
         this.$message.error('该商品还未添加来源网址,无法跳转');
       }
     },
+    onstatus(status) {
+      this.status = status;
+    },
     handleSelect(value) {},
+    // 选择商品
+    goodsChange(value) {
+      let name = this.form.goods.find((i) => i.id == value);
+      this.$set(this, `buy_num`, name.buy_num);
+    },
+    getName(i) {
+      let name = i.goods.name + ',' + i.name;
+      return name;
+    },
+
+    // 发货最大数量
+    toNum(val) {
+      if (val > this.buy_num) {
+        this.$message.error('超过发货最大数量');
+        this.$set(this.form, `num`, '');
+      }
+    },
+    toDel(data) {
+      this.$confirm('是否确认删除', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      }).then(async () => {
+        let list = this.transport;
+        let form = this.form;
+        let newList = list.filter((i) => i.id != data.id);
+        form.transport = newList;
+        this.$set(this, `transport`, newList);
+        let res;
+        if (form.id) res = await this.update(form);
+        if (this.$checkRes(res)) {
+          this.$message({ type: `success`, message: `维护信息成功` });
+          this.search();
+        }
+      });
+    },
     // 提交
     async onSubmit(formName, val) {
-      var form = this.form;
-      var transport = {};
-      var res;
-      if (form.shop_transport_no != undefined) transport.shop_transport_no = form.shop_transport_no;
-      if (form.shop_transport_type != undefined) transport.shop_transport_type = form.shop_transport_type;
-      if (form.transport_type) transport.transport_type = form.transport_type;
-      form.transport = transport;
-      if (form.shop_transport_no == undefined || form.shop_transport_type == undefined) {
-        this.$refs[formName].validate(async (valid) => {
-          if (valid) {
-            this.$confirm('快递信息未填写完整,是否保存发货', '提示', {
-              confirmButtonText: '确定',
-              cancelButtonText: '取消',
-              type: 'warning',
-            }).then(async () => {
-              if (val != undefined || val != '') form.status = val;
-              if (form.id) res = await this.update(form);
-              if (this.$checkRes(res)) {
-                this.$message({ type: `success`, message: `维护信息成功` });
-                this.search();
+      this.$refs[formName].validate(async (valid) => {
+        if (valid) {
+          this.$confirm('是否确认保存', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning',
+          }).then(async () => {
+            var form = this.form;
+            if (form.transport_type == '0') {
+              var shop_transport_no = form.shop_transport_no;
+              var shop_transport_type = form.shop_transport_type;
+              if (form.transport != undefined && val == '2-') {
+                let goods = form.goods_name;
+                let num = form.num;
+                form.transport.push({ id: moment(new Date()).valueOf(), goods, num, shop_transport_no, shop_transport_type });
+              } else if (form.transport == undefined && val == '2-') {
+                let goods = form.goods_name;
+                let num = form.num;
+                let transport = [];
+                transport.push({ id: moment(new Date()).valueOf(), goods, num, shop_transport_no, shop_transport_type });
+                form.transport = transport;
+              } else if ((val == '2' || val == '3') && form.transport_type == '0') {
+                let transport = [];
+                transport.push({ shop_transport_no, shop_transport_type });
+                form.transport = transport;
               }
-            });
-          } else {
-            return false;
-          }
-        });
-      } else {
-        this.$refs[formName].validate(async (valid) => {
-          if (valid) {
-            this.$confirm('是否确认保存', '提示', {
-              confirmButtonText: '确定',
-              cancelButtonText: '取消',
-              type: 'warning',
-            }).then(async () => {
-              if (val != undefined || val != '') form.status = val;
-              if (form.id) res = await this.update(form);
-              if (this.$checkRes(res)) {
-                this.$message({ type: `success`, message: `维护信息成功` });
-                this.search();
-              }
-            });
-          } else {
-            return false;
-          }
-        });
-      }
+            }
+            var res;
+            if (val != undefined || val != '') form.status = val;
+            if (form.id) res = await this.update(form);
+            if (this.$checkRes(res)) {
+              this.$message({ type: `success`, message: `维护信息成功` });
+              this.search();
+            }
+          });
+        } else {
+          return false;
+        }
+      });
     },
 
     // 返回
@@ -357,7 +442,7 @@ export default {
 <style lang="less" scoped>
 .main {
   .one {
-    margin: 10px 0 0 5%;
+    margin: 10px 0 0 2%;
     padding: 5px;
     .add {
       border-bottom: 2px dashed #ccc;
@@ -375,6 +460,12 @@ export default {
         text-align: right;
       }
     }
+    .transport {
+      margin: 50px;
+      padding: 5px;
+      // margin: 0 0 0 40px;
+      border: 1px solid rgb(254, 195, 195);
+    }
     .other {
       text-align: right;
       word-break: break-all;

+ 170 - 0
src/views/platmanag/order/parts/detail/detail_orderDetail.vue

@@ -0,0 +1,170 @@
+<template>
+  <div id="form-1">
+    <el-row>
+      <el-col :span="24" class="top-btn">
+        <el-button type="primary" size="mini" @click="toBack()">返回</el-button>
+      </el-col>
+      <el-col
+        :span="24"
+        class="main animate__animated animate__backInRight"
+        v-loading="loadings"
+        element-loading-text="拼命加载中"
+        element-loading-spinner="el-icon-loading"
+      >
+        <el-tabs type="border-card">
+          <el-tab-pane label="订单详情">
+            <card-1 :address="address" :list="list" :pay="pay" :form="form" :total_detail="total_detail" :shop="shop"></card-1>
+          </el-tab-pane>
+          <el-tab-pane label="发货信息">
+            <card-2
+              :transport="transport"
+              :list="list"
+              :address="address"
+              :form="form"
+              :activities="activities"
+              :shop_transport_typeList="shop_transport_typeList"
+              :transport_typeList="transport_typeList"
+              @querySearch="querySearch"
+            ></card-2>
+          </el-tab-pane>
+        </el-tabs>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+const moment = require('moment');
+import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('orderDetail');
+const { mapActions: dictData } = createNamespacedHelpers('dictData');
+const { mapActions: sot } = createNamespacedHelpers('sot');
+
+export default {
+  name: 'form-1',
+  props: { id: { type: String } },
+  components: {
+    card1: () => import('./parts/card-1.vue'),
+    card2: () => import('./parts/card-2.vue'),
+  },
+  data: function () {
+    return {
+      loadings: true,
+      form: {},
+      // 地址
+      address: {},
+      // 实付金额
+      total_detail: {},
+      // 商铺
+      shop: {},
+      // 运单号
+      transport: [],
+      pay: {},
+      // 商品列表
+      list: [],
+      activities: [],
+      // 订单状态
+      order_processList: [],
+      // 快递公司
+      shop_transport_typeList: [],
+      // 快递类型
+      transport_typeList: [],
+    };
+  },
+  async created() {
+    await this.searchOther();
+    await this.search();
+  },
+  methods: {
+    ...dictData({ dictQuery: 'query' }),
+    ...sot({ sotCreate: 'create' }),
+    ...mapActions(['query', 'fetch', 'create', 'update']),
+    // 查询
+    async search() {
+      let res;
+      res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        let name = this.transport_typeList.find((i) => i.value == res.data.transport_type);
+        if (name) res.data.transport_type_name = name.label;
+        this.$set(this, `form`, res.data);
+        if (res.data.transport == undefined) this.$set(this.form, `transport_type`, '0');
+        // 地址
+        this.$set(this, `address`, res.data.address);
+        this.$set(this, `shop`, res.data.shop);
+        // 商品
+        this.$set(this, `list`, res.data.goods);
+        // 应付金额
+        this.$set(this, `total_detail`, res.data.total_detail);
+        this.$set(this, `pay`, res.data.order.pay);
+        if (res.data.transport != undefined || res.data.transport.length != 0) {
+          for (const p1 of res.data.transport) {
+            for (const p2 of p1.goods) {
+              let goods = this.form.goods.find((i) => i.id == p2.goods_id);
+              if (goods) p2.goods_name = goods.goods.name + ',' + goods.name;
+            }
+            let arr = await this.dictQuery({ code: 'transport_company', value: p1.shop_transport_type });
+            if (this.$checkRes(arr)) {
+              let type = arr.data.find((i) => i.value == p1.shop_transport_type);
+              if (type) {
+                p1.shop_transport_name = type.label;
+                this.querySearch(type.label);
+              }
+            }
+          }
+          this.$set(this, `transport`, res.data.transport);
+          let info = { id: this.id };
+          res = await this.sotCreate(info);
+          if (this.$checkRes(res)) {
+            if (res.errcode == '0') {
+              this.$set(this, `activities`, res.data);
+            }
+          }
+        }
+      }
+      this.loadings = false;
+    },
+    async querySearch(value) {
+      let res = await this.dictQuery({ code: 'transport_company', label: value });
+      if (this.$checkRes(res)) {
+        this.$set(this, 'shop_transport_typeList', res.data);
+      }
+    },
+    // 返回
+    toBack() {
+      this.$emit('toBack');
+    },
+    // 查询其他信息
+    async searchOther() {
+      let res;
+      // 减免方式
+      res = await this.dictQuery({ code: 'order_process' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `order_processList`, res.data);
+      }
+      // 快递类型
+      res = await this.dictQuery({ code: 'transport_type' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `transport_typeList`, res.data);
+      }
+    },
+  },
+  computed: {},
+  metaform() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.top-btn {
+  margin: 20px 0;
+}
+</style>

src/views/platmanag/order/detail_sales_order.vue → src/views/platmanag/order/parts/detail/detail_sales_order.vue


+ 1 - 1
src/views/selfShop/order/detail_sales_orderDetail.vue

@@ -104,7 +104,7 @@
         </el-col>
         <el-col :span="9" class="one">
           <el-button type="danger" @click="toSales('1')" v-if="this.status == '1'"> 取消订单 </el-button>
-          <el-button type="danger" @click="toSales('2')" v-if="this.status == '2'"> 拒收 </el-button>
+          <el-button type="danger" @click="toSales('2')" v-if="this.status == '2' || this.status == '2-'"> 拒收 </el-button>
           <el-col v-if="this.status == '3'">
             <el-form :model="form" :rules="rules" ref="form" label-width="180px">
               <el-col :span="24">

+ 194 - 0
src/views/platmanag/order/parts/detail/parts/card-1.vue

@@ -0,0 +1,194 @@
+<template>
+  <div id="card-1">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="add">
+          <el-col :span="2">
+            <i class="el-icon-location"></i>
+          </el-col>
+          <el-col :span="22">
+            <el-col>
+              <p>{{ address.name }},{{ address.phone }}</p>
+            </el-col>
+            <el-col>
+              <p>{{ address.province }} , {{ address.city }} , {{ address.area }} , {{ address.address }}</p>
+            </el-col>
+          </el-col>
+        </el-col>
+        <el-col :span="24" class="shop"> <i class="el-icon-s-shop"></i>{{ shop.name }}</el-col>
+        <el-col :span="24" v-for="(item, index) in list" :key="index">
+          <el-col :span="24" class="goods bode">
+            <el-col :span="6"><el-image :src="item.goods.file[0].url"></el-image></el-col>
+            <el-col :span="18">
+              <el-col :span="12">
+                <el-col>
+                  <p>{{ item.goods.name }}</p>
+                </el-col>
+                <el-col>
+                  <p>规格:{{ item.name }}</p>
+                </el-col>
+              </el-col>
+              <el-col :span="12" class="money">
+                <el-col>
+                  <p v-if="form.type == '0'">¥{{ item.sell_money }}</p>
+                  <p v-else-if="form.type == '1'">¥{{ item.group_config.money }}</p>
+                </el-col>
+                <el-col>
+                  <p>X{{ item.buy_num }}</p>
+                </el-col>
+                <el-col>
+                  <span class="spanfour" style="color: blue" @click="toUrl(item.goods.url)"> 查看商品来源:{{ item.goods.source }}</span>
+                </el-col>
+                <el-col>
+                  <p>{{ item.is_afterSale == true ? '已申请售后' : '未申请售后' }}</p>
+                </el-col>
+                <el-col>
+                  <p>{{ item.is_rate == true ? '已评价' : '未评价' }}</p>
+                </el-col>
+              </el-col>
+            </el-col>
+          </el-col>
+          <el-col :span="24" class="bode">
+            <el-col :span="6">运费</el-col>
+            <el-col :span="18" class="other" v-if="!item.goods.freight == '0'">{{ item.goods.freight }}</el-col>
+            <el-col :span="18" class="other" v-else>包邮</el-col>
+          </el-col>
+        </el-col>
+        <el-col :span="24" class="bode">
+          <el-col :span="6">订单备注</el-col>
+          <el-col :span="18" class="other" v-if="form.remarks">{{ form.remarks }}</el-col>
+          <el-col :span="18" class="other" v-else>暂无备注</el-col>
+        </el-col>
+        <el-col :span="24" class="bode">
+          <el-col :span="6">配送方式</el-col>
+          <el-col :span="18" class="other">{{ form.transport_type_name }}</el-col>
+        </el-col>
+        <el-col :span="24" class="goods_total bode">
+          <el-col :span="6">快递费</el-col>
+          <el-col :span="18" class="other">
+            <p>¥{{ total_detail.freight_total }}</p>
+          </el-col>
+        </el-col>
+        <el-col :span="24" class="goods_total bode">
+          <el-col :span="8">优惠后实付金额</el-col>
+          <el-col :span="16" class="other">
+            <p>¥{{ pay.pay_money }}</p>
+          </el-col>
+        </el-col>
+        <el-col :span="24" class="bode">
+          <el-col :span="6">下单时间</el-col>
+          <el-col :span="18" class="other">{{ form.buy_time }}</el-col>
+        </el-col>
+        <el-col :span="24" class="bode">
+          <el-col :span="6">支付时间</el-col>
+          <el-col :span="18" class="other">{{ form.pay_time }}</el-col>
+        </el-col>
+        <!-- <el-col :span="24" class="bode" v-if="form.status == '3'">
+          <el-col :span="6">寄出运单号</el-col>
+          <el-col :span="18" class="other">{{ transport.shop_transport_no || '暂无单号' }}</el-col>
+        </el-col>
+        <el-col :span="24" class="bode" v-if="form.status == '3'">
+          <el-col :span="6">寄出快递公司</el-col>
+          <el-col :span="18" class="other">{{ transport.shop_transport_name || '暂无快递信息' }}</el-col>
+        </el-col> -->
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'card-1',
+  props: {
+    address: { type: Object },
+    list: { type: Array },
+    pay: { type: Object },
+    form: { type: Object },
+    total_detail: { type: Object },
+    shop: { type: Object },
+  },
+  components: {},
+  data: function () {
+    return {};
+  },
+  created() {},
+  methods: {
+    toUrl(url) {
+      if (url) {
+        window.open(url, '_blank');
+      } else {
+        this.$message.error('该商品还未添加来源网址,无法跳转');
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  padding: 0 25%;
+  .add {
+    border-bottom: 2px dashed #ccc;
+    margin: 0 0 5px 0;
+    padding: 5px 0;
+  }
+  .shop {
+    padding: 4px 0;
+    font-size: 18px;
+    border-bottom: 1px solid #ccc;
+  }
+  .goods {
+    padding: 10px 0;
+    .money {
+      text-align: right;
+    }
+  }
+  .transport {
+    margin: 50px;
+    padding: 5px;
+    // margin: 0 0 0 40px;
+    border: 1px solid rgb(254, 195, 195);
+  }
+  .other {
+    text-align: right;
+    word-break: break-all;
+    p {
+      color: red;
+    }
+    .spanfour {
+      color: blue;
+    }
+  }
+  .el-col {
+    margin: 3px 0;
+  }
+  .bode {
+    border-bottom: 1px solid rgb(238, 237, 237);
+  }
+  .form {
+    margin: 20px 0 0 0;
+  }
+}
+
+/deep/.el-timeline {
+  margin: 20px 0 0 0;
+  font-size: 16px;
+}
+/deep/.el-timeline-item__node:nth-child(1) {
+  background-color: green;
+}
+</style>

+ 388 - 0
src/views/platmanag/order/parts/detail/parts/card-2.vue

@@ -0,0 +1,388 @@
+<template>
+  <div id="card-2">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="9" class="one">
+          <el-col :span="24">
+            <el-col v-for="(item, index) in transport" :key="index" class="transport">
+              <el-col v-for="(good, index) in item.goods" :key="index">
+                <el-col :span="24" class="bode">
+                  <el-col :span="6">发货商品{{ index + 1 }}</el-col>
+                  <el-col :span="18" class="other">{{ good.goods_name }}</el-col>
+                </el-col>
+                <el-col :span="24" class="bode">
+                  <el-col :span="6">发货数量</el-col>
+                  <el-col :span="18" class="other">{{ good.num }}</el-col>
+                </el-col>
+              </el-col>
+              <el-col :span="24" class="bode">
+                <el-col :span="6">寄出运单号</el-col>
+                <el-col :span="18" class="other">{{ item.shop_transport_no || '暂无单号' }}</el-col>
+              </el-col>
+              <el-col :span="24" class="bode">
+                <el-col :span="6">寄出快递公司</el-col>
+                <el-col :span="18" class="other">{{ item.shop_transport_name || '暂无快递信息' }}</el-col>
+              </el-col>
+              <el-col :span="24" style="text-align: center">
+                <el-button type="danger" @click="toDel(item)"> 删除 </el-button>
+                <el-button type="primary" @click="toLog(item)"> 查看物流 </el-button>
+              </el-col>
+            </el-col>
+          </el-col>
+          <el-col v-if="form.status == '1' || form.status == '2-'">
+            <el-button type="primary" @click="onstatus('0')"> 全部发货 </el-button>
+            <el-button type="primary" @click="onstatus('1')"> 部分发货 </el-button>
+          </el-col>
+          <el-col :span="24" v-if="status == '1' && form.transport_type == '0'">
+            <el-col>发货商品</el-col>
+            <el-col :span="24" style="margin: 0 0 10px 0">
+              <el-button type="primary" size="mini" @click="toAdd()">添加</el-button>
+            </el-col>
+            <data-table :usePage="false" :fields="fieldsList" :opera="opera" :data="goodsList" @edit="toEdit" @del="toDelete"> </data-table>
+          </el-col>
+          <el-col :span="24" class="form" v-if="form.status == '1' || form.status == '2' || form.status == '2-'">
+            <el-form :model="form" ref="form" :rules="rules" label-width="100px" class="demo-ruleForm">
+              <el-form-item label="寄出运单号" prop="shop_transport_no" v-if="form.transport_type == '0'">
+                <el-input v-model="form.shop_transport_no" placeholder="请输入运单号,快递公司,同时填入" size="small"></el-input>
+              </el-form-item>
+              <el-form-item label="快递公司" prop="shop_transport_type" v-if="form.transport_type == '0'">
+                <el-select
+                  v-model="form.shop_transport_type"
+                  filterable
+                  remote
+                  reserve-keyword
+                  placeholder="请选择快递公司,运单号,同时填入"
+                  :remote-method="querySearch"
+                  :loading="loading"
+                  @change="handleSelect"
+                  size="small"
+                  style="width: 100%"
+                >
+                  <el-option v-for="item in shop_transport_typeList" :key="item.id" :label="item.label" :value="item.value"> </el-option>
+                </el-select>
+              </el-form-item>
+              <el-form-item label="快递类型" prop="transport_type">
+                <el-select v-model="form.transport_type" clearable filterable placeholder="请选择快递类型" size="small" style="width: 100%">
+                  <el-option v-for="i in transport_typeList" :key="i.label" :label="i.label" :value="i.value"> </el-option>
+                </el-select>
+              </el-form-item>
+              <el-form-item>
+                <el-col>
+                  <el-button type="primary" @click="onSubmit('form', '2')" v-if="(form.status == '1' || form.status == '2-') && status == '0'">
+                    保存
+                  </el-button>
+                  <el-button type="primary" @click="onSubmit('form', '2-')" v-if="(form.status == '1' || form.status == '2-') && status == '1'">
+                    添加保存
+                  </el-button>
+                  <el-button type="primary" @click="onSubmit('form', '3')" v-if="form.status == '2'"> 确认收货 </el-button>
+                  <el-button type="primary" @click="onSubmit('form', '2')" v-if="form.status == '2'"> 保存 </el-button>
+                </el-col>
+              </el-form-item>
+            </el-form>
+          </el-col>
+        </el-col>
+        <el-col :span="9" class="one">
+          <el-col :span="24">{{ activit.is_check || '暂无快递信息' }}</el-col>
+          <el-col :span="24">{{ transport.shop_transport_name || '暂无快递信息' }}: {{ activit.no || '暂无快递信息' }}</el-col>
+          <el-col :span="24">
+            <p>订单编号: {{ form.id }}</p>
+          </el-col>
+          <el-col :span="24">
+            <p>收货地址:{{ address.province }} , {{ address.city }} , {{ address.area }} , {{ address.address }}</p>
+          </el-col>
+          <el-col :span="24">
+            <el-timeline :reverse="reverse">
+              <el-timeline-item v-for="(activity, index) in logList" :key="index" :timestamp="activity.time" :color="activity.color">
+                {{ activity.context }}
+              </el-timeline-item>
+            </el-timeline>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+    <e-dialog :dialog="dialog" @toClose="toClose">
+      <template v-slot:info>
+        <el-form :model="fieldform" ref="fieldform" label-width="100px" class="demo-ruleForm">
+          <el-form-item label="发货商品" prop="goods_name" v-if="status == '1' && form.transport_type == '0'">
+            <el-select v-model="fieldform.goods_id" clearable filterable placeholder="请选择发货商品" size="small" style="width: 100%" @change="goodsChange">
+              <el-option v-for="i in list" :key="i._id" :label="getName(i)" :value="i._id"> </el-option>
+            </el-select>
+            <p>
+              <span style="color: red">用于部分发货 </span>
+            </p>
+          </el-form-item>
+          <el-form-item label="发货商品数量" prop="num" v-if="status == '1' && form.transport_type == '0'">
+            <el-input v-model="fieldform.num" placeholder="请输入发货商品数量" size="small" @input="toNum"></el-input>
+            <p>
+              用于部分发货:发货最大数量不得超过购买商品最大数量 <span style="color: red"> {{ buy_num }}</span>
+            </p>
+          </el-form-item>
+          <el-form-item>
+            <el-col>
+              <el-button type="primary" @click="toSave()"> 保存 </el-button>
+            </el-col>
+          </el-form-item>
+        </el-form>
+      </template>
+    </e-dialog>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('orderDetail');
+export default {
+  name: 'card-2',
+  props: {
+    transport: { type: Array },
+    list: { type: Array },
+    shop_transport_typeList: { type: Array },
+    activities: { type: Array },
+    transport_typeList: { type: Array },
+    form: { type: Object },
+    address: { type: Object },
+  },
+  components: {},
+  data: function () {
+    return {
+      activit: {},
+      logList: [],
+      status: '0',
+      // 物流
+      reverse: false,
+      loading: false,
+      rules: {
+        shop_transport_no: [{ required: true, message: '请输入快递单号', trigger: 'blur' }],
+        shop_transport_type: [{ required: true, message: '请选择快递公司', trigger: 'change' }],
+        transport_type: [{ required: true, message: '请选择快递类型', trigger: 'change' }],
+      },
+      listForm: {},
+      buy_num: '',
+      // status: '0',
+      // 商品
+      goodsList: [],
+      // 添加发货商品表单
+      fieldform: {},
+      // 底部菜单
+      opera: [
+        { label: '修改', method: 'edit' },
+        { label: '删除', method: 'del', confirm: true, type: 'danger' },
+      ],
+      fieldsList: [
+        { label: '商品名称', model: 'goods_id', format: (i) => this.getNames(i) },
+        { label: '发货数量', model: 'num' },
+      ],
+      // 弹框
+      dialog: { title: '信息管理', show: false, type: '1' },
+    };
+  },
+  created() {},
+  methods: {
+    ...mapActions(['query', 'fetch', 'create', 'update']),
+    // 远程查询
+    async querySearch(value) {
+      this.loading = true;
+      this.$emit('querySearch', value);
+      this.loading = false;
+    },
+    handleSelect(value) {},
+    // 添加
+    async toAdd() {
+      this.dialog = { title: '信息管理', show: true, type: '1' };
+    },
+    // 关闭
+    toClose() {
+      this.fieldform = {};
+      this.dialog = { title: '信息管理', show: false, type: '1' };
+    },
+    // 修改
+    toEdit(index, data) {
+      this.$set(this, `fieldform`, index.data);
+      this.dialog = { title: '信息管理', show: true, type: '1' };
+    },
+    // 添加发货商品提交
+    toSave() {
+      let data = this.fieldform;
+      data.id = moment(new Date()).valueOf();
+      let info = this.goodsList.find((f) => f.id == data.id);
+      if (info == '' || info == undefined) {
+        this.goodsList.push(data);
+      }
+      this.toClose();
+    },
+    // 删除
+    toDelete({ data }) {
+      let newList = this.goodsList.filter((i) => i.id != data.id);
+      this.$set(this, `goodsList`, newList);
+    },
+    onstatus(status) {
+      this.status = status;
+    },
+    // 选择商品
+    goodsChange(value) {
+      let name = this.form.goods.find((i) => i.id == value);
+      this.$set(this, `buy_num`, name.buy_num);
+    },
+    getName(i) {
+      let name = i.name + ',' + i.goods.name;
+      return name;
+    },
+    getNames(val) {
+      let goods = this.form.goods.find((i) => i.id == val);
+      let name = goods.name + ',' + goods.goods.name;
+      return name;
+    },
+    // 查看物流
+    toLog(value) {
+      let info = this.activities.find((f) => f.no == value.shop_transport_no);
+      if (info) {
+        info.list[0].color = '#0bbd87';
+        this.$set(this, `logList`, info.list);
+        this.$set(this, `activit`, info);
+      }
+    },
+
+    // 发货最大数量
+    toNum(val) {
+      if (val > this.buy_num) {
+        this.$message.error('超过发货最大数量');
+        this.$set(this.form, `num`, '');
+      }
+    },
+    toDel(data) {
+      this.$confirm('是否确认删除', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      }).then(async () => {
+        let list = this.transport;
+        let form = this.form;
+        let newList = list.filter((i) => i.id != data.id);
+        form.transport = newList;
+        this.$set(this, `transport`, newList);
+        let res;
+        if (form.id) res = await this.update(form);
+        if (this.$checkRes(res)) {
+          this.$message({ type: `success`, message: `维护信息成功` });
+          this.search();
+        }
+      });
+    },
+    // 提交
+    async onSubmit(formName, val) {
+      this.$refs[formName].validate(async (valid) => {
+        if (valid) {
+          this.$confirm('是否确认保存', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning',
+          }).then(async () => {
+            var form = this.form;
+            if (form.transport_type == '0') {
+              var shop_transport_no = form.shop_transport_no;
+              var shop_transport_type = form.shop_transport_type;
+              if (form.transport != undefined && val == '2-') {
+                let goods = this.goodsList;
+                // let num = form.num;
+                form.transport.push({ id: moment(new Date()).valueOf(), goods, shop_transport_no, shop_transport_type });
+              } else if (form.transport == undefined && val == '2-') {
+                let goods = this.goodsList;
+                // let num = form.num;
+                let transport = [];
+                transport.push({ id: moment(new Date()).valueOf(), goods, shop_transport_no, shop_transport_type });
+                form.transport = transport;
+              } else if ((val == '2' || val == '3') && form.transport_type == '0') {
+                let transport = [];
+                transport.push({ shop_transport_no, shop_transport_type });
+                form.transport = transport;
+              }
+            }
+            // console.log(form);
+            var res;
+            if (val != undefined || val != '') form.status = val;
+            if (form.id) res = await this.update(form);
+            if (this.$checkRes(res)) {
+              this.$message({ type: `success`, message: `维护信息成功` });
+              this.goodsList = [];
+              this.search();
+            }
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .one {
+    margin: 10px 0 0 2%;
+    padding: 5px;
+    .add {
+      border-bottom: 2px dashed #ccc;
+      margin: 0 0 5px 0;
+      padding: 5px 0;
+    }
+    .shop {
+      padding: 4px 0;
+      font-size: 18px;
+      border-bottom: 1px solid #ccc;
+    }
+    .goods {
+      padding: 10px 0;
+      .money {
+        text-align: right;
+      }
+    }
+    .transport {
+      margin: 50px;
+      padding: 5px;
+      // margin: 0 0 0 40px;
+      border: 1px solid rgb(254, 195, 195);
+    }
+    .other {
+      text-align: right;
+      word-break: break-all;
+      p {
+        color: red;
+      }
+      .spanfour {
+        color: blue;
+      }
+    }
+    .el-col {
+      margin: 3px 0;
+    }
+    .bode {
+      border-bottom: 1px solid rgb(238, 237, 237);
+    }
+    .form {
+      margin: 20px 0 0 0;
+    }
+  }
+}
+
+/deep/.el-timeline {
+  margin: 20px 0 0 0;
+  font-size: 16px;
+}
+/deep/.el-timeline-item__node:nth-child(1) {
+  background-color: green;
+}
+</style>

+ 8 - 4
src/views/selfShop/order/index.vue

@@ -12,6 +12,9 @@
               <el-tab-pane label="待发货" name="2">
                 <card-2 :statusList="statusList" @toDetails="toDetails" @toSaless="toSaless"></card-2>
               </el-tab-pane>
+              <el-tab-pane label="部分发货" name="5">
+                <card-5 :statusList="statusList" @toDetails="toDetails" @toSaless="toSaless"></card-5>
+              </el-tab-pane>
               <el-tab-pane label="待收货" name="3">
                 <card-3 :statusList="statusList" @toDetails="toDetails" @toSaless="toSaless"></card-3>
               </el-tab-pane>
@@ -43,10 +46,11 @@ export default {
     card2: () => import('./parts/card-2.vue'),
     card3: () => import('./parts/card-3.vue'),
     card4: () => import('./parts/card-4.vue'),
-    detail_order: () => import('./detail_order.vue'),
-    detail_orderDetail: () => import('./detail_orderDetail.vue'),
-    detail_sales_order: () => import('./detail_sales_order.vue'),
-    detail_sales_orderDetail: () => import('./detail_sales_orderDetail.vue'),
+    card5: () => import('./parts/card-5.vue'),
+    detail_order: () => import('./parts/detail/detail_order.vue'),
+    detail_orderDetail: () => import('./parts/detail/detail_orderDetail.vue'),
+    detail_sales_order: () => import('./parts/detail/detail_sales_order.vue'),
+    detail_sales_orderDetail: () => import('./parts/detail/detail_sales_orderDetail.vue'),
   },
   data: function () {
     const that = this;

+ 118 - 0
src/views/selfShop/order/parts/card-5.vue

@@ -0,0 +1,118 @@
+<template>
+  <div id="card-1">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="one">
+          <search-1 :form="searchForm" @onSubmit="search" @toReset="toClose"></search-1>
+        </el-col>
+        <data-table
+          :select="true"
+          :selected="selected"
+          @handleSelect="handleSelect"
+          :fields="fields"
+          :opera="opera"
+          @query="search"
+          :data="list"
+          :total="total"
+          @detail="toDetail"
+          @sales="toSales"
+        >
+        </data-table>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('orderDetail');
+
+export default {
+  name: 'card-1',
+  props: { statusList: { type: Array } },
+  components: { search1: () => import('./search-1.vue') },
+  data: function () {
+    return {
+      searchForm: {},
+      list: [],
+      total: 0,
+      opera: [
+        { label: '详情', method: 'detail' },
+        { label: '售后', method: 'sales', type: 'danger' },
+      ],
+      fields: [
+        { label: '订单号', model: 'no', showTip: false },
+        { label: '下单时间', model: 'buy_time' },
+        { label: '顾客', model: 'customer.name' },
+        { label: '收货人', model: 'address', showTip: false, format: (i) => this.getAddress(i) },
+        { label: '支付金额', model: 'real_pay' },
+        { label: '商品数量', model: 'buy_num_total' },
+        { label: '是否售后', model: 'is_afterSale', format: (i) => (i === true ? '该订单有商品申请售后' : '未申请售后') },
+      ],
+      // 多选值
+      selected: [],
+      skip: 0,
+    };
+  },
+  async created() {
+    await this.search();
+  },
+  methods: {
+    ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    // 查询
+    async search({ skip = this.skip, limit = this.$limit, ...info } = {}) {
+      let condition = _.cloneDeep(this.searchForm);
+      if (condition.buy_time) {
+        condition[`buy_time@start`] = _.head(condition.buy_time);
+        condition[`buy_time@end`] = _.last(condition.buy_time);
+        delete condition.buy_time;
+      }
+      info.status = '2-';
+      let res = await this.query({ skip, limit, ...condition, ...info, shop: this.user.shop.id });
+      if (this.$checkRes(res)) {
+        this.$set(this, `skip`, skip);
+        this.$set(this, 'list', res.data);
+        this.$set(this, 'total', res.total);
+      }
+    },
+    getAddress(i) {
+      let name = i.name + ',' + i.phone;
+      return name;
+    },
+    toDetail({ data }) {
+      this.$emit('toDetails', data._id);
+    },
+    toSales({ data }) {
+      this.$emit('toSaless', { id: data._id, status: '2-' });
+    },
+    toClose() {
+      this.searchForm = {};
+      this.search();
+    },
+    // 多选
+    handleSelect(data) {
+      this.$emit('handleSelect');
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.one {
+  margin: 0 0 10px 0;
+}
+</style>

src/views/selfShop/order/detail_order.vue → src/views/selfShop/order/parts/detail/detail_order.vue


+ 154 - 63
src/views/platmanag/order/detail_orderDetail.vue

@@ -71,7 +71,7 @@
           </el-col>
           <el-col :span="24" class="bode">
             <el-col :span="6">配送方式</el-col>
-            <el-col :span="18" class="other">快递配送</el-col>
+            <el-col :span="18" class="other">{{ form.transport_type_name }}</el-col>
           </el-col>
           <el-col :span="24" class="goods_total bode">
             <el-col :span="6">快递费</el-col>
@@ -101,8 +101,49 @@
             <el-col :span="6">寄出快递公司</el-col>
             <el-col :span="18" class="other">{{ transport.shop_transport_name || '暂无快递信息' }}</el-col>
           </el-col>
-          <el-col :span="24" class="form" v-if="form.status == '1' || form.status == '2'">
+          <el-col :span="24">
+            <el-col v-for="(item, index) in transport" :key="index" class="transport">
+              <el-col :span="24" class="bode">
+                <el-col :span="6">发货商品{{ index + 1 }}</el-col>
+                <el-col :span="18" class="other">{{ item.goods_name }}</el-col>
+              </el-col>
+              <el-col :span="24" class="bode">
+                <el-col :span="6">发货数量</el-col>
+                <el-col :span="18" class="other">{{ item.num }}</el-col>
+              </el-col>
+              <el-col :span="24" class="bode">
+                <el-col :span="6">寄出运单号</el-col>
+                <el-col :span="18" class="other">{{ item.shop_transport_no || '暂无单号' }}</el-col>
+              </el-col>
+              <el-col :span="24" class="bode">
+                <el-col :span="6">寄出快递公司</el-col>
+                <el-col :span="18" class="other">{{ item.shop_transport_name || '暂无快递信息' }}</el-col>
+              </el-col>
+              <el-col :span="24" style="text-align: center">
+                <el-button type="danger" @click="toDel(item)"> 删除 </el-button>
+              </el-col>
+            </el-col>
+          </el-col>
+          <el-col v-if="form.status == '1' || form.status == '2-'">
+            <el-button type="primary" @click="onstatus('0')"> 全部发货 </el-button>
+            <el-button type="primary" @click="onstatus('1')"> 部分发货 </el-button>
+          </el-col>
+          <el-col :span="24" class="form" v-if="form.status == '1' || form.status == '2' || form.status == '2-'">
             <el-form :model="form" ref="form" :rules="rules" label-width="100px" class="demo-ruleForm">
+              <el-form-item label="发货商品" prop="goods_name" v-if="status == '1' && form.transport_type == '0'">
+                <el-select v-model="form.goods_name" clearable filterable placeholder="请选择发货商品" size="small" style="width: 100%" @change="goodsChange">
+                  <el-option v-for="i in list" :key="i._id" :label="getName(i)" :value="i._id"> </el-option>
+                </el-select>
+                <p>
+                  <span style="color: red">用于部分发货 </span>
+                </p>
+              </el-form-item>
+              <el-form-item label="发货商品数量" prop="num" v-if="status == '1' && form.transport_type == '0'">
+                <el-input v-model="form.num" placeholder="请输入发货商品数量" size="small" @input="toNum"></el-input>
+                <p>
+                  用于部分发货:发货最大数量不得超过购买商品最大数量 <span style="color: red"> {{ buy_num }}</span>
+                </p>
+              </el-form-item>
               <el-form-item label="寄出运单号" prop="shop_transport_no" v-if="form.transport_type == '0'">
                 <el-input v-model="form.shop_transport_no" placeholder="请输入运单号,快递公司,同时填入" size="small"></el-input>
               </el-form-item>
@@ -129,7 +170,12 @@
               </el-form-item>
               <el-form-item>
                 <el-col>
-                  <el-button type="primary" @click="onSubmit('form', '2')" v-if="form.status == '1'"> 发货 </el-button>
+                  <el-button type="primary" @click="onSubmit('form', '2')" v-if="(form.status == '1' || form.status == '2-') && status == '0'">
+                    保存
+                  </el-button>
+                  <el-button type="primary" @click="onSubmit('form', '2-')" v-if="(form.status == '1' || form.status == '2-') && status == '1'">
+                    添加保存
+                  </el-button>
                   <el-button type="primary" @click="onSubmit('form', '3')" v-if="form.status == '2'"> 确认收货 </el-button>
                   <el-button type="primary" @click="onSubmit('form', '2')" v-if="form.status == '2'"> 保存 </el-button>
                 </el-col>
@@ -181,7 +227,7 @@ export default {
       // 商铺
       shop: {},
       // 运单号
-      transport: {},
+      transport: [],
       pay: {},
       // 商品列表
       list: [],
@@ -202,6 +248,8 @@ export default {
         transport_type: [{ required: true, message: '请选择快递类型', trigger: 'change' }],
       },
       loadings: true,
+      buy_num: '',
+      status: '0',
     };
   },
   async created() {
@@ -218,6 +266,8 @@ export default {
       let res;
       res = await this.fetch(this.id);
       if (this.$checkRes(res)) {
+        let name = this.transport_typeList.find((i) => i.value == res.data.transport_type);
+        if (name) res.data.transport_type_name = name.label;
         this.$set(this, `form`, res.data);
         if (res.data.transport == undefined) this.$set(this.form, `transport_type`, '0');
         // 地址
@@ -228,25 +278,28 @@ export default {
         // 应付金额
         this.$set(this, `total_detail`, res.data.total_detail);
         this.$set(this, `pay`, res.data.order.pay);
-        if (res.data.transport) {
-          let arr = await this.dictQuery({ code: 'transport_company', value: res.data.transport.shop_transport_type });
-          if (this.$checkRes(arr)) {
-            let type = arr.data.find((i) => i.value == res.data.transport.shop_transport_type);
-            if (type) {
-              res.data.transport.shop_transport_name = type.label;
-              this.querySearch(type.label);
+        if (res.data.transport != undefined) {
+          for (const p1 of res.data.transport) {
+            let goods = this.form.goods.find((i) => i.id == p1.goods);
+            if (goods) p1.goods_name = goods.goods.name + ',' + goods.name;
+            // p1.good = p1.goods;
+            let arr = await this.dictQuery({ code: 'transport_company', value: p1.shop_transport_type });
+            if (this.$checkRes(arr)) {
+              let type = arr.data.find((i) => i.value == p1.shop_transport_type);
+              if (type) {
+                p1.shop_transport_name = type.label;
+                this.querySearch(type.label);
+              }
             }
-            this.$set(this, `transport`, res.data.transport);
-            this.$set(this.form, `shop_transport_type`, this.transport.shop_transport_type);
-            if (this.transport.transport_type == undefined) this.$set(this.form, `transport_type`, '0');
-            else this.$set(this.form, `transport_type`, this.transport.transport_type);
-            this.$set(this.form, `shop_transport_no`, this.transport.shop_transport_no);
+            // p1.shop_transport_type = this.transport.shop_transport_type;
+            // p1.shop_transport_no = this.transport.shop_transport_no;
           }
+          this.$set(this, `transport`, res.data.transport);
           res = await this.sotFetch(this.id);
           if (this.$checkRes(res)) {
             if (res.errcode == '0') {
               let activities = res.data.list;
-              activities[0].color = '#0bbd87';
+              // activities[0].color = '#0bbd87';
               this.$set(this, `activities`, activities);
               this.$set(this, `activit`, res.data);
             }
@@ -270,55 +323,87 @@ export default {
         this.$message.error('该商品还未添加来源网址,无法跳转');
       }
     },
+    onstatus(status) {
+      this.status = status;
+    },
     handleSelect(value) {},
+    // 选择商品
+    goodsChange(value) {
+      let name = this.form.goods.find((i) => i.id == value);
+      this.$set(this, `buy_num`, name.buy_num);
+    },
+    getName(i) {
+      let name = i.goods.name + ',' + i.name;
+      return name;
+    },
+
+    // 发货最大数量
+    toNum(val) {
+      if (val > this.buy_num) {
+        this.$message.error('超过发货最大数量');
+        this.$set(this.form, `num`, '');
+      }
+    },
+    toDel(data) {
+      this.$confirm('是否确认删除', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      }).then(async () => {
+        let list = this.transport;
+        let form = this.form;
+        let newList = list.filter((i) => i.id != data.id);
+        form.transport = newList;
+        this.$set(this, `transport`, newList);
+        let res;
+        if (form.id) res = await this.update(form);
+        if (this.$checkRes(res)) {
+          this.$message({ type: `success`, message: `维护信息成功` });
+          this.search();
+        }
+      });
+    },
     // 提交
     async onSubmit(formName, val) {
-      var form = this.form;
-      var transport = {};
-      var res;
-      if (form.shop_transport_no != undefined) transport.shop_transport_no = form.shop_transport_no;
-      if (form.shop_transport_type != undefined) transport.shop_transport_type = form.shop_transport_type;
-      if (form.transport_type) transport.transport_type = form.transport_type;
-      form.transport = transport;
-      if (form.shop_transport_no == undefined || form.shop_transport_type == undefined) {
-        this.$refs[formName].validate(async (valid) => {
-          if (valid) {
-            this.$confirm('快递信息未填写完整,是否保存发货', '提示', {
-              confirmButtonText: '确定',
-              cancelButtonText: '取消',
-              type: 'warning',
-            }).then(async () => {
-              if (val != undefined || val != '') form.status = val;
-              if (form.id) res = await this.update(form);
-              if (this.$checkRes(res)) {
-                this.$message({ type: `success`, message: `维护信息成功` });
-                this.search();
+      this.$refs[formName].validate(async (valid) => {
+        if (valid) {
+          this.$confirm('是否确认保存', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning',
+          }).then(async () => {
+            var form = this.form;
+            if (form.transport_type == '0') {
+              var shop_transport_no = form.shop_transport_no;
+              var shop_transport_type = form.shop_transport_type;
+              if (form.transport != undefined && val == '2-') {
+                let goods = form.goods_name;
+                let num = form.num;
+                form.transport.push({ id: moment(new Date()).valueOf(), goods, num, shop_transport_no, shop_transport_type });
+              } else if (form.transport == undefined && val == '2-') {
+                let goods = form.goods_name;
+                let num = form.num;
+                let transport = [];
+                transport.push({ id: moment(new Date()).valueOf(), goods, num, shop_transport_no, shop_transport_type });
+                form.transport = transport;
+              } else if ((val == '2' || val == '3') && form.transport_type == '0') {
+                let transport = [];
+                transport.push({ shop_transport_no, shop_transport_type });
+                form.transport = transport;
               }
-            });
-          } else {
-            return false;
-          }
-        });
-      } else {
-        this.$refs[formName].validate(async (valid) => {
-          if (valid) {
-            this.$confirm('是否确认保存', '提示', {
-              confirmButtonText: '确定',
-              cancelButtonText: '取消',
-              type: 'warning',
-            }).then(async () => {
-              if (val != undefined || val != '') form.status = val;
-              if (form.id) res = await this.update(form);
-              if (this.$checkRes(res)) {
-                this.$message({ type: `success`, message: `维护信息成功` });
-                this.search();
-              }
-            });
-          } else {
-            return false;
-          }
-        });
-      }
+            }
+            var res;
+            if (val != undefined || val != '') form.status = val;
+            if (form.id) res = await this.update(form);
+            if (this.$checkRes(res)) {
+              this.$message({ type: `success`, message: `维护信息成功` });
+              this.search();
+            }
+          });
+        } else {
+          return false;
+        }
+      });
     },
 
     // 返回
@@ -357,7 +442,7 @@ export default {
 <style lang="less" scoped>
 .main {
   .one {
-    margin: 10px 0 0 5%;
+    margin: 10px 0 0 2%;
     padding: 5px;
     .add {
       border-bottom: 2px dashed #ccc;
@@ -375,6 +460,12 @@ export default {
         text-align: right;
       }
     }
+    .transport {
+      margin: 50px;
+      padding: 5px;
+      // margin: 0 0 0 40px;
+      border: 1px solid rgb(254, 195, 195);
+    }
     .other {
       text-align: right;
       word-break: break-all;

+ 170 - 0
src/views/selfShop/order/parts/detail/detail_orderDetail.vue

@@ -0,0 +1,170 @@
+<template>
+  <div id="form-1">
+    <el-row>
+      <el-col :span="24" class="top-btn">
+        <el-button type="primary" size="mini" @click="toBack()">返回</el-button>
+      </el-col>
+      <el-col
+        :span="24"
+        class="main animate__animated animate__backInRight"
+        v-loading="loadings"
+        element-loading-text="拼命加载中"
+        element-loading-spinner="el-icon-loading"
+      >
+        <el-tabs type="border-card">
+          <el-tab-pane label="订单详情">
+            <card-1 :address="address" :list="list" :pay="pay" :form="form" :total_detail="total_detail" :shop="shop"></card-1>
+          </el-tab-pane>
+          <el-tab-pane label="发货信息">
+            <card-2
+              :transport="transport"
+              :list="list"
+              :address="address"
+              :form="form"
+              :activities="activities"
+              :shop_transport_typeList="shop_transport_typeList"
+              :transport_typeList="transport_typeList"
+              @querySearch="querySearch"
+            ></card-2>
+          </el-tab-pane>
+        </el-tabs>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+const moment = require('moment');
+import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('orderDetail');
+const { mapActions: dictData } = createNamespacedHelpers('dictData');
+const { mapActions: sot } = createNamespacedHelpers('sot');
+
+export default {
+  name: 'form-1',
+  props: { id: { type: String } },
+  components: {
+    card1: () => import('./parts/card-1.vue'),
+    card2: () => import('./parts/card-2.vue'),
+  },
+  data: function () {
+    return {
+      loadings: true,
+      form: {},
+      // 地址
+      address: {},
+      // 实付金额
+      total_detail: {},
+      // 商铺
+      shop: {},
+      // 运单号
+      transport: [],
+      pay: {},
+      // 商品列表
+      list: [],
+      activities: [],
+      // 订单状态
+      order_processList: [],
+      // 快递公司
+      shop_transport_typeList: [],
+      // 快递类型
+      transport_typeList: [],
+    };
+  },
+  async created() {
+    await this.searchOther();
+    await this.search();
+  },
+  methods: {
+    ...dictData({ dictQuery: 'query' }),
+    ...sot({ sotCreate: 'create' }),
+    ...mapActions(['query', 'fetch', 'create', 'update']),
+    // 查询
+    async search() {
+      let res;
+      res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        let name = this.transport_typeList.find((i) => i.value == res.data.transport_type);
+        if (name) res.data.transport_type_name = name.label;
+        this.$set(this, `form`, res.data);
+        if (res.data.transport == undefined) this.$set(this.form, `transport_type`, '0');
+        // 地址
+        this.$set(this, `address`, res.data.address);
+        this.$set(this, `shop`, res.data.shop);
+        // 商品
+        this.$set(this, `list`, res.data.goods);
+        // 应付金额
+        this.$set(this, `total_detail`, res.data.total_detail);
+        this.$set(this, `pay`, res.data.order.pay);
+        if (res.data.transport != undefined) {
+          for (const p1 of res.data.transport) {
+            for (const p2 of p1.goods) {
+              let goods = this.form.goods.find((i) => i.id == p2.goods_id);
+              if (goods) p2.goods_name = goods.goods.name + ',' + goods.name;
+            }
+            let arr = await this.dictQuery({ code: 'transport_company', value: p1.shop_transport_type });
+            if (this.$checkRes(arr)) {
+              let type = arr.data.find((i) => i.value == p1.shop_transport_type);
+              if (type) {
+                p1.shop_transport_name = type.label;
+                this.querySearch(type.label);
+              }
+            }
+          }
+          this.$set(this, `transport`, res.data.transport);
+          let info = { id: this.id };
+          res = await this.sotCreate(info);
+          if (this.$checkRes(res)) {
+            if (res.errcode == '0') {
+              this.$set(this, `activities`, res.data);
+            }
+          }
+        }
+      }
+      this.loadings = false;
+    },
+    async querySearch(value) {
+      let res = await this.dictQuery({ code: 'transport_company', label: value });
+      if (this.$checkRes(res)) {
+        this.$set(this, 'shop_transport_typeList', res.data);
+      }
+    },
+    // 返回
+    toBack() {
+      this.$emit('toBack');
+    },
+    // 查询其他信息
+    async searchOther() {
+      let res;
+      // 减免方式
+      res = await this.dictQuery({ code: 'order_process' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `order_processList`, res.data);
+      }
+      // 快递类型
+      res = await this.dictQuery({ code: 'transport_type' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `transport_typeList`, res.data);
+      }
+    },
+  },
+  computed: {},
+  metaform() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.top-btn {
+  margin: 20px 0;
+}
+</style>

src/views/selfShop/order/detail_sales_order.vue → src/views/selfShop/order/parts/detail/detail_sales_order.vue


+ 1 - 1
src/views/platmanag/order/detail_sales_orderDetail.vue

@@ -104,7 +104,7 @@
         </el-col>
         <el-col :span="9" class="one">
           <el-button type="danger" @click="toSales('1')" v-if="this.status == '1'"> 取消订单 </el-button>
-          <el-button type="danger" @click="toSales('2')" v-if="this.status == '2'"> 拒收 </el-button>
+          <el-button type="danger" @click="toSales('2')" v-if="this.status == '2' || this.status == '2-'"> 拒收 </el-button>
           <el-col v-if="this.status == '3'">
             <el-form :model="form" :rules="rules" ref="form" label-width="180px">
               <el-col :span="24">

+ 194 - 0
src/views/selfShop/order/parts/detail/parts/card-1.vue

@@ -0,0 +1,194 @@
+<template>
+  <div id="card-1">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="add">
+          <el-col :span="2">
+            <i class="el-icon-location"></i>
+          </el-col>
+          <el-col :span="22">
+            <el-col>
+              <p>{{ address.name }},{{ address.phone }}</p>
+            </el-col>
+            <el-col>
+              <p>{{ address.province }} , {{ address.city }} , {{ address.area }} , {{ address.address }}</p>
+            </el-col>
+          </el-col>
+        </el-col>
+        <el-col :span="24" class="shop"> <i class="el-icon-s-shop"></i>{{ shop.name }}</el-col>
+        <el-col :span="24" v-for="(item, index) in list" :key="index">
+          <el-col :span="24" class="goods bode">
+            <el-col :span="6"><el-image :src="item.goods.file[0].url"></el-image></el-col>
+            <el-col :span="18">
+              <el-col :span="12">
+                <el-col>
+                  <p>{{ item.goods.name }}</p>
+                </el-col>
+                <el-col>
+                  <p>规格:{{ item.name }}</p>
+                </el-col>
+              </el-col>
+              <el-col :span="12" class="money">
+                <el-col>
+                  <p v-if="form.type == '0'">¥{{ item.sell_money }}</p>
+                  <p v-else-if="form.type == '1'">¥{{ item.group_config.money }}</p>
+                </el-col>
+                <el-col>
+                  <p>X{{ item.buy_num }}</p>
+                </el-col>
+                <el-col>
+                  <span class="spanfour" style="color: blue" @click="toUrl(item.goods.url)"> 查看商品来源:{{ item.goods.source }}</span>
+                </el-col>
+                <el-col>
+                  <p>{{ item.is_afterSale == true ? '已申请售后' : '未申请售后' }}</p>
+                </el-col>
+                <el-col>
+                  <p>{{ item.is_rate == true ? '已评价' : '未评价' }}</p>
+                </el-col>
+              </el-col>
+            </el-col>
+          </el-col>
+          <el-col :span="24" class="bode">
+            <el-col :span="6">运费</el-col>
+            <el-col :span="18" class="other" v-if="!item.goods.freight == '0'">{{ item.goods.freight }}</el-col>
+            <el-col :span="18" class="other" v-else>包邮</el-col>
+          </el-col>
+        </el-col>
+        <el-col :span="24" class="bode">
+          <el-col :span="6">订单备注</el-col>
+          <el-col :span="18" class="other" v-if="form.remarks">{{ form.remarks }}</el-col>
+          <el-col :span="18" class="other" v-else>暂无备注</el-col>
+        </el-col>
+        <el-col :span="24" class="bode">
+          <el-col :span="6">配送方式</el-col>
+          <el-col :span="18" class="other">{{ form.transport_type_name }}</el-col>
+        </el-col>
+        <el-col :span="24" class="goods_total bode">
+          <el-col :span="6">快递费</el-col>
+          <el-col :span="18" class="other">
+            <p>¥{{ total_detail.freight_total }}</p>
+          </el-col>
+        </el-col>
+        <el-col :span="24" class="goods_total bode">
+          <el-col :span="8">优惠后实付金额</el-col>
+          <el-col :span="16" class="other">
+            <p>¥{{ pay.pay_money }}</p>
+          </el-col>
+        </el-col>
+        <el-col :span="24" class="bode">
+          <el-col :span="6">下单时间</el-col>
+          <el-col :span="18" class="other">{{ form.buy_time }}</el-col>
+        </el-col>
+        <el-col :span="24" class="bode">
+          <el-col :span="6">支付时间</el-col>
+          <el-col :span="18" class="other">{{ form.pay_time }}</el-col>
+        </el-col>
+        <!-- <el-col :span="24" class="bode" v-if="form.status == '3'">
+          <el-col :span="6">寄出运单号</el-col>
+          <el-col :span="18" class="other">{{ transport.shop_transport_no || '暂无单号' }}</el-col>
+        </el-col>
+        <el-col :span="24" class="bode" v-if="form.status == '3'">
+          <el-col :span="6">寄出快递公司</el-col>
+          <el-col :span="18" class="other">{{ transport.shop_transport_name || '暂无快递信息' }}</el-col>
+        </el-col> -->
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'card-1',
+  props: {
+    address: { type: Object },
+    list: { type: Array },
+    pay: { type: Object },
+    form: { type: Object },
+    total_detail: { type: Object },
+    shop: { type: Object },
+  },
+  components: {},
+  data: function () {
+    return {};
+  },
+  created() {},
+  methods: {
+    toUrl(url) {
+      if (url) {
+        window.open(url, '_blank');
+      } else {
+        this.$message.error('该商品还未添加来源网址,无法跳转');
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  padding: 0 25%;
+  .add {
+    border-bottom: 2px dashed #ccc;
+    margin: 0 0 5px 0;
+    padding: 5px 0;
+  }
+  .shop {
+    padding: 4px 0;
+    font-size: 18px;
+    border-bottom: 1px solid #ccc;
+  }
+  .goods {
+    padding: 10px 0;
+    .money {
+      text-align: right;
+    }
+  }
+  .transport {
+    margin: 50px;
+    padding: 5px;
+    // margin: 0 0 0 40px;
+    border: 1px solid rgb(254, 195, 195);
+  }
+  .other {
+    text-align: right;
+    word-break: break-all;
+    p {
+      color: red;
+    }
+    .spanfour {
+      color: blue;
+    }
+  }
+  .el-col {
+    margin: 3px 0;
+  }
+  .bode {
+    border-bottom: 1px solid rgb(238, 237, 237);
+  }
+  .form {
+    margin: 20px 0 0 0;
+  }
+}
+
+/deep/.el-timeline {
+  margin: 20px 0 0 0;
+  font-size: 16px;
+}
+/deep/.el-timeline-item__node:nth-child(1) {
+  background-color: green;
+}
+</style>

+ 388 - 0
src/views/selfShop/order/parts/detail/parts/card-2.vue

@@ -0,0 +1,388 @@
+<template>
+  <div id="card-2">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="9" class="one">
+          <el-col :span="24">
+            <el-col v-for="(item, index) in transport" :key="index" class="transport">
+              <el-col v-for="(good, index) in item.goods" :key="index">
+                <el-col :span="24" class="bode">
+                  <el-col :span="6">发货商品{{ index + 1 }}</el-col>
+                  <el-col :span="18" class="other">{{ good.goods_name }}</el-col>
+                </el-col>
+                <el-col :span="24" class="bode">
+                  <el-col :span="6">发货数量</el-col>
+                  <el-col :span="18" class="other">{{ good.num }}</el-col>
+                </el-col>
+              </el-col>
+              <el-col :span="24" class="bode">
+                <el-col :span="6">寄出运单号</el-col>
+                <el-col :span="18" class="other">{{ item.shop_transport_no || '暂无单号' }}</el-col>
+              </el-col>
+              <el-col :span="24" class="bode">
+                <el-col :span="6">寄出快递公司</el-col>
+                <el-col :span="18" class="other">{{ item.shop_transport_name || '暂无快递信息' }}</el-col>
+              </el-col>
+              <el-col :span="24" style="text-align: center">
+                <el-button type="danger" @click="toDel(item)"> 删除 </el-button>
+                <el-button type="primary" @click="toLog(item)"> 查看物流 </el-button>
+              </el-col>
+            </el-col>
+          </el-col>
+          <el-col v-if="form.status == '1' || form.status == '2-'">
+            <el-button type="primary" @click="onstatus('0')"> 全部发货 </el-button>
+            <el-button type="primary" @click="onstatus('1')"> 部分发货 </el-button>
+          </el-col>
+          <el-col :span="24" v-if="status == '1' && form.transport_type == '0'">
+            <el-col>发货商品</el-col>
+            <el-col :span="24" style="margin: 0 0 10px 0">
+              <el-button type="primary" size="mini" @click="toAdd()">添加</el-button>
+            </el-col>
+            <data-table :usePage="false" :fields="fieldsList" :opera="opera" :data="goodsList" @edit="toEdit" @del="toDelete"> </data-table>
+          </el-col>
+          <el-col :span="24" class="form" v-if="form.status == '1' || form.status == '2' || form.status == '2-'">
+            <el-form :model="form" ref="form" :rules="rules" label-width="100px" class="demo-ruleForm">
+              <el-form-item label="寄出运单号" prop="shop_transport_no" v-if="form.transport_type == '0'">
+                <el-input v-model="form.shop_transport_no" placeholder="请输入运单号,快递公司,同时填入" size="small"></el-input>
+              </el-form-item>
+              <el-form-item label="快递公司" prop="shop_transport_type" v-if="form.transport_type == '0'">
+                <el-select
+                  v-model="form.shop_transport_type"
+                  filterable
+                  remote
+                  reserve-keyword
+                  placeholder="请选择快递公司,运单号,同时填入"
+                  :remote-method="querySearch"
+                  :loading="loading"
+                  @change="handleSelect"
+                  size="small"
+                  style="width: 100%"
+                >
+                  <el-option v-for="item in shop_transport_typeList" :key="item.id" :label="item.label" :value="item.value"> </el-option>
+                </el-select>
+              </el-form-item>
+              <el-form-item label="快递类型" prop="transport_type">
+                <el-select v-model="form.transport_type" clearable filterable placeholder="请选择快递类型" size="small" style="width: 100%">
+                  <el-option v-for="i in transport_typeList" :key="i.label" :label="i.label" :value="i.value"> </el-option>
+                </el-select>
+              </el-form-item>
+              <el-form-item>
+                <el-col>
+                  <el-button type="primary" @click="onSubmit('form', '2')" v-if="(form.status == '1' || form.status == '2-') && status == '0'">
+                    保存
+                  </el-button>
+                  <el-button type="primary" @click="onSubmit('form', '2-')" v-if="(form.status == '1' || form.status == '2-') && status == '1'">
+                    添加保存
+                  </el-button>
+                  <el-button type="primary" @click="onSubmit('form', '3')" v-if="form.status == '2'"> 确认收货 </el-button>
+                  <el-button type="primary" @click="onSubmit('form', '2')" v-if="form.status == '2'"> 保存 </el-button>
+                </el-col>
+              </el-form-item>
+            </el-form>
+          </el-col>
+        </el-col>
+        <el-col :span="9" class="one">
+          <el-col :span="24">{{ activit.is_check || '暂无快递信息' }}</el-col>
+          <el-col :span="24">{{ transport.shop_transport_name || '暂无快递信息' }}: {{ activit.no || '暂无快递信息' }}</el-col>
+          <el-col :span="24">
+            <p>订单编号: {{ form.id }}</p>
+          </el-col>
+          <el-col :span="24">
+            <p>收货地址:{{ address.province }} , {{ address.city }} , {{ address.area }} , {{ address.address }}</p>
+          </el-col>
+          <el-col :span="24">
+            <el-timeline :reverse="reverse">
+              <el-timeline-item v-for="(activity, index) in logList" :key="index" :timestamp="activity.time" :color="activity.color">
+                {{ activity.context }}
+              </el-timeline-item>
+            </el-timeline>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+    <e-dialog :dialog="dialog" @toClose="toClose">
+      <template v-slot:info>
+        <el-form :model="fieldform" ref="fieldform" label-width="100px" class="demo-ruleForm">
+          <el-form-item label="发货商品" prop="goods_name" v-if="status == '1' && form.transport_type == '0'">
+            <el-select v-model="fieldform.goods_id" clearable filterable placeholder="请选择发货商品" size="small" style="width: 100%" @change="goodsChange">
+              <el-option v-for="i in list" :key="i._id" :label="getName(i)" :value="i._id"> </el-option>
+            </el-select>
+            <p>
+              <span style="color: red">用于部分发货 </span>
+            </p>
+          </el-form-item>
+          <el-form-item label="发货商品数量" prop="num" v-if="status == '1' && form.transport_type == '0'">
+            <el-input v-model="fieldform.num" placeholder="请输入发货商品数量" size="small" @input="toNum"></el-input>
+            <p>
+              用于部分发货:发货最大数量不得超过购买商品最大数量 <span style="color: red"> {{ buy_num }}</span>
+            </p>
+          </el-form-item>
+          <el-form-item>
+            <el-col>
+              <el-button type="primary" @click="toSave()"> 保存 </el-button>
+            </el-col>
+          </el-form-item>
+        </el-form>
+      </template>
+    </e-dialog>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('orderDetail');
+export default {
+  name: 'card-2',
+  props: {
+    transport: { type: Array },
+    list: { type: Array },
+    shop_transport_typeList: { type: Array },
+    activities: { type: Array },
+    transport_typeList: { type: Array },
+    form: { type: Object },
+    address: { type: Object },
+  },
+  components: {},
+  data: function () {
+    return {
+      activit: {},
+      logList: [],
+      status: '0',
+      // 物流
+      reverse: false,
+      loading: false,
+      rules: {
+        shop_transport_no: [{ required: true, message: '请输入快递单号', trigger: 'blur' }],
+        shop_transport_type: [{ required: true, message: '请选择快递公司', trigger: 'change' }],
+        transport_type: [{ required: true, message: '请选择快递类型', trigger: 'change' }],
+      },
+      listForm: {},
+      buy_num: '',
+      // status: '0',
+      // 商品
+      goodsList: [],
+      // 添加发货商品表单
+      fieldform: {},
+      // 底部菜单
+      opera: [
+        { label: '修改', method: 'edit' },
+        { label: '删除', method: 'del', confirm: true, type: 'danger' },
+      ],
+      fieldsList: [
+        { label: '商品名称', model: 'goods_id', format: (i) => this.getNames(i) },
+        { label: '发货数量', model: 'num' },
+      ],
+      // 弹框
+      dialog: { title: '信息管理', show: false, type: '1' },
+    };
+  },
+  created() {},
+  methods: {
+    ...mapActions(['query', 'fetch', 'create', 'update']),
+    // 远程查询
+    async querySearch(value) {
+      this.loading = true;
+      this.$emit('querySearch', value);
+      this.loading = false;
+    },
+    handleSelect(value) {},
+    // 添加
+    async toAdd() {
+      this.dialog = { title: '信息管理', show: true, type: '1' };
+    },
+    // 关闭
+    toClose() {
+      this.fieldform = {};
+      this.dialog = { title: '信息管理', show: false, type: '1' };
+    },
+    // 修改
+    toEdit(index, data) {
+      this.$set(this, `fieldform`, index.data);
+      this.dialog = { title: '信息管理', show: true, type: '1' };
+    },
+    // 添加发货商品提交
+    toSave() {
+      let data = this.fieldform;
+      data.id = moment(new Date()).valueOf();
+      let info = this.goodsList.find((f) => f.id == data.id);
+      if (info == '' || info == undefined) {
+        this.goodsList.push(data);
+      }
+      this.toClose();
+    },
+    // 删除
+    toDelete({ data }) {
+      let newList = this.goodsList.filter((i) => i.id != data.id);
+      this.$set(this, `goodsList`, newList);
+    },
+    onstatus(status) {
+      this.status = status;
+    },
+    // 选择商品
+    goodsChange(value) {
+      let name = this.form.goods.find((i) => i.id == value);
+      this.$set(this, `buy_num`, name.buy_num);
+    },
+    getName(i) {
+      let name = i.name + ',' + i.goods.name;
+      return name;
+    },
+    getNames(val) {
+      let goods = this.form.goods.find((i) => i.id == val);
+      let name = goods.name + ',' + goods.goods.name;
+      return name;
+    },
+    // 查看物流
+    toLog(value) {
+      let info = this.activities.find((f) => f.no == value.shop_transport_no);
+      if (info) {
+        info.list[0].color = '#0bbd87';
+        this.$set(this, `logList`, info.list);
+        this.$set(this, `activit`, info);
+      }
+    },
+
+    // 发货最大数量
+    toNum(val) {
+      if (val > this.buy_num) {
+        this.$message.error('超过发货最大数量');
+        this.$set(this.form, `num`, '');
+      }
+    },
+    toDel(data) {
+      this.$confirm('是否确认删除', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      }).then(async () => {
+        let list = this.transport;
+        let form = this.form;
+        let newList = list.filter((i) => i.id != data.id);
+        form.transport = newList;
+        this.$set(this, `transport`, newList);
+        let res;
+        if (form.id) res = await this.update(form);
+        if (this.$checkRes(res)) {
+          this.$message({ type: `success`, message: `维护信息成功` });
+          this.search();
+        }
+      });
+    },
+    // 提交
+    async onSubmit(formName, val) {
+      this.$refs[formName].validate(async (valid) => {
+        if (valid) {
+          this.$confirm('是否确认保存', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning',
+          }).then(async () => {
+            var form = this.form;
+            if (form.transport_type == '0') {
+              var shop_transport_no = form.shop_transport_no;
+              var shop_transport_type = form.shop_transport_type;
+              if (form.transport != undefined && val == '2-') {
+                let goods = this.goodsList;
+                // let num = form.num;
+                form.transport.push({ id: moment(new Date()).valueOf(), goods, shop_transport_no, shop_transport_type });
+              } else if (form.transport == undefined && val == '2-') {
+                let goods = this.goodsList;
+                // let num = form.num;
+                let transport = [];
+                transport.push({ id: moment(new Date()).valueOf(), goods, shop_transport_no, shop_transport_type });
+                form.transport = transport;
+              } else if ((val == '2' || val == '3') && form.transport_type == '0') {
+                let transport = [];
+                transport.push({ shop_transport_no, shop_transport_type });
+                form.transport = transport;
+              }
+            }
+            // console.log(form);
+            var res;
+            if (val != undefined || val != '') form.status = val;
+            if (form.id) res = await this.update(form);
+            if (this.$checkRes(res)) {
+              this.$message({ type: `success`, message: `维护信息成功` });
+              this.goodsList = [];
+              this.search();
+            }
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .one {
+    margin: 10px 0 0 2%;
+    padding: 5px;
+    .add {
+      border-bottom: 2px dashed #ccc;
+      margin: 0 0 5px 0;
+      padding: 5px 0;
+    }
+    .shop {
+      padding: 4px 0;
+      font-size: 18px;
+      border-bottom: 1px solid #ccc;
+    }
+    .goods {
+      padding: 10px 0;
+      .money {
+        text-align: right;
+      }
+    }
+    .transport {
+      margin: 50px;
+      padding: 5px;
+      // margin: 0 0 0 40px;
+      border: 1px solid rgb(254, 195, 195);
+    }
+    .other {
+      text-align: right;
+      word-break: break-all;
+      p {
+        color: red;
+      }
+      .spanfour {
+        color: blue;
+      }
+    }
+    .el-col {
+      margin: 3px 0;
+    }
+    .bode {
+      border-bottom: 1px solid rgb(238, 237, 237);
+    }
+    .form {
+      margin: 20px 0 0 0;
+    }
+  }
+}
+
+/deep/.el-timeline {
+  margin: 20px 0 0 0;
+  font-size: 16px;
+}
+/deep/.el-timeline-item__node:nth-child(1) {
+  background-color: green;
+}
+</style>