zhangdan 4 年之前
父節點
當前提交
56c408e183
共有 2 個文件被更改,包括 62 次插入48 次删除
  1. 21 15
      src/views/Order/OrderCenter.vue
  2. 41 33
      src/views/Order/OrderDetailModal.vue

+ 21 - 15
src/views/Order/OrderCenter.vue

@@ -65,15 +65,17 @@
       </span>
       </span>
       <!-- 操作 -->
       <!-- 操作 -->
       <span slot="action" slot-scope="text, record">
       <span slot="action" slot-scope="text, record">
-        <a-button type="primary" @click="openDetailsModal=true">查看</a-button>
+        <!-- <a-button type="primary" @click="openDetailModal=true">查看</a-button> -->
+        <a-button type="primary" @click="seeDetail(record)">查看</a-button>
         <!-- 本期暂不做 -->
         <!-- 本期暂不做 -->
         <!-- <a-button type="danger" @click="refund(record)">退款</a-button> -->
         <!-- <a-button type="danger" @click="refund(record)">退款</a-button> -->
       </span>
       </span>
     </s-table>
     </s-table>
     <!-- 查看详情弹窗 -->
     <!-- 查看详情弹窗 -->
     <order-detail-modal 
     <order-detail-modal 
-      :openModal="openDetailsModal"
-      @close="openDetailsModal=false"/> 
+      :openModal="openDetailModal"
+      :nowId="detailId"
+      @close="openDetailModal=false"/> 
   </a-card>
   </a-card>
 </template>
 </template>
 
 
@@ -109,7 +111,8 @@
         incomeHJ:'2000',
         incomeHJ:'2000',
         itemOptionData:[],    // 服务项目数据
         itemOptionData:[],    // 服务项目数据
         storeOptionData:[],   // 网点名称数据
         storeOptionData:[],   // 网点名称数据
-        openDetailsModal:false,   // 查看详情弹窗 默认关闭
+        openDetailModal:false,   // 查看详情弹窗 默认关闭
+        detailId:null,          // 初始化id
         time: [
         time: [
           moment(getDate.getToday().starttime, this.dateFormat),
           moment(getDate.getToday().starttime, this.dateFormat),
 					moment(getDate.getToday().endtime, this.dateFormat)
 					moment(getDate.getToday().endtime, this.dateFormat)
@@ -161,12 +164,12 @@
             }
             }
 
 
           },
           },
-          {
-            title: '优惠(¥)',
-            dataIndex: 'couponAmount',
-            minWidth: '40',
-            align: 'center'
-          },
+          // {
+          //   title: '优惠(¥)',
+          //   dataIndex: 'couponAmount',
+          //   minWidth: '40',
+          //   align: 'center'
+          // },
           {
           {
             title: '状态',
             title: '状态',
             dataIndex: 'orderStatus',
             dataIndex: 'orderStatus',
@@ -189,7 +192,7 @@
         ],
         ],
         // 加载数据方法 必须为 Promise 对象
         // 加载数据方法 必须为 Promise 对象
         loadData: parameter => {
         loadData: parameter => {
-          console.log(this.searchForm.storeId)
+          // console.log(this.searchForm.storeId)
           this.searchForm.beginDate == null ? this.searchForm.beginDate = getDate.getToday().starttime : null
           this.searchForm.beginDate == null ? this.searchForm.beginDate = getDate.getToday().starttime : null
           this.searchForm.endDate == null ? this.searchForm.endDate = getDate.getToday().endtime : null
           this.searchForm.endDate == null ? this.searchForm.endDate = getDate.getToday().endtime : null
           this.searchForm.storeIdList = this.storeId 
           this.searchForm.storeIdList = this.storeId 
@@ -240,10 +243,13 @@
       // 合计
       // 合计
       getTotal(){},
       getTotal(){},
       // 查看详情--跳转到对应的详情页
       // 查看详情--跳转到对应的详情页
-      // seeDetail(record) {
-      //   this.$router.push({name: 'OrderDetail',query: {id: record.id}
-      //   })
-      // },
+      seeDetail(record) {
+        // this.$router.push({name: 'OrderDetail',query: {id: record.id}
+        // })
+        this.detailId = record.id
+        this.openDetailModal = true
+        console.log(this.detailId)
+      },
       // 退款---暂不做
       // 退款---暂不做
       // refund(row) {
       // refund(row) {
       //   const _this = this
       //   const _this = this

+ 41 - 33
src/views/Order/OrderDetailModal.vue

@@ -1,6 +1,5 @@
 <template>
 <template>
-  <!-- <a-card :bordered="false"> -->
-  <a-modal title="查看详情" :footer="null" :width="1000" :destroyOnClose="true" @cancel="isShow=false" v-model="isShow">
+  <a-modal title="查看详情" :footer="null" :width="1100" :destroyOnClose="true" @cancel="isShow=false" v-model="isShow">
     <v-select ref="orderStatus" code="ORDER_STATUS" placeholder="请选择" allowClear v-show="false"></v-select>
     <v-select ref="orderStatus" code="ORDER_STATUS" placeholder="请选择" allowClear v-show="false"></v-select>
     <div class="orderDetail-content">
     <div class="orderDetail-content">
       <a-form>
       <a-form>
@@ -44,21 +43,10 @@
               <span>{{orderDetailData.payableAmount}} 元</span>
               <span>{{orderDetailData.payableAmount}} 元</span>
             </a-form-item>
             </a-form-item>
           </a-col>
           </a-col>
-          <a-col :span="8">
-            <a-form-item label="优惠(¥)" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
-              <span>{{'-'}}</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="8">
-            <a-form-item label="优惠券名称" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
-              <span>{{"-"}}</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
           <a-col :span="8">
           <a-col :span="8">
             <a-form-item label="实付(¥)" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
             <a-form-item label="实付(¥)" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
-              <span>{{orderDetailData.paymentAmount}} 元</span>
+              <span v-if=" orderDetailData.payStatus == 'PAID' ">{{orderDetailData.paymentAmount}} 元</span>
+              <span v-else-if=" orderDetailData.payStatus != 'PAID' ">{{ 0 }} 元</span>
             </a-form-item>
             </a-form-item>
           </a-col>
           </a-col>
           <a-col :span="8">
           <a-col :span="8">
@@ -82,6 +70,18 @@
             </a-form-item>
             </a-form-item>
           </a-col>
           </a-col>
         </a-row>
         </a-row>
+        <a-row :gutter="24">
+          <!-- <a-col :span="8">
+            <a-form-item label="优惠(¥)" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
+              <span>{{'-'}}</span>
+            </a-form-item>
+          </a-col>
+          <a-col :span="8">
+            <a-form-item label="优惠券名称" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
+              <span>{{"-"}}</span>
+            </a-form-item>
+          </a-col> -->
+        </a-row>
         <a-row style="text-align: center;margin-top: 100px;">
         <a-row style="text-align: center;margin-top: 100px;">
           <a-col>
           <a-col>
             <a-form-item>
             <a-form-item>
@@ -92,8 +92,6 @@
       </a-form>
       </a-form>
     </div>
     </div>
   </a-modal>
   </a-modal>
-    
-  <!-- </a-card> -->
 </template>
 </template>
 
 
 <script>
 <script>
@@ -106,12 +104,16 @@
       openModal: {  //  弹框是否展示
       openModal: {  //  弹框是否展示
         type: Boolean,
         type: Boolean,
         default: false
         default: false
+      },
+      nowId:{
+        type: Number,
+        default: null 
       }
       }
     },
     },
     data() {
     data() {
       return {
       return {
         orderDetailData:[],
         orderDetailData:[],
-        isShow:this.openModal
+        isShow: this.openModal,
       }
       }
     },
     },
     methods: {
     methods: {
@@ -119,27 +121,33 @@
       // getOrderDetail(){
       // getOrderDetail(){
       //   orderDetail()
       //   orderDetail()
       // },
       // },
-      // 返回列表
-      goBack() {
-        // this.$router.push({
-        //   name: 'OrderCenter'
-        // })
-      },
     },
     },
-    beforeRouteEnter (to, from, next) {
-      next(vm => {
-        let params = vm.$route.query
-        if(params.id){
-          orderDetail({id: params.id}).then(res=>{
+    watch: {
+      //  父页面传过来的弹框状态
+      openModal (newValue, oldValue) {
+        this.isShow = newValue
+      },
+      nowId(newValue, oldValue){
+        console.log(newValue)
+        if(newValue){
+          orderDetail({id:newValue}).then(res=>{
             console.log(res,'------------')
             console.log(res,'------------')
             if(res.status == 200){
             if(res.status == 200){
-              vm.orderDetailData = res.data
-              vm.orderDetailData.orderStatus = vm.$refs.orderStatus.getNameByCode(vm.orderDetailData.orderStatus)
+              setTimeout(() => {
+              	res.data.orderStatus = this.$refs.orderStatus.getNameByCode(res.data.orderStatus)
+              }, 100)
+              this.orderDetailData = res.data
             }
             }
           })
           })
         }
         }
-      })
-    }
+      },
+      //  重定义的弹框状态
+      isShow (val){
+        if (!val){
+          this.$emit('close')
+        }
+      }
+    },
   }
   }
 </script>
 </script>
 <style lang="less">
 <style lang="less">