SetmealDetailModal.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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></a-table>
  74. </a-tab-pane>
  75. <a-tab-pane key="2" tab="使用记录">
  76. <!-- 使用记录列表 -->
  77. <a-table
  78. ref="recordTable"
  79. size="middle"
  80. :rowKey="record => record.id"
  81. :columns="recordColumns"
  82. :dataSource="recordData"
  83. :pagination="false"
  84. bordered>
  85. <!-- 车牌号 -->
  86. <span slot="vehicleNum" slot-scope="text, record">{{ record.vehicleNum || '--' }}</span>
  87. <!-- 服务门店 -->
  88. <span slot="usedStoreName" slot-scope="text, record">{{ record.usedStoreName || '--' }}</span>
  89. </a-table>
  90. </a-tab-pane>
  91. </a-tabs>
  92. <div class="btn-cont"><a-button id="detailsSetmealModal-back" @click="isShow = false">返回列表</a-button></div>
  93. </a-modal>
  94. </div>
  95. </template>
  96. <script>
  97. import { STable, VSelect } from '@/components'
  98. import { customerBundleDetail, customerBundleUseHistory } from '@/api/customerBundle.js'
  99. export default {
  100. name: 'SetmealDetailModal',
  101. components: { STable, VSelect },
  102. props: {
  103. openModal: {
  104. // 弹框是否展示
  105. type: Boolean,
  106. default: false
  107. },
  108. setmealId: {
  109. // 套餐id
  110. type: String,
  111. default: ''
  112. }
  113. },
  114. data () {
  115. return {
  116. isShow: this.openModal, // 弹框是否展示
  117. setMealColumns: [
  118. { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
  119. { title: '内容', dataIndex: 'itemName', width: 200, align: 'center' },
  120. { title: '剩余数量', dataIndex: 'remainTimes', width: 100, align: 'center' }
  121. ],
  122. recordColumns: [
  123. { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
  124. { title: '使用时间', dataIndex: 'usedTime', width: 100, align: 'center' },
  125. { title: '服务内容', dataIndex: 'bundItemName', width: 100, align: 'center' },
  126. { title: '服务门店', scopedSlots: { customRender: 'usedStoreName' }, width: 100, align: 'center' },
  127. { title: '核销单号', dataIndex: 'bizNum', width: 100, align: 'center' }
  128. ],
  129. setMealData: [], // 套餐内容
  130. recordData: [], // 使用记录
  131. detailsData: null // 套餐数据
  132. }
  133. },
  134. methods: {
  135. // 套餐详情
  136. getSetmealInfo (id) {
  137. // 套餐详情
  138. customerBundleDetail({ id: id }).then(res => {
  139. console.log(res)
  140. if (res.status == 200) {
  141. this.detailsData = res.data
  142. if (res.data && res.data.customerBundleItemList && res.data.customerBundleItemList.length > 0) {
  143. res.data.customerBundleItemList.map((item, index) => {
  144. item.no = index + 1
  145. })
  146. this.setMealData = res.data.customerBundleItemList
  147. } else {
  148. this.setMealData = []
  149. }
  150. } else {
  151. this.detailsData = null
  152. this.setMealData = []
  153. }
  154. })
  155. // 使用记录
  156. customerBundleUseHistory({ id: id }).then(res => {
  157. console.log(res)
  158. if (res.status == 200) {
  159. if (res.data && res.data.length > 0) {
  160. res.data.map((item, index) => {
  161. item.no = index + 1
  162. })
  163. this.recordData = res.data
  164. } else {
  165. this.recordData = []
  166. }
  167. } else {
  168. this.recordData = []
  169. }
  170. })
  171. }
  172. },
  173. watch: {
  174. // 父页面传过来的弹框状态
  175. openModal (newValue, oldValue) {
  176. this.isShow = newValue
  177. },
  178. // 重定义的弹框状态
  179. isShow (val) {
  180. if (!val) {
  181. this.$emit('close')
  182. }
  183. },
  184. setmealId (newValue, oldValue) {
  185. if (newValue && this.isShow) {
  186. this.getSetmealInfo(newValue)
  187. }
  188. }
  189. }
  190. }
  191. </script>
  192. <style lang="less">
  193. .DetailsSetmealModal {
  194. .ant-modal-body {
  195. padding: 24px 40px;
  196. }
  197. .item-cont {
  198. margin-bottom: 15px;
  199. display: flex;
  200. .item-label {
  201. width: 115px;
  202. font-size: 14px;
  203. color: rgba(0, 0, 0, 0.85);
  204. flex-shrink: 0;
  205. }
  206. .item-main {
  207. flex-grow: 1;
  208. .wd-icon {
  209. display: block;
  210. }
  211. }
  212. .guidance-con {
  213. border: 1px dashed #e8e8e8;
  214. border-radius: 6px;
  215. padding: 20px;
  216. img {
  217. max-width: 100%;
  218. }
  219. }
  220. .period-price-con {
  221. border-bottom: 1px solid #e8e8e8;
  222. }
  223. .item-period {
  224. display: flex;
  225. align-items: center;
  226. justify-content: space-evenly;
  227. flex-grow: 1;
  228. border: 1px solid #e8e8e8;
  229. border-width: 1px 1px 0;
  230. text-align: center;
  231. .period,
  232. .period-price {
  233. padding: 5px 0;
  234. border-right: 1px solid #e8e8e8;
  235. }
  236. .period-price:last-child {
  237. border-right: none;
  238. }
  239. }
  240. }
  241. .btn-cont {
  242. text-align: center;
  243. margin: 35px 0 10px;
  244. }
  245. }
  246. </style>