zhangdan 4 роки тому
батько
коміт
71b9a305d9

+ 185 - 35
src/views/Service/PurchasedServiceDetail.vue

@@ -17,7 +17,7 @@
 
       </detail-list>
     </a-card>
-    <a-card class="detail-card" :bordered="false" title="优惠券">
+   <!-- <a-card class="detail-card" :bordered="false" title="优惠券">
       <detail-list v-if="coupon">
         <detail-list-item term="优惠券名称">{{ coupon.name ? coupon.name : '--' }}</detail-list-item>
         <detail-list-item term="发放/领取时间">{{ customerCoupon.createDate ? customerCoupon.createDate : '--' }}</detail-list-item>
@@ -26,8 +26,9 @@
       <div class="detail-card-info" v-if="!coupon">
         此订单没有使用优惠券
       </div>
-    </a-card>
-    <a-card class="detail-card" :bordered="false" title="套餐内容" v-if="isPay">
+    </a-card> -->
+    <!-- <a-card class="detail-card" :bordered="false" title="套餐内容" v-if="isPay"> -->
+	<a-card class="detail-card" :bordered="false" title="服务内容" >
       <a-table :columns="columns" rowKey="id" :dataSource="customerBundleItemList" bordered :pagination="false">
         <span slot="no" slot-scope="text, record, index">
           <template>
@@ -37,12 +38,13 @@
         <span slot="hexiao" slot-scope="text, record, index">
           <template>
             <a-button :disabled="record.remainTimes<=0" type="primary" v-hasPermission="'B_customerBundle_hexiao'" @click="hexiao(record)">延期</a-button>
-            <span v-if="!$hasPermissions('B_customerBundle_hexiao')" style="text-align: center;font-size: 20px;">-</span>
+            <span v-if="!$hasPermissions('B_customerBundle_hexiao')" style="text-align: center;font-size: 20px;">--</span>
           </template>
         </span>
       </a-table>
     </a-card>
-    <a-card class="detail-card" :bordered="false" title="使用记录" v-if="isPay">
+    <a-card class="detail-card" :bordered="false" title="使用记录">
+		<!-- <a-card class="detail-card" :bordered="false" title="使用记录" v-if="isPay"> -->
       <a-table :columns="usedColumns" rowKey="id" :dataSource="verificationList" bordered v-if="verificationList && verificationList.length > 0" :pagination="false">
         <span slot="no" slot-scope="text, record, index">
           <template>
@@ -54,7 +56,7 @@
         此订单没有使用记录
       </div>
     </a-card>
-    <a-card class="detail-card" :bordered="false" title="订单取消信息" v-if="isCancel">
+    <!-- <a-card class="detail-card" :bordered="false" title="订单取消信息" v-if="isCancel">
       <detail-list>
         <detail-list-item term="取消原因">{{ palyStatusStr }}</detail-list-item>
         <detail-list-item term="取消时间">{{ orderBundle.cancleTime }}</detail-list-item>
@@ -64,18 +66,100 @@
       <div class="detail-card-info">
         {{ orderBundle.expiryDate }}  点前未支付, 系统将自动取消订单
       </div>
-    </a-card>
-
-    <a-modal title="确定核销一次" :footer="null" v-model="hexiaoModal" @cancel="canselHx" @ok="handleHexiaoOk">
+    </a-card> -->
+	<a-card class="detail-card" :bordered="false" style="text-align: center;">
+		<a-button  type="primary" @click="canselBuy">取消购买</a-button>
+	</a-card>
+	<!-- 取消购买弹窗 -->
+	<a-modal title="取消购买" v-model="buyModal" @cancel="canselBuy" :bodyStyle="{textAlign:'center'}" :centered='true' :footer="null">
+		<p>取消购买后,服务的剩余次数变为0,用户无法再使用服务</p>
+		<p>确认取消购买吗?</p>
+		<div class="button-row">
+		  <a-button key="back" @click="canselHx">
+		    取消
+		  </a-button>
+		  <a-button key="submit" type="primary" :loading="loading" @click="handleHexiaoOk">
+		    确定
+		  </a-button>
+		</div>
+	</a-modal>
+	<!-- 延期弹窗 -->
+    <a-modal title="服务延期" :footer="null" v-model="hexiaoModal" @cancel="canselHx" @ok="handleHexiaoOk">
       <!-- <StoreSearch ref="storeSearch" @storeChange="storeChange" placeholder="搜索并选择核销门店"></StoreSearch> -->
-      <div class="button-row">
-        <a-button key="back" @click="canselHx">
-          取消
-        </a-button>
-        <a-button key="submit" type="primary" :loading="loading" @click="handleHexiaoOk">
-          确定
-        </a-button>
-      </div>
+	  <a-form :form="form" @submit="handleSubmit">
+	    <a-row :gutter="24">
+	      <a-col :span="12">
+	        <!-- 用户名称 -->
+	        <a-form-item label="服务名称" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
+	          <span>{{}}</span>
+	        </a-form-item>
+	      </a-col>
+	      <a-col :span="12">
+	        <!-- 手机号码 -->
+	        <a-form-item label="到期时间" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
+	          <span>{{}}</span>
+	        </a-form-item>
+	      </a-col>
+	    </a-row>
+	    <a-row :gutter="24">
+			<a-col :span="12">
+			  <!-- 手机号码 -->
+			  <a-form-item label="过期次数" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
+			    <span>{{}}</span>
+			  </a-form-item>
+			</a-col>
+	      <!-- 状态 -->
+	      <a-col :span="12">
+	        <a-form-item label="是否返回已过期服务" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
+	          <a-radio-group
+	            id="user-add-loginFlag"
+	            name="radioGroup"
+	            v-decorator="[
+	              'formData.loginFlag',
+	              {
+	                initialValue: formData.loginFlag,
+	                rules: [{ required: true, message: '请选择状态!' }] },
+	            ]"
+	          >
+	            <a-radio :value="1">是</a-radio>
+	            <a-radio :value="0">否</a-radio>
+	          </a-radio-group>
+	  
+	        </a-form-item>
+	      </a-col>
+	    </a-row>
+	    <a-row :gutter="24">
+			<a-col :span="24">
+				<a-form-item label="新的到期时间" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
+				  <a-date-picker
+				        format="YYYY-MM-DD"
+				        :disabled-date="disabledDate"
+				      />
+				</a-form-item>
+			</a-col>
+	      <a-col :span="24">
+	        <a-form-item label="返还次数" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
+	          <a-input placeholder="请输入" />
+	        </a-form-item>
+	      </a-col>
+	    </a-row>
+	    <a-form-item :wrapper-col="{ span: 12, offset: 5 }">
+			<div class="button-row">
+			  <a-button key="back" @click="canselHx">
+			    取消
+			  </a-button>
+			  <a-button key="submit" type="primary" :loading="loading" @click="handleHexiaoOk">
+			    确定
+			  </a-button>
+			</div>
+	      <!-- <a-button id="user-add-btn-save" type="primary" @click="handleSubmit()">
+	        保存
+	      </a-button>
+	      <a-button id="user-add-btn-cancel" :style="{ marginLeft: '8px' }" @click="handleCancel()">
+	        取消
+	      </a-button> -->
+	    </a-form-item>
+	  </a-form>
     </a-modal>
   </a-card>
 </template>
@@ -88,6 +172,7 @@ import { STable } from '@/components'
 // import StoreSearch from '@/components/QueryStore/StoreSearch'
 import DetailList from '@/components/tools/DetailList'
 import _ from 'lodash'
+import moment from 'moment';
 const DetailListItem = DetailList.Item
 export default {
   name: 'OrderAdd',
@@ -152,10 +237,14 @@ export default {
       customerCoupon: {},
       palyStatusList: [],
       hexiaoModal: false,
+	  buyModal:false,
       hxStoreId: '',
       hxCustomerBundleItemId: '',
-	    dataSourceName: '',
+	  dataSourceName: '',
       customer: null,
+	  formData:{
+		  loginFlag:'',
+	  },
       orderBundle: {
         // bundleId: 10000,
         // bundleName: '测试套餐',
@@ -250,46 +339,97 @@ export default {
         {
           title: '序号',
           // dataIndex: 'no',
-          scopedSlots: { customRender: 'no' }
+          scopedSlots: { customRender: 'no' },
+		  width: 60,
+		  align:'center'
         },
         {
-          title: '服务项目',
-          dataIndex: 'itemName'
+          title: '到期时间',
+          dataIndex: 'itemName',
+		  width: 100,
+		  align:'center'
         },
+		{
+		  title: '购买数量',
+		  dataIndex: '',
+		  width: 100,
+		  align:'center'
+		},
+		{
+		  title: '剩余次数',
+		  dataIndex: '',
+		  width: 100,
+		  align:'center'
+		},
         {
-          title: '剩余数量',
-          dataIndex: 'remainTimes'
+          title: '已用次数',
+          dataIndex: '',
+		  width: 100,
+		  align:'center'
         },
+		{
+		  title: '过期次数',
+		  dataIndex: '',
+		  width: 100,
+		  align:'center'
+		},
+		{
+		  title: '退款次数',
+		  dataIndex: '',
+		  width: 100,
+		  align:'center'
+		},
         {
           title: '核销操作',
-          width: 200,
+          width: 100,
+		  align:'center',
           scopedSlots: { customRender: 'hexiao' }
         }
       ],
       usedColumns: [
         {
           title: '序号',
-          scopedSlots: { customRender: 'no' }
+          scopedSlots: { customRender: 'no' },
+		  width: 60,
+		  align:'center'
         },
         {
-          title: '服务项目',
-          dataIndex: 'bundItemName'
+          title: '服务名称',
+          dataIndex: 'bundItemName',
+		  width: 100,
+		  align:'center'
         },
         {
           title: '使用时间',
-          dataIndex: 'usedTime'
+          dataIndex: 'usedTime',
+		  width: 100,
+		  align:'center'
         },
         {
           title: '使用门店',
-          dataIndex: 'usedStoreName'
-        }
+          dataIndex: 'usedStoreName',
+		  width: 100,
+		  align:'center'
+        },
+		{
+		  title: '核销单号',
+		  dataIndex: '',
+		  width: 200,
+		  align:'center'
+		},
+		{
+		  title: '门店结算金额',
+		  dataIndex: '',
+		  width: 100,
+		  align:'center'
+		}
       ]
 
     }
   },
-  created () {
-    this.initPage()
-  },
+  // created () {
+  //   this.initPage()
+  // },
   beforeRouteEnter (to, from, next) {
     next(vm => {
       // vm.clear()
@@ -299,6 +439,12 @@ export default {
     })
   },
   methods: {
+	  moment,
+	  // 不可选日期
+	  disabledDate(current) {
+	        // Can not select days before today and today
+	        return current && current < moment().endOf('day');
+	      },
     initPage () {
       const _this = this
       getLookUpDataBy({
@@ -362,7 +508,11 @@ export default {
     },
     storeChange (data) {
       this.hxStoreId = data ? data.id : ''
-    }
+    },
+	// 取消购买
+	canselBuy(){
+		this.buyModal=true
+	}
   }
 }
 </script>
@@ -377,7 +527,7 @@ export default {
   }
   .button-row{
     padding-top: 20px;
-    text-align: right;
+    text-align: center;
   }
   .button-row .ant-btn{
     margin-left: 20px;

+ 103 - 24
src/views/Service/PurchasedServiceList.vue

@@ -9,17 +9,18 @@
             </a-form-item>
           </a-col>
           <a-col :lg="6" :sm="12">
-            <a-form-item label="下单时间:" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-              <a-range-picker allowClear style="width:100%" v-model="queryOrderDate" format="YYYY-MM-DD" :placeholder="['开始时间', '结束时间']" />
+            <a-form-item label="下单时间" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+              <a-range-picker style="width:100%" :disabledDate="disabledDate" v-model="queryOrderDate" format="YYYY-MM-DD"
+                              :placeholder="['开始时间', '结束时间']" id="SettlementRecordsList-queryOrderDate" />
             </a-form-item>
           </a-col>
           <a-col :lg="6" :sm="12">
-            <a-form-item label="订单状态:" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+            <a-form-item label="结算状态:" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
               <v-select ref="payStatus" code="PAY_STATUS" v-model="queryParam.orderFlag" allowClear></v-select>
             </a-form-item>
           </a-col>
           <a-col :lg="6" :sm="12">
-            <a-form-item label="订单来源" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+            <a-form-item label="销售合作商" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
               <!-- <salesSearch ref="salesSearch" @salesChange="salesChange" placeholder="订单来源"></salesSearch> -->
               <a-select placeholder="请选择" allowClear v-model="queryParam.dataSourceNo" :showSearch="true" option-filter-prop="children"
                         :filter-option="filterOption" @focus="handleFocus" @blur="handleBlur" @change="handleChange">
@@ -31,28 +32,33 @@
 
         <a-row :gutter="48">
           <a-col :lg="6" :sm="12">
-            <a-form-item label="客户手机" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-              <a-input class="full-width" v-model.trim="queryParam.custMobile" :maxLength="11" placeholder="客户手机" allowClear />
+            <a-form-item label="客户信息" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+              <a-input class="full-width" v-model.trim="queryParam.custMobile" :maxLength="11" placeholder="客户信息" allowClear />
             </a-form-item>
           </a-col>
           <a-col :lg="6" :sm="12">
-            <a-form-item label="车牌号码" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-              <a-input class="full-width" v-model.trim="queryParam.vehicleNumber" placeholder="车牌号码" allowClear />
+            <a-form-item label="服务名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+              <a-input class="full-width" v-model.trim="queryParam.vehicleNumber" placeholder="服务名称" allowClear />
             </a-form-item>
           </a-col>
-          <a-col :lg="6" :sm="12">
+          <!-- <a-col :lg="6" :sm="12">
             <a-form-item label="套餐名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
               <a-input class="full-width" v-model.trim="queryParam.bundleName" placeholder="套餐名称" allowClear />
             </a-form-item>
-          </a-col>
+          </a-col> -->
 
           <a-col :lg="6" :sm="12">
             <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
             <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
+			<a-button style="margin-left: 8px" @click="handleExport">导出</a-button>
           </a-col>
         </a-row>
       </a-form>
     </div>
+	<!-- 合计 -->
+	<a-alert type="info" showIcon style="margin-bottom:15px">
+	  <div class="ftext" slot="message">共<span>{{ 0 }}</span>单,收款金额<span>¥{{ 0 }}</span>元</div>
+	</a-alert>
     <div class="card-container">
       <s-table ref="table" size="default" rowKey="id" bordered :columns="columns" :data="loadData">
         <span slot="action" slot-scope="text, record">
@@ -97,7 +103,6 @@ export default {
           searchData.beginDate = ''
           searchData.endDate = ''
         }
-        // if
         return listCustomerBundle(searchData).then(res => {
           const no = (res.data.pageNo - 1) * res.data.pageSize
           for (let i = 0; i < res.data.list.length; i++) {
@@ -125,19 +130,19 @@ export default {
       columns: [{
         title: '序号',
         dataIndex: 'no',
-        width: '60px',
+        width: 60,
         align: 'center'
       },
       {
         title: '订单编号',
         dataIndex: 'number',
-        width: '150px',
+        width: 150,
         align: 'center'
       },
       {
-        title: '订单来源',
+        title: '销售合作商',
         dataIndex: 'salesChannelName',
-        width: '150px',
+        width: 150,
         align: 'center',
         customRender: function (text) {
           return (text || '--')
@@ -146,34 +151,40 @@ export default {
       {
         title: '下单时间',
         dataIndex: 'orderDate',
-        width: '150px',
+        width: 150,
         align: 'center'
       },
       {
         title: '客户信息',
         dataIndex: 'custMobile',
-        width: '150px',
+        width: 150,
         align: 'center',
         scopedSlots: {
           customRender: 'userInfo'
         }
       },
       {
-        title: '套餐名称',
+        title: '服务名称',
         dataIndex: 'bundleName',
         align: 'center',
-        width: '150px'
+        width: 100
       },
+	  {
+	    title: '购买数量',
+	    dataIndex: '',
+	    align: 'center',
+	    width: 100
+	  },
       {
-        title: '应付金额',
+        title: '收款金额',
         dataIndex: 'totalAmount',
-        width: '100px',
+        width: 100,
         align: 'center'
       },
       {
         title: '订单状态',
         dataIndex: 'orderFlag',
-        width: '100px',
+        width: 100,
         align: 'center',
         customRender: (text) => {
           const payStatus = this.$refs.payStatus.getOptionDatas()
@@ -185,9 +196,24 @@ export default {
           return text
         }
       },
+	  {
+	    title: '结算状态',
+	    dataIndex: '',
+	    width: 100,
+	    align: 'center',
+	    // customRender: (text) => {
+	    //   const payStatus = this.$refs.payStatus.getOptionDatas()
+	    //   if (payStatus) {
+	    //     if (_.find(payStatus, ['code', text])) {
+	    //       return _.find(payStatus, ['code', text]).dispName
+	    //     }
+	    //   }
+	    //   return text
+	    // }
+	  },
       {
         title: '操作',
-        width: '150px',
+        width: 100,
         align: 'center',
         scopedSlots: {
           customRender: 'action'
@@ -197,6 +223,7 @@ export default {
     }
   },
   methods: {
+    // 禁止不可选日期
     disabledDate (current) {
       return current && current > moment().endOf('day')
     },
@@ -258,7 +285,59 @@ export default {
     // 来源change
     salesChange (data) {
       this.queryParam.dataSourceNo = data ? data.salesChannelNo : ''
-    }
+    },
+	// 导出
+	handleExport () {
+	  this.form.validateFields((err, values) => {
+	    if (!err) {
+	      this.queryParam = values.queryParam
+	      this.queryOrderDate = values.queryOrderDate
+	      this.queryParam.beginDate = moment(this.queryOrderDate[0]).format('YYYY-MM-DD')
+	      this.queryParam.endDate = moment(this.queryOrderDate[1]).format('YYYY-MM-DD')
+	      // 获取距开始日期3个月后的时间戳
+	      const tVal = getThreeMonthsAfter(this.queryParam.beginDate)
+	      // 获取结束时间时间戳
+	      const endVal = new Date(this.queryParam.endDate.replace(/-/g, '/'))
+	      if (endVal.valueOf() > tVal - 86400000) {
+	        return this.$message.warning('单次最多只能导出3个月的数据,请缩小查询区间后再进行导出!')
+	      }
+	      const params = _.cloneDeep(this.queryParam)
+	      let requestObj = null
+	      // 按核销服务量进行结算
+	      if (this.settleType == 'ITEM_VERIFY') {
+	        params.bundName = params.bundleName
+	        params.bizNum = params.orderBundleNo
+	        delete params.bundleName
+	        delete params.orderBundleNo
+	        requestObj = exportByItem
+	      } else {
+	        requestObj = exportByBundle
+	      }
+	      this.exportLoading = true
+	      requestObj(params).then(res => {
+	        console.log(res, 'rrrrrrrrrrr')
+	        this.exportLoading = false
+	        this.download(res)
+	      })
+	    }
+	  })
+	},
+	download (data) {
+	  if (!data) {
+	    return
+	  }
+	  const url = window.URL.createObjectURL(new Blob([data]))
+	  const link = document.createElement('a')
+	
+	  link.style.display = 'none'
+	  link.href = url
+	  const a = moment().format('YYYYMMDDhhmmss')
+	  const fname = '应收结算-' + a
+	  console.log(fname, '111111')
+	  link.setAttribute('download', fname + '.xlsx')
+	  document.body.appendChild(link)
+	  link.click()
+	},
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {