chenrui 4 năm trước cách đây
mục cha
commit
4e3ccfeef5

+ 15 - 0
src/api/customerBundle.js

@@ -95,3 +95,18 @@ export const countListBundle = params => {
     method: 'post'
   }).then(res => res)
 }
+//  已购套餐 套餐包含服务 延期
+export const customerBundleItemDelay = params => {
+  return axios.request({
+    url: `customerBundleItem/delay`,
+    data: params,
+    method: 'post'
+  }).then(res => res)
+}
+//  已购套餐 取消购买
+export const orderCancel = params => {
+  return axios.request({
+    url: `order/cancel/${params.id}`,
+    data: params,
+    method: 'get'
+  }).then(res => res)

+ 1 - 1
src/utils/request.js

@@ -49,7 +49,7 @@ service.interceptors.request.use(config => {
 service.interceptors.response.use((response) => {
   console.log(response, 'response.data.status')
   if (window.location.pathname != '/user/login') {
-    if (response.data.status == '500') {
+    if (response.data.status == '900' || response.data.status == '500') {
       notification.destroy()
       notification.error({
         message: '提示',

+ 3 - 0
src/views/SetmealSales/BuySetmeal.vue

@@ -28,6 +28,9 @@
               <p>
                 <span><b>原价:</b><em style="text-decoration: line-through;">¥{{ item.originalPrice }}</em> </span>
                 <span style="margin-left: 15px;margin-right: 15px;color: red;"><b>现价:</b>¥{{ item.price }} </span>
+                <span style="margin-left: 15px;margin-right: 15px;">
+                  有效期:{{ item.validityTermType == 'PERMANENT_VALIDITY' ? '永久有效' : item.validityTermType == 'FIXED_TIME' ? item.validityTermValue+'过期' : item.validityTermType == 'FIXED_DAYS' ? '购买后'+item.validityTermValue+'天过期' : '' }}
+                </span>
               </p>
               <p>
                 <span><b>套餐说明:</b>{{ item.summary || '-' }}</span>

+ 27 - 10
src/views/SetmealSales/PurchasedSetmeal.vue

@@ -52,13 +52,12 @@
           <a-col :span="6">
             <a-form-item label="销售合作商" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
               <a-select
-                id="purchasedSetmeal-partner"
+                id="purchasedSetmeal-dataSourceNo"
                 allowClear
-                show-search
                 option-filter-prop="children"
                 placeholder="请选择销售合作商"
-                v-model="searchForm.partner">
-                <a-select-option v-for="(item,index) in partnerList" :key="index" :value="item.value">{{ item.name }}</a-select-option>
+                v-model="searchForm.dataSourceNo">
+                <a-select-option v-for="(item,index) in dataSourceNoList" :key="index" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
@@ -111,6 +110,7 @@ import getDate from '@/libs/getDate.js'
 import { completeDate } from '@/libs/tools.js'
 import moment from 'moment'
 import SetmealDetailModal from './SetmealDetailModal.vue'
+import { salesChannelList } from '@/api/FinancialManagement'
 import { listCustomerBundle, exportBundle, countListBundle } from '@/api/customerBundle.js'
 export default {
   name: 'PurchasedSetmeal',
@@ -126,7 +126,8 @@ export default {
         custMobile: '', // 客户信息
         orderFlag: '', // 订单状态
         salesChannelSettleStatus: '', // 结算状态
-        partner: undefined //  销售合作商
+        dataSourceNo: undefined, //  销售合作商
+        freeChoiceFlag: 0 //  套餐传0,服务传1
       },
       loading: false, // 导出loading
       orderTotal: '', // 合计开单数量
@@ -143,7 +144,7 @@ export default {
         { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
         { title: '订单号', dataIndex: 'number', width: 100, align: 'center' },
         { title: '下单时间', dataIndex: 'orderDate', width: 100, align: 'center' },
-        { title: '销售合作商', dataIndex: 'partner', width: 100, align: 'center' },
+        { title: '销售合作商', dataIndex: 'salesChannelName', width: 100, align: 'center' },
         { title: '套餐名称', dataIndex: 'bundleName', width: 100, align: 'center' },
         { title: '客户信息', scopedSlots: { customRender: 'custInfo' }, width: 100, align: 'center' },
         { title: '收款金额(¥)', dataIndex: 'payedAmount', width: 80, align: 'center' },
@@ -167,7 +168,7 @@ export default {
           }
         })
       },
-      partnerList: [] //  销售合作商  下拉数据
+      dataSourceNoList: [] //  销售合作商  下拉数据
     }
   },
   methods: {
@@ -176,6 +177,16 @@ export default {
     disabledDate (date, dateStrings) {
       return date && date.valueOf() > Date.now()
     },
+    //  获取渠道商下的合作商信息
+    getSalesChannel () {
+      salesChannelList().then(res => {
+        if (res.status == 200) {
+          this.dataSourceNoList = res.data
+        } else {
+          this.dataSourceNoList = []
+        }
+      })
+    },
     //  购买套餐
     goBuy () {
       this.$router.push({ path: '/SetmealSales/BuySetmeal' })
@@ -197,7 +208,8 @@ export default {
         custMobile: this.searchForm.custMobile,
         orderFlag: this.searchForm.orderFlag,
         salesChannelSettleStatus: this.searchForm.salesChannelSettleStatus,
-        partner: this.searchForm.partner
+        dataSourceNo: this.searchForm.dataSourceNo,
+        freeChoiceFlag: 0
       }
       params.beginDate == null ? params.beginDate = getDate.getToday().starttime : null
       params.endDate == null ? params.endDate = getDate.getToday().endtime : null
@@ -235,7 +247,8 @@ export default {
       this.searchForm.custMobile = ''
       this.searchForm.orderFlag = null
       this.searchForm.salesChannelSettleStatus = null
-      this.searchForm.partner = undefined
+      this.searchForm.dataSourceNo = undefined
+      this.searchForm.freeChoiceFlag = 0
       this.$refs.table.refresh(true)
     },
     // 导出
@@ -248,7 +261,8 @@ export default {
         custMobile: this.searchForm.custMobile,
         orderFlag: this.searchForm.orderFlag,
         salesChannelSettleStatus: this.searchForm.salesChannelSettleStatus,
-        partner: this.searchForm.partner
+        dataSourceNo: this.searchForm.dataSourceNo,
+        freeChoiceFlag: 0
       }
       if (!params.beginDate && !params.endDate) {
         this.$message.error('请先选择需要导出的下单时间区间再进行导出!')
@@ -277,6 +291,9 @@ export default {
       document.body.appendChild(link)
       link.click()
     }
+  },
+  mounted () {
+    this.getSalesChannel()
   }
 }
 </script>

+ 5 - 11
src/views/SetmealSales/SetmealAttr.vue

@@ -99,6 +99,7 @@ export default {
       paginationProps: {
         showSizeChanger: true, //  是否可以改变 pageSize
         total: 0, //  分页总条数
+        current: 1,
         onShowSizeChange: (current, pageSize) => this.changePageSize(current, pageSize),
         onChange: (current) => this.changePage(current)
       },
@@ -128,17 +129,8 @@ export default {
         }).then(res => {
           if (res.status == 200) {
             const data = res.data
-            if (res.data.count > 10) {
-              this.paginationProps = {
-                showSizeChanger: true, //  是否可以改变 pageSize
-                total: 0, //  分页总条数
-                onShowSizeChange: (current, pageSize) => this.changePageSize(current, pageSize),
-                onChange: (current) => this.changePage(current)
-              }
-              this.paginationProps.total = res.data.count || 0
-            } else {
-              this.paginationProps = false
-            }
+            this.paginationProps.total = res.data.count || 0
+            this.paginationProps.current = this.pageNo
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
@@ -190,6 +182,7 @@ export default {
           const salesChannelType = this.authUserInfo.extInfo.channel.salesChannelType
           if (salesChannelType == 'SALLER') { //  合作商
             this.searchForm.salesChannelNo = res.data.length > 0 ? res.data[0].salesChannelNo : undefined
+            this.isSearch = true
           }
           this.pageInit(1)
         } else {
@@ -202,6 +195,7 @@ export default {
   beforeRouteEnter (to, from, next) {
     next(vm => {
       vm.isSearch = false
+      vm.handleReset()
       vm.getSalesChannel()
     })
   }

+ 32 - 17
src/views/SetmealSales/SetmealDetailModal.vue

@@ -72,7 +72,8 @@
             :pagination="false"
             bordered>
             <span slot="action" slot-scope="text, record">
-              <a-button type="link" @click="setDelay=true">延期</a-button>
+              <a-button v-if="record.expiryTimes" type="link" @click="openSetDelay(record)">延期</a-button>
+              <span v-else>--</span>
             </span>
           </a-table>
         </a-tab-pane>
@@ -99,13 +100,13 @@
       </div>
     </a-modal>
     <!-- 延期 -->
-    <delay-modal :openModal="setDelay" :setmealId="setmealId" @close="setDelay=false" />
+    <delay-modal :openModal="setDelay" :serverData="serverData" @close="closeSetDelay" />
   </div>
 </template>
 
 <script>
 import { STable, VSelect } from '@/components'
-import { customerBundleDetail, customerBundleUseHistory } from '@/api/customerBundle.js'
+import { customerBundleDetail, customerBundleUseHistory, orderCancel } from '@/api/customerBundle.js'
 import DelayModal from './delayModal.vue'
 export default {
   name: 'SetmealDetailModal',
@@ -128,12 +129,12 @@ export default {
       setMealColumns: [
         { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
         { title: '服务名称', dataIndex: 'itemName', width: 200, align: 'center' },
-        { title: '到期时间', dataIndex: 'times', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '总次数', dataIndex: 'zcs', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '剩余次数', dataIndex: 'remainTimes', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '已用次数', dataIndex: 'yycs', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '过期次数', dataIndex: 'gqcs', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '退款次数', dataIndex: 'tkcs', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '到期时间', dataIndex: 'expiryDate', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '总次数', dataIndex: 'times', width: 100, align: 'center' },
+        { title: '剩余次数', dataIndex: 'remainTimes', width: 100, align: 'center' },
+        { title: '已用次数', dataIndex: 'usedTimes', width: 100, align: 'center' },
+        { title: '过期次数', dataIndex: 'expiryTimes', width: 100, align: 'center' },
+        { title: '退款次数', dataIndex: 'refundTimes', width: 100, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center' }
       ],
       recordColumns: [
@@ -146,15 +147,15 @@ export default {
       setMealData: [], //  套餐内容
       recordData: [], //  使用记录
       detailsData: null, //  套餐数据
-      setDelay: false //  延期设置
+      setDelay: false, //  延期设置
+      serverData: null //  套餐包含服务 数据
     }
   },
   methods: {
     // 套餐详情
-    getSetmealInfo (id) {
+    getSetmealInfo () {
       //  套餐详情
-      customerBundleDetail({ id: id }).then(res => {
-        console.log(res)
+      customerBundleDetail({ id: this.setmealId }).then(res => {
         if (res.status == 200) {
           this.detailsData = res.data
           if (res.data && res.data.customerBundleItemList && res.data.customerBundleItemList.length > 0) {
@@ -171,8 +172,7 @@ export default {
         }
       })
       //  使用记录
-      customerBundleUseHistory({ id: id }).then(res => {
-        console.log(res)
+      customerBundleUseHistory({ id: this.setmealId }).then(res => {
         if (res.status == 200) {
           if (res.data && res.data.length > 0) {
             res.data.map((item, index) => {
@@ -194,10 +194,25 @@ export default {
         title: '取消购买',
         content: '取消购买后,套餐内所有服务的剩余次数变为0,用户无法再使用套餐。确认取消购买吗?',
         onOk: () => {
-
+          orderCancel({ id: _this.setmealId }).then(res => {
+            if (res.status == 200) {
+              _this.isShow = false
+            }
+          })
         },
         onCancel () {}
       })
+    },
+    //  延期
+    openSetDelay (row) {
+      this.serverData = row
+      this.setDelay = true
+    },
+    //  关闭延期
+    closeSetDelay () {
+      this.getSetmealInfo()
+      this.serverData = null
+      this.setDelay = false
     }
   },
   watch: {
@@ -213,7 +228,7 @@ export default {
     },
     setmealId (newValue, oldValue) {
       if (newValue && this.isShow) {
-        this.getSetmealInfo(newValue)
+        this.getSetmealInfo()
       }
     }
   }

+ 28 - 38
src/views/SetmealSales/SetmealPayMoney.vue

@@ -16,28 +16,11 @@
         <a-input id="setmealPayMoney-custMobile" v-model.trim="form.custMobile" @input="mobileInput" :maxLength="11" placeholder="请输入手机号" />
       </a-form-model-item>
       <!-- 销售合作商 -->
-      <a-form-model-item label="销售合作商" prop="partner">
-        <a-select id="setmealPayMoney-partner" v-model="form.partner" placeholder="请选择该套餐是由哪个合作商售出">
-          <a-select-option v-for="(item, index) in partnerList" :key="index" :value="item.value">{{ item.value }}</a-select-option>
+      <a-form-model-item label="销售合作商" prop="dataSourceNo">
+        <a-select id="setmealPayMoney-dataSourceNo" v-model="form.dataSourceNo" placeholder="请选择该套餐是由哪个合作商售出">
+          <a-select-option v-for="(item, index) in partnerList" :key="index" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
         </a-select>
       </a-form-model-item>
-      <!-- 有效期 -->
-      <a-form-model-item label="有效期" prop="timeType">
-        <a-radio-group id="setmealPayMoney-timeType" v-model="form.timeType">
-          <a-radio :value="1">永久有效</a-radio>
-          <a-radio :value="0">设置有效时间</a-radio>
-        </a-radio-group>
-      </a-form-model-item>
-      <!-- 到期时间 -->
-      <a-form-model-item v-if="form.timeType==0" label="到期时间" prop="time">
-        <a-date-picker
-          type="date"
-          v-model="form.time"
-          id="setmealPayMoney-time"
-          placeholder="请选择到期时间,超过该时间,用户将无法再使用套餐"
-          :disabled-date="disabledDate"
-          style="width: 100%;" />
-      </a-form-model-item>
       <!-- 客户姓名 -->
       <a-form-model-item label="客户姓名" prop="custName">
         <a-input id="setmealPayMoney-custName" v-model.trim="form.custName" :maxLength="30" placeholder="请输入客户姓名(最多30个字符)" />
@@ -62,8 +45,9 @@
 
 <script>
 import { isMobile } from '@/libs/tools'
+import { mapGetters } from 'vuex'
 import { bundleFindByMobile, bundleBuy } from '@/api/customerBundle.js'
-import moment from 'moment'
+import { salesChannelList } from '@/api/FinancialManagement'
 export default {
   name: 'SetmealPayMoney',
   props: {
@@ -99,26 +83,20 @@ export default {
         custMobile: '',
         custName: '',
         custId: null,
-        partner: undefined, //  销售合作商
-        timeType: 1, //  有效期
-        time: null //  到期时间
+        dataSourceNo: undefined //  销售合作商
       },
       rules: {
         custMobile: [{ required: true, message: '请输入手机号', trigger: 'blur' }, { validator: isMobileValid, trigger: 'blur' }],
-        partner: [{ required: true, message: '请选择销售合作商', trigger: 'change' }],
-        timeType: [{ required: true, message: '请选择有效期', trigger: 'change' }],
-        time: [{ required: true, message: '请选择到期时间', trigger: 'change' }]
+        dataSourceNo: [{ required: true, message: '请选择销售合作商', trigger: 'change' }]
       },
       setmealData: null, //  套餐数据
       partnerList: [] //  合作商  下拉数据
     }
   },
+  computed: {
+    ...mapGetters(['authUserInfo'])
+  },
   methods: {
-    moment,
-    disabledDate (current) {
-      // return current && current < moment().endOf('day')  //  不包含当天
-      return current.valueOf() < moment().subtract(1, 'days').valueOf() //  包含当天
-    },
     //  手机号输入监听
     mobileInput () {
       if (this.form.custMobile.length == 11) {
@@ -150,9 +128,7 @@ export default {
             custId: this.form.custId,
             custName: this.form.custName,
             custMobile: this.form.custMobile,
-            partner: this.form.partner,
-            timeType: this.form.timeType,
-            time: this.form.time,
+            dataSourceNo: this.form.dataSourceNo,
             totalAmount: this.setmealData.price,
             paymentDetail: { payType: 10001 }
           }
@@ -181,9 +157,22 @@ export default {
       this.form.custMobile = ''
       this.form.custName = ''
       this.form.custId = null
-      this.form.partner = undefined
-      this.form.timeType = 1
-      this.form.time = null
+      this.form.dataSourceNo = undefined
+    },
+    //  获取渠道商下的合作商信息
+    getSalesChannel () {
+      salesChannelList().then(res => {
+        if (res.status == 200) {
+          this.partnerList = res.data
+          const salesChannelType = this.authUserInfo.extInfo.channel.salesChannelType
+          if (salesChannelType == 'SALLER') { //  合作商
+            this.form.dataSourceNo = res.data.length > 0 ? res.data[0].salesChannelNo : undefined
+          }
+        } else {
+          this.partnerList = []
+          this.form.dataSourceNo = undefined
+        }
+      })
     }
   },
   watch: {
@@ -197,6 +186,7 @@ export default {
         this.$emit('close')
       } else {
         this.resetForm() //  重置表单数据
+        this.getSalesChannel()
       }
     },
     setmealInfo (newValue, oldValue) {

+ 46 - 42
src/views/SetmealSales/delayModal.vue

@@ -10,38 +10,44 @@
     @cancel="isShow = false"
     v-model="isShow">
     <!-- 表单 -->
-    <a-form-model ref="ruleForm" :model="form" :rules="rules" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
+    <a-form-model
+      ref="ruleForm"
+      :model="form"
+      :rules="rules"
+      :label-col="{ span: 6 }"
+      :wrapper-col="{ span: 18 }"
+      v-if="serverData">
       <!-- 服务名称 -->
-      <a-form-model-item label="服务名称" class="item-con"><p class="item-main">清泉洗车(VIP)</p></a-form-model-item>
+      <a-form-model-item label="服务名称" class="item-con"><p class="item-main">{{ serverData.itemName }}</p></a-form-model-item>
       <!-- 到期时间 -->
-      <a-form-model-item label="到期时间" class="item-con"><p class="item-main">2020-11-28</p></a-form-model-item>
+      <a-form-model-item label="到期时间" class="item-con"><p class="item-main">{{ serverData.expiryDate }}</p></a-form-model-item>
       <!-- 过期次数 -->
-      <a-form-model-item label="过期次数" class="item-con"><p class="item-main">15次</p></a-form-model-item>
+      <a-form-model-item label="过期次数" class="item-con"><p class="item-main">{{ serverData.expiryTimes }}次</p></a-form-model-item>
       <!-- 新的到期时间 -->
-      <a-form-model-item label="新的到期时间" prop="time">
+      <a-form-model-item label="新的到期时间" prop="expiryDate">
         <a-date-picker
           type="date"
-          v-model="form.time"
-          id="delay-time"
+          v-model="form.expiryDate"
+          id="delay-expiryDate"
           placeholder="请选择到期时间,超过该时间,用户将无法再使用套餐"
           :disabled-date="disabledDate"
           style="width: 80%;" />
       </a-form-model-item>
       <!-- 是否返还已过期服务 -->
-      <a-form-model-item label="是否返还已过期服务" prop="timeType">
-        <a-radio-group id="delay-timeType" v-model="form.timeType">
+      <a-form-model-item label="是否返还已过期服务" prop="returnFalg">
+        <a-radio-group id="delay-returnFalg" v-model="form.returnFalg">
           <a-radio :value="1">是</a-radio>
           <a-radio :value="0">否</a-radio>
         </a-radio-group>
       </a-form-model-item>
       <!-- 返还次数 -->
-      <a-form-model-item v-if="form.timeType==1" label="返还次数" prop="custMobile">
+      <a-form-model-item v-if="form.returnFalg==1" label="返还次数" prop="returnTimes">
         <a-input-number
-          id="delay-custMobile"
-          v-model="form.custMobile"
+          id="delay-returnTimes"
+          v-model="form.returnTimes"
           :precision="0"
           :min="0"
-          :max="999999"
+          :max="serverData.expiryTimes"
           placeholder="请输入返还次数"
           style="width: 80%;margin-right: 10px;" />次
       </a-form-model-item>
@@ -55,6 +61,7 @@
 
 <script>
 import moment from 'moment'
+import { customerBundleItemDelay } from '@/api/customerBundle.js'
 export default {
   name: 'DelayModal',
   props: {
@@ -63,31 +70,32 @@ export default {
       type: Boolean,
       default: false
     },
-    setmealId: {
-      //  套餐id
-      type: [String, Number],
-      default: ''
+    serverData: {
+      //  服务数据
+      type: Object,
+      default: () => {
+        return {}
+      }
     }
   },
   data () {
     return {
       isShow: this.openModal, //  弹框是否展示
       form: {
-        time: null, //  新的到期时间
-        timeType: 1, //  是否返还已过期服务
-        custMobile: null //  返还次数
+        expiryDate: null, //  新的到期时间
+        returnFalg: 1, //  是否返还已过期服务
+        returnTimes: null //  返还次数
       },
       rules: {
-        time: [{ required: true, message: '请选择新的到期时间', trigger: 'change' }],
-        timeType: [{ required: true, message: '请选择是否返还已过期服务', trigger: 'change' }],
-        custMobile: [{ required: true, message: '请输入返还次数', trigger: 'blur' }]
+        expiryDate: [{ required: true, message: '请选择新的到期时间', trigger: 'change' }],
+        returnFalg: [{ required: true, message: '请选择是否返还已过期服务', trigger: 'change' }],
+        returnTimes: [{ required: true, message: '请输入返还次数', trigger: 'blur' }]
       }
     }
   },
   methods: {
     moment,
     disabledDate (current) {
-      // return current && current < moment().endOf('day')  //  不包含当天
       return current.valueOf() < moment().subtract(1, 'days').valueOf() //  包含当天
     },
     //  取消
@@ -97,25 +105,25 @@ export default {
     },
     // 重置表单
     resetForm () {
-      this.form.custMobile = null
-      this.form.timeType = 1
-      this.form.time = null
+      this.form.returnTimes = null
+      this.form.returnFalg = 1
+      this.form.expiryDate = null
     },
     //  提交
     onSubmit () {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const params = {
-            bundleId: this.setmealId,
-            custMobile: this.form.custMobile,
-            timeType: this.form.timeType,
-            time: this.form.time
+            id: this.serverData.id,
+            returnTimes: this.form.returnTimes,
+            returnFalg: this.form.returnFalg,
+            expiryDate: this.form.expiryDate
           }
-          // bundleBuy(params).then(res => {
-          //   if (res.status == 200) {
-          //     this.cancel()
-          //   }
-          // })
+          customerBundleItemDelay(params).then(res => {
+            if (res.status == 200) {
+              this.cancel()
+            }
+          })
         } else {
           console.log('error submit!!')
           return false
@@ -136,12 +144,8 @@ export default {
         this.resetForm() //  重置表单数据
       }
     },
-    setmealId (newValue, oldValue) {
-      if (newValue && this.isShow) {
-        // this.setmealData = newValue
-      } else {
-        // this.setmealData = null
-      }
+    serverData (val) {
+      console.log(val)
     }
   }
 }