SetmealDetailModal.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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. <a-row :gutter="20" v-if="detailsData">
  15. <a-col :span="8" class="item-cont">
  16. <p class="item-label">购买日期:</p>
  17. <p class="item-main">{{ detailsData.orderDate || '--' }}</p>
  18. </a-col>
  19. <a-col :span="8" class="item-cont">
  20. <p class="item-label">工单号:</p>
  21. <p class="item-main">{{ detailsData.orderBundle.number || '--' }}</p>
  22. </a-col>
  23. <a-col :span="8" class="item-cont">
  24. <p class="item-label">客户名称:</p>
  25. <p class="item-main">{{ detailsData.orderBundle.custName || '--' }}</p>
  26. </a-col>
  27. <a-col :span="8" class="item-cont">
  28. <p class="item-label">手机号:</p>
  29. <p class="item-main">{{ detailsData.orderBundle.custMobile || '--' }}</p>
  30. </a-col>
  31. <a-col :span="8" class="item-cont">
  32. <p class="item-label">销售合作商:</p>
  33. <p class="item-main">{{ detailsData.dataSourceName || '--' }}</p>
  34. </a-col>
  35. <a-col :span="8" class="item-cont">
  36. <p class="item-label">套餐名称:</p>
  37. <p class="item-main">{{ detailsData.orderBundle.bundleName || '--' }}</p>
  38. </a-col>
  39. <a-col :span="8" class="item-cont">
  40. <p class="item-label">套餐价格:</p>
  41. <p class="item-main">{{ detailsData.orderBundle.totalAmount ? detailsData.orderBundle.totalAmount + '元' :'--' }}</p>
  42. </a-col>
  43. <a-col :span="8" class="item-cont">
  44. <p class="item-label">销售人员:</p>
  45. <p class="item-main">{{ detailsData.sellerName || '--' }}</p>
  46. </a-col>
  47. <a-col :span="8" class="item-cont">
  48. <p class="item-label">收款金额:</p>
  49. <p class="item-main">{{ detailsData.orderBundle.payedAmount ? detailsData.orderBundle.payedAmount + '元' :'--' }}</p>
  50. </a-col>
  51. <a-col :span="8" class="item-cont">
  52. <p class="item-label">支付方式:</p>
  53. <p class="item-main">{{ $refs.payType.getNameByCode(detailsData.paymentDetailList[0].payType) }}</p>
  54. </a-col>
  55. </a-row>
  56. <a-tabs type="card">
  57. <a-tab-pane key="1" tab="套餐内容">
  58. <!-- 套餐内容列表 -->
  59. <a-table
  60. ref="tcTable"
  61. size="middle"
  62. :rowKey="(record) => record.id"
  63. :columns="setMealColumns"
  64. :dataSource="setMealData"
  65. :pagination="false"
  66. bordered>
  67. </a-table>
  68. </a-tab-pane>
  69. <a-tab-pane key="2" tab="使用记录">
  70. <!-- 使用记录列表 -->
  71. <a-table
  72. ref="recordTable"
  73. size="middle"
  74. :rowKey="(record) => record.id"
  75. :columns="recordColumns"
  76. :dataSource="recordData"
  77. :pagination="false"
  78. bordered>
  79. <!-- 车牌号 -->
  80. <span slot="vehicleNum" slot-scope="text, record">{{ record.vehicleNum || '--' }}</span>
  81. <!-- 服务门店 -->
  82. <span slot="usedStoreName" slot-scope="text, record">{{ record.usedStoreName || '--' }}</span>
  83. </a-table>
  84. </a-tab-pane>
  85. </a-tabs>
  86. <div class="btn-cont">
  87. <a-button id="detailsSetmealModal-back" @click="isShow=false">返回列表</a-button>
  88. </div>
  89. </a-modal>
  90. </div>
  91. </template>
  92. <script>
  93. import { STable, VSelect } from '@/components'
  94. import { customerBundleDetail, customerBundleUseHistory } from '@/api/customerBundle.js'
  95. export default {
  96. name: 'SetmealDetailModal',
  97. components: { STable, VSelect },
  98. props: {
  99. openModal: { // 弹框是否展示
  100. type: Boolean,
  101. default: false
  102. },
  103. setmealId: { // 套餐id
  104. type: String,
  105. default: ''
  106. }
  107. },
  108. data () {
  109. return {
  110. isShow: this.openModal, // 弹框是否展示
  111. setMealColumns: [
  112. { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
  113. { title: '内容', dataIndex: 'itemName', width: 200, align: 'center' },
  114. { title: '剩余数量', dataIndex: 'remainTimes', width: 100, align: 'center' }
  115. ],
  116. recordColumns: [
  117. { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
  118. { title: '使用时间', dataIndex: 'usedTime', width: 100, align: 'center' },
  119. { title: '车牌号', scopedSlots: { customRender: 'vehicleNum' }, width: 100, align: 'center' },
  120. { title: '服务内容', dataIndex: 'bundItemName', width: 100, align: 'center' },
  121. { title: '服务门店', scopedSlots: { customRender: 'usedStoreName' }, width: 100, align: 'center' },
  122. { title: '使用数量', dataIndex: 'customerBundleItemTimes', width: 100, align: 'center' },
  123. { title: '工单', dataIndex: 'orderNo', width: 100, align: 'center' }
  124. ],
  125. setMealData: [], // 套餐内容
  126. recordData: [], // 使用记录
  127. detailsData: null // 套餐数据
  128. }
  129. },
  130. methods: {
  131. // 套餐详情
  132. getSetmealInfo (id) {
  133. // 套餐详情
  134. customerBundleDetail({ id: id }).then(res => {
  135. console.log(res)
  136. if (res.status == 200) {
  137. this.detailsData = res.data
  138. if (res.data && res.data.customerBundleItemList && res.data.customerBundleItemList.length > 0) {
  139. res.data.customerBundleItemList.map((item, index) => {
  140. item.no = index + 1
  141. })
  142. this.setMealData = res.data.customerBundleItemList
  143. } else {
  144. this.setMealData = []
  145. }
  146. } else {
  147. this.detailsData = null
  148. this.setMealData = []
  149. }
  150. })
  151. // 使用记录
  152. customerBundleUseHistory({ id: id }).then(res => {
  153. console.log(res)
  154. if (res.status == 200) {
  155. if (res.data && res.data.length > 0) {
  156. res.data.map((item, index) => {
  157. item.no = index + 1
  158. })
  159. this.recordData = res.data
  160. } else {
  161. this.recordData = []
  162. }
  163. } else {
  164. this.recordData = []
  165. }
  166. })
  167. }
  168. },
  169. watch: {
  170. // 父页面传过来的弹框状态
  171. openModal (newValue, oldValue) {
  172. this.isShow = newValue
  173. },
  174. // 重定义的弹框状态
  175. isShow (val) {
  176. if (!val) {
  177. this.$emit('close')
  178. }
  179. },
  180. setmealId (newValue, oldValue) {
  181. if (newValue && this.isShow) {
  182. this.getSetmealInfo(newValue)
  183. }
  184. }
  185. }
  186. }
  187. </script>
  188. <style lang="less">
  189. .DetailsSetmealModal{
  190. .ant-modal-body{
  191. padding: 24px 40px;
  192. }
  193. .item-cont{
  194. margin-bottom: 15px;
  195. display: flex;
  196. align-items: center;
  197. .item-label{
  198. width: 115px;
  199. font-size: 14px;
  200. color: rgba(0, 0, 0, 0.85);
  201. flex-shrink: 0;
  202. }
  203. .item-main{
  204. flex-grow: 1;
  205. .wd-icon{
  206. display: block;
  207. }
  208. }
  209. .guidance-con{
  210. border: 1px dashed #e8e8e8;
  211. border-radius: 6px;
  212. padding: 20px;
  213. img {
  214. max-width: 100%;
  215. }
  216. }
  217. .period-price-con{
  218. border-bottom: 1px solid #e8e8e8;
  219. }
  220. .item-period{
  221. display: flex;
  222. align-items: center;
  223. justify-content: space-evenly;
  224. flex-grow: 1;
  225. border: 1px solid #e8e8e8;
  226. border-width: 1px 1px 0;
  227. text-align: center;
  228. .period, .period-price{
  229. padding: 5px 0;
  230. border-right: 1px solid #e8e8e8;
  231. }
  232. .period-price:last-child{
  233. border-right: none;
  234. }
  235. }
  236. }
  237. .btn-cont{
  238. text-align: center;
  239. margin: 35px 0 10px;
  240. }
  241. }
  242. </style>