Browse Source

修改详情

YY 2 years ago
parent
commit
c6df140a0b

+ 54 - 32
src/views/selfShop/order/detail_order.vue

@@ -15,17 +15,31 @@
               <p>{{ address.province }} , {{ address.city }} , {{ address.area }} , {{ address.address }}</p>
               <p>{{ address.province }} , {{ address.city }} , {{ address.area }} , {{ address.address }}</p>
             </el-col>
             </el-col>
           </el-col>
           </el-col>
-          <el-col :span="24" class="shop"> <i class="el-icon-s-shop"></i>{{ shop.shop_name }}</el-col>
-          <el-col :span="24" class="goods">
-            <el-col :span="6"><el-image :src="file"></el-image></el-col>
-            <el-col :span="18">
-              <el-col :span="12">
-                <p>{{ goods_goods.name }}</p>
-                <p>规格:{{ goods.name }}</p>
+          <el-col :span="24" v-for="(item, index) in list" :key="index">
+            <el-col :span="24" class="shop"> <i class="el-icon-s-shop"></i>{{ item.shop_name }}</el-col>
+            <el-col :span="24" v-for="(goods, index) in item.goods" :key="index">
+              <el-col :span="24" class="goods">
+                <el-col :span="6"><el-image :src="goods.goods.file[0].url"></el-image></el-col>
+                <el-col :span="18">
+                  <el-col :span="12">
+                    <p>{{ goods.goods.name }}</p>
+                    <p>规格:{{ goods.name }}</p>
+                  </el-col>
+                  <el-col :span="12" class="money">
+                    <p>¥{{ goods.sell_money }}</p>
+                    <p>X{{ goods.buy_num }}</p>
+                  </el-col>
+                </el-col>
               </el-col>
               </el-col>
-              <el-col :span="12" class="money">
-                <p>¥{{ goods.sell_money }}</p>
-                <p>X{{ goods.buy_num }}</p>
+              <el-col :span="24">
+                <el-col :span="6">运费</el-col>
+                <el-col :span="18" class="other" v-if="!item.freight_total == '0'">{{ item.freight_total }}</el-col>
+                <el-col :span="18" class="other" v-else>包邮</el-col>
+              </el-col>
+              <el-col :span="24">
+                <el-col :span="6">订单备注</el-col>
+                <el-col :span="18" class="other" v-if="item.goods.remarks">{{ item.goods.remarks }}</el-col>
+                <el-col :span="18" class="other" v-else>暂无备注</el-col>
               </el-col>
               </el-col>
             </el-col>
             </el-col>
           </el-col>
           </el-col>
@@ -33,22 +47,21 @@
             <el-col :span="6">配送方式</el-col>
             <el-col :span="6">配送方式</el-col>
             <el-col :span="18" class="other">快递配送</el-col>
             <el-col :span="18" class="other">快递配送</el-col>
           </el-col>
           </el-col>
-          <el-col :span="24">
-            <el-col :span="6">运费</el-col>
-            <el-col :span="18" class="other" v-if="!goods.freight_total == '0'">{{ goods.freight_total }}</el-col>
-            <el-col :span="18" class="other" v-else>包邮</el-col>
-          </el-col>
-          <el-col :span="24">
-            <el-col :span="6">订单备注</el-col>
-            <el-col :span="18" class="other" v-if="goods_goods.remarks">{{ goods_goods.remarks }}</el-col>
-            <el-col :span="18" class="other" v-else>选填,可填写您与卖家达成一致的要求</el-col>
-          </el-col>
           <el-col :span="24" class="goods_total">
           <el-col :span="24" class="goods_total">
-            <el-col :span="6">付金额</el-col>
+            <el-col :span="6">应付金额</el-col>
             <el-col :span="18" class="other">
             <el-col :span="18" class="other">
-              <p>¥{{ total_detail.goods_total }}</p>
+              <p v-if="total_detail.discount_detail">¥{{ goods_total }}</p>
+              <p v-else>¥{{ total_detail.goods_total }}</p>
             </el-col>
             </el-col>
           </el-col>
           </el-col>
+          <el-col :span="24">
+            <el-col :span="6">下单时间</el-col>
+            <el-col :span="18" class="other">{{ info.buy_time }}</el-col>
+          </el-col>
+          <el-col :span="24">
+            <el-col :span="6">支付时间</el-col>
+            <el-col :span="18" class="other">{{ info.pay_time || '未支付' }}</el-col>
+          </el-col>
         </el-col>
         </el-col>
       </el-col>
       </el-col>
     </el-row>
     </el-row>
@@ -66,12 +79,10 @@ export default {
   components: {},
   components: {},
   data: function () {
   data: function () {
     return {
     return {
-      form: {},
+      info: {},
       address: {},
       address: {},
-      shop: {},
-      goods: {},
-      goods_goods: {},
-      file: '',
+      goods_total: 0,
+      list: [],
       total_detail: {},
       total_detail: {},
       typeList: [],
       typeList: [],
       statusList: [],
       statusList: [],
@@ -86,16 +97,27 @@ export default {
     async search() {
     async search() {
       let res = await this.fetch(this.id);
       let res = await this.fetch(this.id);
       if (this.$checkRes(res)) {
       if (this.$checkRes(res)) {
+        this.$set(this, `info`, res.data);
         // 地址
         // 地址
         this.$set(this, `address`, res.data.address);
         this.$set(this, `address`, res.data.address);
-        // 店铺
-        this.$set(this, `shop`, res.data.goods[0]);
         // 商品
         // 商品
-        this.$set(this, `goods`, res.data.goods[0].goods[0]);
-        this.$set(this, `goods_goods`, res.data.goods[0].goods[0].goods);
-        this.$set(this, `file`, res.data.goods[0].goods[0].goods.file[0].url);
+        this.$set(this, `list`, res.data.goods);
         // 实付金额
         // 实付金额
         this.$set(this, `total_detail`, res.data.total_detail);
         this.$set(this, `total_detail`, res.data.total_detail);
+        var goods_total = 0;
+        let discount_detail = res.data.total_detail.discount_detail;
+        for (const key in discount_detail) {
+          if (Object.hasOwnProperty.call(discount_detail, key)) {
+            const element = discount_detail[key];
+            for (const i in element) {
+              if (Object.hasOwnProperty.call(element, i)) {
+                const ele = element[i].realPay;
+                goods_total += ele;
+              }
+            }
+          }
+        }
+        this.$set(this, `goods_total`, goods_total);
       }
       }
     },
     },
     // 返回
     // 返回

+ 51 - 35
src/views/selfShop/order/detail_orderDetail.vue

@@ -16,39 +16,50 @@
             </el-col>
             </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" class="shop"> <i class="el-icon-s-shop"></i>{{ shop.name }}</el-col>
-          <el-col :span="24" class="goods">
-            <el-col :span="6"><el-image :src="file"></el-image></el-col>
-            <el-col :span="18">
-              <el-col :span="12">
-                <p>{{ goods_goods.name }}</p>
-                <p>规格:{{ goods.name }}</p>
-              </el-col>
-              <el-col :span="12" class="money">
-                <p>¥{{ goods.sell_money }}</p>
-                <p>X{{ goods.buy_num }}</p>
+          <el-col :span="24" v-for="(item, index) in list" :key="index">
+            <el-col :span="24" class="goods">
+              <el-col :span="6"><el-image :src="item.goods.file[0].url"></el-image></el-col>
+              <el-col :span="18">
+                <el-col :span="12">
+                  <p>{{ item.goods.name }}</p>
+                  <p>规格:{{ item.name }}</p>
+                </el-col>
+                <el-col :span="12" class="money">
+                  <p>¥{{ item.sell_money }}</p>
+                  <p>X{{ item.buy_num }}</p>
+                </el-col>
               </el-col>
               </el-col>
             </el-col>
             </el-col>
+            <el-col :span="24">
+              <el-col :span="6">运费</el-col>
+              <el-col :span="18" class="other" v-if="!item.freight_total == '0'">{{ item.freight_total }}</el-col>
+              <el-col :span="18" class="other" v-else>包邮</el-col>
+            </el-col>
+            <el-col :span="24">
+              <el-col :span="6">订单备注</el-col>
+              <el-col :span="18" class="other" v-if="item.goods.remarks">{{ item.goods.remarks }}</el-col>
+              <el-col :span="18" class="other" v-else>暂无备注</el-col>
+            </el-col>
           </el-col>
           </el-col>
           <el-col :span="24">
           <el-col :span="24">
             <el-col :span="6">配送方式</el-col>
             <el-col :span="6">配送方式</el-col>
             <el-col :span="18" class="other">快递配送</el-col>
             <el-col :span="18" class="other">快递配送</el-col>
           </el-col>
           </el-col>
-          <el-col :span="24">
-            <el-col :span="6">运费</el-col>
-            <el-col :span="18" class="other" v-if="!goods.freight_total == '0'">{{ goods.freight_total }}</el-col>
-            <el-col :span="18" class="other" v-else>包邮</el-col>
-          </el-col>
-          <el-col :span="24">
-            <el-col :span="6">订单备注</el-col>
-            <el-col :span="18" class="other" v-if="goods_goods.remarks">{{ goods_goods.remarks }}</el-col>
-            <el-col :span="18" class="other" v-else>选填,可填写您与卖家达成一致的要求</el-col>
-          </el-col>
           <el-col :span="24" class="goods_total">
           <el-col :span="24" class="goods_total">
             <el-col :span="6">实付金额</el-col>
             <el-col :span="6">实付金额</el-col>
             <el-col :span="18" class="other">
             <el-col :span="18" class="other">
-              <p>¥{{ total_detail.goods_total }}</p>
+              <p v-if="total_detail.discount_detail">¥{{ goods_total }}</p>
+              <p v-else>¥{{ total_detail.goods_total }}</p>
             </el-col>
             </el-col>
           </el-col>
           </el-col>
+          <el-col :span="24">
+            <el-col :span="6">下单时间</el-col>
+            <el-col :span="18" class="other">{{ info.buy_time }}</el-col>
+          </el-col>
+          <el-col :span="24">
+            <el-col :span="6">支付时间</el-col>
+            <el-col :span="18" class="other">{{ info.pay_time }}</el-col>
+          </el-col>
         </el-col>
         </el-col>
       </el-col>
       </el-col>
     </el-row>
     </el-row>
@@ -60,20 +71,17 @@ const _ = require('lodash');
 const moment = require('moment');
 const moment = require('moment');
 import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
 import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
 const { mapActions } = createNamespacedHelpers('orderDetail');
 const { mapActions } = createNamespacedHelpers('orderDetail');
-const { mapActions: shop } = createNamespacedHelpers('shop');
-
 export default {
 export default {
   name: 'form-1',
   name: 'form-1',
   props: {},
   props: {},
   components: {},
   components: {},
   data: function () {
   data: function () {
     return {
     return {
-      form: {},
+      info: {},
       address: {},
       address: {},
+      goods_total: 0,
       shop: {},
       shop: {},
-      goods: {},
-      goods_goods: {},
-      file: '',
+      list: [],
       total_detail: {},
       total_detail: {},
       typeList: [],
       typeList: [],
       statusList: [],
       statusList: [],
@@ -84,25 +92,33 @@ export default {
   },
   },
   methods: {
   methods: {
     ...mapActions(['query', 'fetch', 'create', 'update']),
     ...mapActions(['query', 'fetch', 'create', 'update']),
-    ...shop({ shopFetch: 'fetch' }),
     // 查询
     // 查询
     async search() {
     async search() {
       let res;
       let res;
       res = await this.fetch(this.id);
       res = await this.fetch(this.id);
       if (this.$checkRes(res)) {
       if (this.$checkRes(res)) {
+        this.$set(this, `info`, res.data);
         // 地址
         // 地址
         this.$set(this, `address`, res.data.address);
         this.$set(this, `address`, res.data.address);
+        this.$set(this, `shop`, res.data.goods[0]);
         // 商品
         // 商品
-        this.$set(this, `goods`, res.data.goods[0]);
-        this.$set(this, `goods_goods`, res.data.goods[0].goods);
-        this.$set(this, `file`, res.data.goods[0].goods.file[0].url);
+        this.$set(this, `list`, res.data.goods);
         // 实付金额
         // 实付金额
         this.$set(this, `total_detail`, res.data.total_detail);
         this.$set(this, `total_detail`, res.data.total_detail);
-        // 店铺
-        res = await this.shopFetch(res.data.shop);
-        if (this.$checkRes(res)) {
-          this.$set(this, `shop`, res.data);
+        var goods_total = 0;
+        let discount_detail = res.data.total_detail.discount_detail;
+        for (const key in discount_detail) {
+          if (Object.hasOwnProperty.call(discount_detail, key)) {
+            const element = discount_detail[key];
+            for (const i in element) {
+              if (Object.hasOwnProperty.call(element, i)) {
+                const ele = element[i].realPay;
+                goods_total += ele;
+              }
+            }
+          }
         }
         }
+        this.$set(this, `goods_total`, goods_total);
       }
       }
     },
     },
     // 返回
     // 返回