Эх сурвалжийг харах

管理后台:点单列表、预定座位列表新增合计

panyong 3 жил өмнө
parent
commit
ab17653251

+ 32 - 3
htmldev/manage/src/views/business/oms/list/index.vue

@@ -38,8 +38,10 @@
               fit
               class="marginT-10 order-table"
               border
-              :max-height="vheight">
-      <el-table-column label="订单ID" prop="id" width="80"></el-table-column>
+              :max-height="vheight"
+              :summary-method="getSummaries"
+              show-summary>
+      <el-table-column label="序号" type="index" width="60"></el-table-column>
       <el-table-column label="订单编号" prop="order_number" width="200"></el-table-column>
       <el-table-column label="桌号" prop="place_number" width="80"></el-table-column>
       <el-table-column label="价格(元)" prop="order_price" sortable width="100">
@@ -79,7 +81,7 @@
         </template>
       </el-table-column>
       <el-table-column label="用户支付订单编号" prop="order_official_number" width="240"></el-table-column>
-      <el-table-column label="操作" fixed="right" width="220">
+      <el-table-column fixed="right" label="操作" width="160">
         <template slot-scope="scope">
           <el-button type="text"
                      v-permission="'business_oms_order_print'"
@@ -185,6 +187,7 @@
 
 <script>
 import page from '@/mixin/page'
+import { fen2Yuan } from '@/utils'
 
 export default {
   mixins: [page],
@@ -256,6 +259,32 @@ export default {
           console.log('error submit!!')
         }
       })
+    },
+    getSummaries(param) {
+      const { columns, data } = param
+      const sums = []
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = '合计'
+          return
+        }
+        const values = data.map(item => ['order_pay_price', 'order_refund_price'].findIndex(list => list === column.property) > -1 ? Number(item[column.property]) : undefined)
+        if (!values.every(value => isNaN(value))) {
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr)
+            if (!isNaN(value)) {
+              return prev + curr
+            } else {
+              return prev
+            }
+          }, 0)
+          sums[index] = fen2Yuan(sums[index]) + ' 元'
+        } else {
+          sums[index] = ''
+        }
+      })
+
+      return sums
     }
   },
   mounted() {

+ 93 - 17
htmldev/manage/src/views/business/place/reserve/details.vue

@@ -9,30 +9,84 @@
                :model="form"
                :rules="formRules"
                label-width="160px">
+        <el-form-item label="订座编号:"
+                      prop="order_number">
+          <el-col :span="16">
+            <el-input v-model="form.order_number"
+                      clearable
+                      placeholder=""
+                      readonly></el-input>
+          </el-col>
+        </el-form-item>
+        <el-form-item label="预定时间:"
+                      prop="order_pre_time">
+          <el-col :span="16">
+            <el-input v-model="form.order_pre_time"
+                      clearable
+                      placeholder=""
+                      readonly></el-input>
+          </el-col>
+        </el-form-item>
         <el-form-item prop="order_user_name"
                       label="预订人:">
           <el-col :span="16">
             <el-input v-model="form.order_user_name"
+                      clearable
                       placeholder=""
-                      disabled
-                      clearable></el-input>
+                      readonly></el-input>
           </el-col>
         </el-form-item>
-        <el-form-item prop="order_user_phone"
-                      label="手机号:">
+        <el-form-item label="手机号:"
+                      prop="order_user_phone">
           <el-col :span="16">
             <el-input v-model="form.order_user_phone"
+                      clearable
                       placeholder=""
-                      disabled
-                      clearable></el-input>
+                      readonly></el-input>
+          </el-col>
+        </el-form-item>
+        <el-form-item label="预定人数:"
+                      prop="order_user_num">
+          <el-col :span="16">
+            <el-input v-model="form.order_user_num"
+                      clearable
+                      placeholder=""
+                      readonly></el-input>
           </el-col>
         </el-form-item>
-        <el-form-item prop="place_name"
-                      label="预定座位类型:">
+        <el-form-item label="座位名称:"
+                      prop="place_name">
           <el-col :span="16">
             <el-input v-model="form.place_name"
+                      clearable
+                      placeholder=""
+                      readonly></el-input>
+          </el-col>
+        </el-form-item>
+        <el-form-item label="下单时间:"
+                      prop="created_at">
+          <el-col :span="16">
+            <el-input v-model="form.created_at"
+                      clearable
+                      placeholder=""
+                      readonly></el-input>
+          </el-col>
+        </el-form-item>
+        <el-form-item label="支付金额(元):"
+                      prop="order_pay_price">
+          <el-col :span="16">
+            <el-input v-model="form.order_pay_price"
+                      placeholder=""
+                      readonly
+                      clearable></el-input>
+          </el-col>
+        </el-form-item>
+        <el-form-item label="支付方式:"
+                      prop="order_pay_type">
+          <el-col :span="16">
+            <el-input v-model="form.order_pay_type"
                       placeholder=""
-                      disabled
+                      readonly
                       clearable></el-input>
           </el-col>
         </el-form-item>
@@ -42,6 +96,15 @@
           <el-radio v-model="form.order_sign_status" label="1">已签到</el-radio>
           <el-radio v-model="form.order_sign_status" label="0">未签到</el-radio>
         </el-form-item>
+        <el-form-item label="签到时间:"
+                      prop="order_sign_date">
+          <el-col :span="16">
+            <el-input v-model="form.order_sign_date"
+                      clearable
+                      placeholder=""
+                      readonly></el-input>
+          </el-col>
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer text-center">
         <el-button @click="dialog = false">取 消</el-button>
@@ -55,6 +118,8 @@
 </template>
 
 <script>
+import { fen2Yuan } from '@/utils'
+
 export default {
   components: {},
   props: {
@@ -69,20 +134,27 @@ export default {
       }
     }
   },
-  data () {
+  data() {
     return {
       dialog: !!this.value,
       form: {
-        order_user_name: '',
-        order_user_phone: '',
-        place_name: '',
-        order_sign_status: '0' // 签到状态(0未签到1已签到)
+        order_number: '', // 订座编号
+        order_pre_time: '', // 预定时间
+        order_user_name: '', // 预订人
+        order_user_phone: '', // 手机号
+        order_user_num: '', // 预定人数
+        place_name: '', // 座位名称
+        created_at: '', // 下单时间
+        order_pay_price: '', // 支付金额(元)
+        order_pay_type: '', // 支付方式
+        order_sign_status: '0', // 签到状态(0未签到1已签到)
+        order_sign_date: '' // 签到时间
       },
       booLock: false
     }
   },
   methods: {
-    handleSubmit () {
+    handleSubmit() {
       const url = '/v1/prepare/order/sign'
       this.$refs.form.validate(async valid => {
         if (valid) {
@@ -100,7 +172,7 @@ export default {
       })
     }
   },
-  mounted () {
+  mounted() {
     if (this.exData.id) {
       this.$set(this.form, 'id', this.exData.id)
       for (const key in this.exData) {
@@ -109,6 +181,10 @@ export default {
           if ((Array.isArray(value) && value.length >= 1) || (Object.prototype.toString.call(value) === '[object Object]') || (typeof value === 'string' && value) || typeof value === 'number') {
             if (key === 'order_sign_status') {
               value = value.toString()
+            } else if (key === 'order_pay_price') {
+              value = fen2Yuan(value)
+            } else if (key === 'order_pay_type') {
+              value = ['', '微信', '支付宝', '现场支付', '美团支付', '赠送'][value]
             }
             this.$set(this.form, key, value)
           }
@@ -117,7 +193,7 @@ export default {
     }
   },
   watch: {
-    dialog (val) {
+    dialog(val) {
       if (!val) this.$emit('input', val)
     }
   }

+ 52 - 15
htmldev/manage/src/views/business/place/reserve/index.vue

@@ -48,25 +48,35 @@
               fit
               class="marginT-10 order-table"
               border
-              :max-height="vheight">
-      <el-table-column label="订单ID" prop="id" width="80"></el-table-column>
-      <el-table-column label="预定时间" prop="order_pre_time"></el-table-column>
+              :max-height="vheight"
+              :summary-method="getSummaries"
+              show-summary>
+      <el-table-column label="序号" type="index" width="60"></el-table-column>
+      <el-table-column label="订座编号" prop="order_number" width="200"></el-table-column>
+      <el-table-column label="手机号" prop="order_user_phone"></el-table-column>
       <el-table-column label="预订人" prop="order_user_name"></el-table-column>
-      <el-table-column label="手机号" prop="order_user_phone" width="120"></el-table-column>
-      <el-table-column label="预定人数" prop="order_user_num" width="60"></el-table-column>
-      <el-table-column label="座位名称" prop="place_name"></el-table-column>
-      <el-table-column label="最晚到场时间" prop="order_latest_time"></el-table-column>
-      <el-table-column label="签到状态" width="80">
+      <el-table-column label="预定时间" prop="order_pre_time" sortable></el-table-column>
+      <el-table-column label="下单时间" prop="created_at" sortable width="200"></el-table-column>
+      <el-table-column label="支付金额(元)" prop="order_pay_price" sortable>
+        <template slot-scope="scope">
+          <p>{{ scope.row.order_pay_price | fen2Yuan }}</p>
+        </template>
+      </el-table-column>
+      <el-table-column label="支付方式" prop="order_pay_type" sortable width="120">
+        <template slot-scope="scope">
+          <p>{{ ['', '微信', '支付宝', '现场支付', '美团支付', '赠送'][scope.row.order_pay_type] }}</p>
+        </template>
+      </el-table-column>
+      <el-table-column label="签到状态" prop="order_sign_status" sortable width="120">
         <template slot-scope="scope">
           <p>{{ ['未签到', '已签到'][scope.row.order_sign_status] }}</p>
         </template>
       </el-table-column>
-      <el-table-column label="签到时间" prop="order_sign_date" width="160"></el-table-column>
-      <el-table-column label="操作" width="80">
+      <el-table-column fixed="right" label="操作" width="180">
         <template slot-scope="scope">
           <el-button type="text"
                      v-permission="'business_place_reserve_sign'"
-                     @click="edit(scope.row)">签到
+                     @click="edit(scope.row)">订座详情
           </el-button>
         </template>
       </el-table-column>
@@ -92,13 +102,14 @@
 <script>
 import page from '@/mixin/page'
 import detail from './details'
+import { fen2Yuan } from '@/utils'
 
 export default {
   mixins: [page],
   components: {
     detail,
   },
-  data () {
+  data() {
     return {
       detailsDialog: {
         show: false,
@@ -110,16 +121,42 @@ export default {
     }
   },
   methods: {
-    add () {
+    add() {
       this.detailsDialog.exData = {}
       this.detailsDialog.show = true
     },
-    edit (row) {
+    edit(row) {
       this.detailsDialog.exData = row
       this.detailsDialog.show = true
+    },
+    getSummaries(param) {
+      const { columns, data } = param
+      const sums = []
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = '合计'
+          return
+        }
+        const values = data.map(item => ['order_pay_price', 'order_refund_price'].findIndex(list => list === column.property) > -1 ? Number(item[column.property]) : undefined)
+        if (!values.every(value => isNaN(value))) {
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr)
+            if (!isNaN(value)) {
+              return prev + curr
+            } else {
+              return prev
+            }
+          }, 0)
+          sums[index] = fen2Yuan(sums[index]) + ' 元'
+        } else {
+          sums[index] = ''
+        }
+      })
+
+      return sums
     }
   },
-  mounted () {
+  mounted() {
     this.init()
   },
 }