SetmealDetailModal.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <div class="DetailsSetmeal">
  3. <v-select v-show="false" ref="payType" code="PAY_PROCUCT_TYPE" placeholder="支付方式"></v-select>
  4. <a-modal
  5. class="DetailsSetmealModal"
  6. title="套餐购买详情"
  7. width="80%"
  8. centered
  9. :footer="null"
  10. :maskClosable="false"
  11. :destroyOnClose="true"
  12. @cancel="isShow = false"
  13. v-model="isShow"
  14. >
  15. <a-row :gutter="20" v-if="detailsData">
  16. <a-col :span="8" class="item-cont">
  17. <p class="item-label">购买日期:</p>
  18. <p class="item-main">{{ detailsData.orderDate || '--' }}</p>
  19. </a-col>
  20. <a-col :span="8" class="item-cont">
  21. <p class="item-label">订单号:</p>
  22. <p class="item-main">{{ detailsData.orderBundle.number || '--' }}</p>
  23. </a-col>
  24. <a-col :span="8" class="item-cont">
  25. <p class="item-label">客户名称:</p>
  26. <p class="item-main">{{ detailsData.orderBundle.custName || '--' }}</p>
  27. </a-col>
  28. </a-row>
  29. <a-row :gutter="20" v-if="detailsData">
  30. <a-col :span="8" class="item-cont">
  31. <p class="item-label">手机号:</p>
  32. <p class="item-main">{{ detailsData.orderBundle.custMobile || '--' }}</p>
  33. </a-col>
  34. <a-col :span="8" class="item-cont">
  35. <p class="item-label">销售合作商:</p>
  36. <p class="item-main">{{ detailsData.dataSourceName || '--' }}</p>
  37. </a-col>
  38. <a-col :span="8" class="item-cont">
  39. <p class="item-label">套餐名称:</p>
  40. <p class="item-main">{{ detailsData.orderBundle.bundleName || '--' }}</p>
  41. </a-col>
  42. </a-row>
  43. <a-row :gutter="20" v-if="detailsData">
  44. <a-col :span="8" class="item-cont">
  45. <p class="item-label">套餐价格:</p>
  46. <p class="item-main">{{ detailsData.orderBundle.totalAmount ? detailsData.orderBundle.totalAmount + '元' : '--' }}</p>
  47. </a-col>
  48. <a-col :span="8" class="item-cont">
  49. <p class="item-label">销售人员:</p>
  50. <p class="item-main">{{ detailsData.sellerName || '--' }}</p>
  51. </a-col>
  52. <a-col :span="8" class="item-cont">
  53. <p class="item-label">收款金额:</p>
  54. <p class="item-main">{{ detailsData.orderBundle.payedAmount ? detailsData.orderBundle.payedAmount + '元' : '--' }}</p>
  55. </a-col>
  56. </a-row>
  57. <a-row :gutter="20" v-if="detailsData">
  58. <a-col :span="8" class="item-cont">
  59. <p class="item-label">支付方式:</p>
  60. <p class="item-main">{{ $refs.payType.getNameByCode(detailsData.paymentDetailList[0].payType) }}</p>
  61. </a-col>
  62. </a-row>
  63. <a-tabs type="card">
  64. <a-tab-pane key="1" tab="套餐内容">
  65. <!-- 套餐内容列表 -->
  66. <a-table
  67. ref="tcTable"
  68. size="middle"
  69. :rowKey="record => record.id"
  70. :columns="setMealColumns"
  71. :dataSource="setMealData"
  72. :pagination="false"
  73. :loading="loading"
  74. bordered>
  75. <!-- 到期时间 -->
  76. <span slot="expiryDate" slot-scope="text, record">
  77. <span v-if="record.cycleFlag==0">{{ record.expiryDate }}</span>
  78. <span v-else>--</span>
  79. </span>
  80. <!-- 操作 -->
  81. <span slot="action" slot-scope="text, record">
  82. <a-button v-if="record.isDelay" type="link" @click="openSetDelay(record)">延期</a-button>
  83. <span v-else>--</span>
  84. </span>
  85. </a-table>
  86. </a-tab-pane>
  87. <a-tab-pane key="2" tab="使用记录">
  88. <!-- 使用记录列表 -->
  89. <a-table
  90. ref="recordTable"
  91. size="middle"
  92. :rowKey="record => record.id"
  93. :columns="recordColumns"
  94. :dataSource="recordData"
  95. :pagination="false"
  96. bordered>
  97. <!-- 车牌号 -->
  98. <span slot="vehicleNum" slot-scope="text, record">{{ record.vehicleNum || '--' }}</span>
  99. <!-- 服务门店 -->
  100. <span slot="usedStoreName" slot-scope="text, record">{{ record.usedStoreName || '--' }}</span>
  101. </a-table>
  102. </a-tab-pane>
  103. </a-tabs>
  104. <div class="btn-cont" v-if="detailsData">
  105. <a-button id="detailsSetmealModal-back" @click="isShow = false">返回列表</a-button>
  106. <a-button v-if="detailsData.orderBundle.orderFlag=='PAED'&&detailsData.salesChannelSettleStatus=='NOT_SETTLE'&&recordData.length==0" id="detailsSetmealModal-cancel" type="primary" @click="cancelBuy">取消购买</a-button>
  107. </div>
  108. </a-modal>
  109. <!-- 延期 -->
  110. <delay-modal :openModal="setDelay" :serverData="serverData" @close="closeSetDelay" />
  111. </div>
  112. </template>
  113. <script>
  114. import { STable, VSelect } from '@/components'
  115. import { customerBundleDetail, customerBundleUseHistory, orderCancel } from '@/api/customerBundle.js'
  116. import DelayModal from './delayModal.vue'
  117. export default {
  118. name: 'SetmealDetailModal',
  119. components: { STable, VSelect, DelayModal },
  120. props: {
  121. openModal: {
  122. // 弹框是否展示
  123. type: Boolean,
  124. default: false
  125. },
  126. setmealId: {
  127. // 套餐id
  128. type: String,
  129. default: ''
  130. }
  131. },
  132. data () {
  133. return {
  134. isShow: this.openModal, // 弹框是否展示
  135. setMealColumns: [
  136. { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
  137. { title: '服务名称', dataIndex: 'itemName', width: 200, align: 'center' },
  138. { title: '到期时间', scopedSlots: { customRender: 'expiryDate' }, width: 100, align: 'center' },
  139. { title: '总次数', dataIndex: 'times', width: 100, align: 'center' },
  140. { title: '剩余次数', dataIndex: 'remainTimes', width: 100, align: 'center' },
  141. { title: '已用次数', dataIndex: 'usedTimes', width: 100, align: 'center' },
  142. { title: '过期次数', dataIndex: 'expiryTimes', width: 100, align: 'center' },
  143. { title: '退款次数', dataIndex: 'refundTimes', width: 100, align: 'center' },
  144. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center' }
  145. ],
  146. recordColumns: [
  147. { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
  148. { title: '使用时间', dataIndex: 'usedTime', width: 100, align: 'center' },
  149. { title: '服务内容', dataIndex: 'itemName', width: 100, align: 'center' },
  150. { title: '服务门店', scopedSlots: { customRender: 'usedStoreName' }, width: 100, align: 'center' },
  151. { title: '核销单号', dataIndex: 'bizNum', width: 100, align: 'center' }
  152. ],
  153. setMealData: [], // 套餐内容
  154. recordData: [], // 使用记录
  155. detailsData: null, // 套餐数据
  156. setDelay: false, // 延期设置
  157. serverData: null, // 套餐包含服务 数据
  158. loading: false
  159. }
  160. },
  161. methods: {
  162. // 套餐详情
  163. getSetmealInfo () {
  164. this.loading = true
  165. // 套餐详情
  166. customerBundleDetail({ id: this.setmealId }).then(res => {
  167. if (res.status == 200) {
  168. this.detailsData = res.data
  169. if (res.data && res.data.customerBundleItemList && res.data.customerBundleItemList.length > 0) {
  170. res.data.customerBundleItemList.map((item, index) => {
  171. item.no = index + 1
  172. item.isDelay = (item.expiryDate ? item.expiryDate.substr(0, 10) != '2099-01-01' : false) && (item.cycleFlag == 0) && (res.data.orderBundle.orderFlag != 'RUND')
  173. })
  174. this.setMealData = res.data.customerBundleItemList
  175. } else {
  176. this.setMealData = []
  177. }
  178. } else {
  179. this.detailsData = null
  180. this.setMealData = []
  181. }
  182. this.loading = false
  183. })
  184. // 使用记录
  185. customerBundleUseHistory({ id: this.setmealId }).then(res => {
  186. if (res.status == 200) {
  187. if (res.data && res.data.length > 0) {
  188. res.data.map((item, index) => {
  189. item.no = index + 1
  190. })
  191. this.recordData = res.data
  192. } else {
  193. this.recordData = []
  194. }
  195. } else {
  196. this.recordData = []
  197. }
  198. })
  199. },
  200. // 取消购买
  201. cancelBuy () {
  202. const _this = this
  203. this.$confirm({
  204. title: '取消购买',
  205. content: '取消购买后,套餐内所有服务的剩余次数变为0,用户无法再使用套餐。确认取消购买吗?',
  206. onOk: () => {
  207. orderCancel({ id: _this.setmealId }).then(res => {
  208. if (res.status == 200) {
  209. _this.$emit('refrresh')
  210. }
  211. })
  212. },
  213. onCancel () {}
  214. })
  215. },
  216. // 延期
  217. openSetDelay (row) {
  218. this.serverData = row
  219. this.setDelay = true
  220. },
  221. // 关闭延期
  222. closeSetDelay () {
  223. this.getSetmealInfo()
  224. this.serverData = null
  225. this.setDelay = false
  226. }
  227. },
  228. watch: {
  229. // 父页面传过来的弹框状态
  230. openModal (newValue, oldValue) {
  231. this.isShow = newValue
  232. },
  233. // 重定义的弹框状态
  234. isShow (val) {
  235. if (!val) {
  236. this.$emit('close')
  237. this.setMealData = []
  238. this.recordData = []
  239. this.detailsData = null
  240. }
  241. },
  242. setmealId (newValue, oldValue) {
  243. if (newValue && this.isShow) {
  244. this.getSetmealInfo()
  245. }
  246. }
  247. }
  248. }
  249. </script>
  250. <style lang="less">
  251. .DetailsSetmealModal {
  252. .ant-modal-body {
  253. padding: 24px 40px;
  254. }
  255. .item-cont {
  256. margin-bottom: 15px;
  257. display: flex;
  258. .item-label {
  259. width: 115px;
  260. font-size: 14px;
  261. color: rgba(0, 0, 0, 0.85);
  262. flex-shrink: 0;
  263. }
  264. .item-main {
  265. flex-grow: 1;
  266. .wd-icon {
  267. display: block;
  268. }
  269. }
  270. .guidance-con {
  271. border: 1px dashed #e8e8e8;
  272. border-radius: 6px;
  273. padding: 20px;
  274. img {
  275. max-width: 100%;
  276. }
  277. }
  278. .period-price-con {
  279. border-bottom: 1px solid #e8e8e8;
  280. }
  281. .item-period {
  282. display: flex;
  283. align-items: center;
  284. justify-content: space-evenly;
  285. flex-grow: 1;
  286. border: 1px solid #e8e8e8;
  287. border-width: 1px 1px 0;
  288. text-align: center;
  289. .period,
  290. .period-price {
  291. padding: 5px 0;
  292. border-right: 1px solid #e8e8e8;
  293. }
  294. .period-price:last-child {
  295. border-right: none;
  296. }
  297. }
  298. }
  299. .btn-cont {
  300. text-align: center;
  301. margin: 50px 0 10px;
  302. button{
  303. margin: 0 20px;
  304. }
  305. }
  306. }
  307. </style>