SetmealDetailModal.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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. bordered>
  74. <span slot="action" slot-scope="text, record">
  75. <a-button v-if="record.isDelay" type="link" @click="openSetDelay(record)">延期</a-button>
  76. <span v-else>--</span>
  77. </span>
  78. </a-table>
  79. </a-tab-pane>
  80. <a-tab-pane key="2" tab="使用记录">
  81. <!-- 使用记录列表 -->
  82. <a-table
  83. ref="recordTable"
  84. size="middle"
  85. :rowKey="record => record.id"
  86. :columns="recordColumns"
  87. :dataSource="recordData"
  88. :pagination="false"
  89. bordered>
  90. <!-- 车牌号 -->
  91. <span slot="vehicleNum" slot-scope="text, record">{{ record.vehicleNum || '--' }}</span>
  92. <!-- 服务门店 -->
  93. <span slot="usedStoreName" slot-scope="text, record">{{ record.usedStoreName || '--' }}</span>
  94. </a-table>
  95. </a-tab-pane>
  96. </a-tabs>
  97. <div class="btn-cont" v-if="detailsData">
  98. <a-button id="detailsSetmealModal-back" @click="isShow = false">返回列表</a-button>
  99. <a-button v-if="detailsData.salesChannelSettleStatus=='NOT_SETTLE'&&recordData.length==0" id="detailsSetmealModal-cancel" type="primary" @click="cancelBuy">取消购买</a-button>
  100. </div>
  101. </a-modal>
  102. <!-- 延期 -->
  103. <delay-modal :openModal="setDelay" :serverData="serverData" @close="closeSetDelay" />
  104. </div>
  105. </template>
  106. <script>
  107. import { STable, VSelect } from '@/components'
  108. import { customerBundleDetail, customerBundleUseHistory, orderCancel } from '@/api/customerBundle.js'
  109. import DelayModal from './delayModal.vue'
  110. export default {
  111. name: 'SetmealDetailModal',
  112. components: { STable, VSelect, DelayModal },
  113. props: {
  114. openModal: {
  115. // 弹框是否展示
  116. type: Boolean,
  117. default: false
  118. },
  119. setmealId: {
  120. // 套餐id
  121. type: String,
  122. default: ''
  123. }
  124. },
  125. data () {
  126. return {
  127. isShow: this.openModal, // 弹框是否展示
  128. setMealColumns: [
  129. { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
  130. { title: '服务名称', dataIndex: 'itemName', width: 200, align: 'center' },
  131. { title: '到期时间', dataIndex: 'expiryDate', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  132. { title: '总次数', dataIndex: 'times', width: 100, align: 'center' },
  133. { title: '剩余次数', dataIndex: 'remainTimes', width: 100, align: 'center' },
  134. { title: '已用次数', dataIndex: 'usedTimes', width: 100, align: 'center' },
  135. { title: '过期次数', dataIndex: 'expiryTimes', width: 100, align: 'center' },
  136. { title: '退款次数', dataIndex: 'refundTimes', width: 100, align: 'center' },
  137. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center' }
  138. ],
  139. recordColumns: [
  140. { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
  141. { title: '使用时间', dataIndex: 'usedTime', width: 100, align: 'center' },
  142. { title: '服务内容', dataIndex: 'itemName', width: 100, align: 'center' },
  143. { title: '服务门店', scopedSlots: { customRender: 'usedStoreName' }, width: 100, align: 'center' },
  144. { title: '核销单号', dataIndex: 'bizNum', width: 100, align: 'center' }
  145. ],
  146. setMealData: [], // 套餐内容
  147. recordData: [], // 使用记录
  148. detailsData: null, // 套餐数据
  149. setDelay: false, // 延期设置
  150. serverData: null // 套餐包含服务 数据
  151. }
  152. },
  153. methods: {
  154. // 套餐详情
  155. getSetmealInfo () {
  156. // 套餐详情
  157. customerBundleDetail({ id: this.setmealId }).then(res => {
  158. if (res.status == 200) {
  159. this.detailsData = res.data
  160. if (res.data && res.data.customerBundleItemList && res.data.customerBundleItemList.length > 0) {
  161. res.data.customerBundleItemList.map((item, index) => {
  162. item.no = index + 1
  163. item.isDelay = (item.expiryDate ? item.expiryDate.substr(0, 10) != '2099-01-01' : false) && (item.cycleFlag == 0)
  164. })
  165. this.setMealData = res.data.customerBundleItemList
  166. } else {
  167. this.setMealData = []
  168. }
  169. } else {
  170. this.detailsData = null
  171. this.setMealData = []
  172. }
  173. })
  174. // 使用记录
  175. customerBundleUseHistory({ id: this.setmealId }).then(res => {
  176. if (res.status == 200) {
  177. if (res.data && res.data.length > 0) {
  178. res.data.map((item, index) => {
  179. item.no = index + 1
  180. })
  181. this.recordData = res.data
  182. } else {
  183. this.recordData = []
  184. }
  185. } else {
  186. this.recordData = []
  187. }
  188. })
  189. },
  190. // 取消购买
  191. cancelBuy () {
  192. const _this = this
  193. this.$confirm({
  194. title: '取消购买',
  195. content: '取消购买后,套餐内所有服务的剩余次数变为0,用户无法再使用套餐。确认取消购买吗?',
  196. onOk: () => {
  197. orderCancel({ id: _this.setmealId }).then(res => {
  198. if (res.status == 200) {
  199. _this.isShow = false
  200. }
  201. })
  202. },
  203. onCancel () {}
  204. })
  205. },
  206. // 延期
  207. openSetDelay (row) {
  208. this.serverData = row
  209. this.setDelay = true
  210. },
  211. // 关闭延期
  212. closeSetDelay () {
  213. this.getSetmealInfo()
  214. this.serverData = null
  215. this.setDelay = false
  216. }
  217. },
  218. watch: {
  219. // 父页面传过来的弹框状态
  220. openModal (newValue, oldValue) {
  221. this.isShow = newValue
  222. },
  223. // 重定义的弹框状态
  224. isShow (val) {
  225. if (!val) {
  226. this.$emit('close')
  227. }
  228. },
  229. setmealId (newValue, oldValue) {
  230. if (newValue && this.isShow) {
  231. this.getSetmealInfo()
  232. }
  233. }
  234. }
  235. }
  236. </script>
  237. <style lang="less">
  238. .DetailsSetmealModal {
  239. .ant-modal-body {
  240. padding: 24px 40px;
  241. }
  242. .item-cont {
  243. margin-bottom: 15px;
  244. display: flex;
  245. .item-label {
  246. width: 115px;
  247. font-size: 14px;
  248. color: rgba(0, 0, 0, 0.85);
  249. flex-shrink: 0;
  250. }
  251. .item-main {
  252. flex-grow: 1;
  253. .wd-icon {
  254. display: block;
  255. }
  256. }
  257. .guidance-con {
  258. border: 1px dashed #e8e8e8;
  259. border-radius: 6px;
  260. padding: 20px;
  261. img {
  262. max-width: 100%;
  263. }
  264. }
  265. .period-price-con {
  266. border-bottom: 1px solid #e8e8e8;
  267. }
  268. .item-period {
  269. display: flex;
  270. align-items: center;
  271. justify-content: space-evenly;
  272. flex-grow: 1;
  273. border: 1px solid #e8e8e8;
  274. border-width: 1px 1px 0;
  275. text-align: center;
  276. .period,
  277. .period-price {
  278. padding: 5px 0;
  279. border-right: 1px solid #e8e8e8;
  280. }
  281. .period-price:last-child {
  282. border-right: none;
  283. }
  284. }
  285. }
  286. .btn-cont {
  287. text-align: center;
  288. margin: 50px 0 10px;
  289. button{
  290. margin: 0 20px;
  291. }
  292. }
  293. }
  294. </style>