PurchasedServiceDetail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <a-card>
  3. <a-spin :spinning="loading">
  4. <a-card class="detail-card" :bordered="false" title="基本信息">
  5. <detail-list>
  6. <detail-list-item term="订单编号">{{ orderBundle.number ? orderBundle.number : '--' }}</detail-list-item>
  7. <detail-list-item term="订单来源">{{ dataSourceName ? dataSourceName : '--' }}</detail-list-item>
  8. <detail-list-item term="下单时间">{{ orderBundle.orderDate ? orderBundle.orderDate : '--' }}</detail-list-item>
  9. <detail-list-item term="订单状态">{{ palyStatus ? palyStatus :'--' }}</detail-list-item>
  10. <detail-list-item term="客户信息">{{ custInfo ? custInfo : '--' }}</detail-list-item>
  11. <detail-list-item term="应付金额">¥{{ orderBundle.totalAmount ? orderBundle.totalAmount :'--' }}</detail-list-item>
  12. <detail-list-item term="支付时间" v-if="isPay">{{ payDate ? payDate : '--' }}</detail-list-item>
  13. <detail-list-item term="支付金额" v-if="isPay">¥{{ orderBundle.payedAmount ? orderBundle.payedAmount : '--' }}</detail-list-item>
  14. </detail-list>
  15. </a-card>
  16. <a-card class="detail-card" :bordered="false" title="服务内容">
  17. <a-table
  18. :columns="columns"
  19. rowKey="id"
  20. :dataSource="customerBundleItemList"
  21. bordered
  22. :pagination="false">
  23. <span slot="no" slot-scope="text, record, index">
  24. <template>
  25. {{ index + 1 }}
  26. </template>
  27. </span>
  28. <span slot="hexiao" slot-scope="text, record, index">
  29. <template>
  30. <a-button type="primary" v-if="!isRund && record.isDelay " @click="yanQi(record)" id="PurchasedServiceDetail-yanQi">延期</a-button>
  31. <span v-else>--</span>
  32. </template>
  33. </span>
  34. </a-table>
  35. </a-card>
  36. <!-- 使用记录 -->
  37. <a-card class="detail-card" :bordered="false" title="使用记录">
  38. <a-table
  39. :columns="usedColumns"
  40. rowKey="id"
  41. :dataSource="verificationList"
  42. bordered
  43. v-if="verificationList && verificationList.length > 0"
  44. :pagination="false">
  45. <span slot="no" slot-scope="text, record, index">
  46. <template>
  47. {{ index + 1 }}
  48. </template>
  49. </span>
  50. </a-table>
  51. <div class="detail-card-info" v-else>
  52. 此订单没有使用记录
  53. </div>
  54. </a-card>
  55. <!-- 取消购买 -->
  56. <a-card class="detail-card" :bordered="false" style="text-align: center;">
  57. <a-button v-if="!verificationList && salesChannelSettleStatus== 'NOT_SETTLE' && palyStatus =='已支付' " type="primary" @click="canselBuy" id="PurchasedServiceDetail-canselBuy">取消购买</a-button>
  58. <a-button style="margin-left: 20px;" @click="toList">返回列表</a-button>
  59. </a-card>
  60. <!-- 延期弹窗 -->
  61. <yanQi-modal :yanQiData="yanQiData" :yanqiModal="yanqiModal" @close="canselYq"></yanQi-modal>
  62. </a-spin>
  63. </a-card>
  64. </template>
  65. <script>
  66. import { customerBundleDetail, orderCancel } from '@/api/customerBundle'
  67. import { getLookUpDataBy } from '@/api/data'
  68. import { PageView } from '@/layouts'
  69. import { STable } from '@/components'
  70. import yanQiModal from './yanQiModal.vue'
  71. import DetailList from '@/components/tools/DetailList'
  72. import _ from 'lodash'
  73. import moment from 'moment'
  74. const DetailListItem = DetailList.Item
  75. export default {
  76. name: 'OrderAdd',
  77. components: {
  78. PageView,
  79. DetailList,
  80. DetailListItem,
  81. STable,
  82. yanQiModal
  83. },
  84. computed: {
  85. palyStatus () {
  86. const _playStatus = _.find(this.palyStatusList, ['code', this.orderBundle.orderFlag])
  87. if (_playStatus) {
  88. if (_playStatus.code === 'CAEL' || _playStatus.code === 'SYCA') {
  89. return '已取消'
  90. }
  91. return _playStatus.dispName
  92. }
  93. return ''
  94. },
  95. palyStatusStr () {
  96. const _playStatus = _.find(this.palyStatusList, ['code', this.orderBundle.orderFlag])
  97. if (_playStatus) {
  98. if (_playStatus.code === 'SYCA') {
  99. return '超时未支付自动取消'
  100. }
  101. return _playStatus.dispName
  102. }
  103. return ''
  104. },
  105. isPay () {
  106. return this.orderBundle.orderFlag === 'PAED'
  107. },
  108. isRund(){
  109. return this.orderBundle.orderFlag === 'RUND'
  110. },
  111. isCancel () {
  112. return this.orderBundle.orderFlag === 'CAEL' || this.orderBundle.orderFlag === 'SYCA'
  113. },
  114. payDate () {
  115. return _.get(this, 'paymentDetailList.payDate')
  116. },
  117. custInfo () {
  118. let info = null
  119. if (this.customer) {
  120. info = this.customer.name
  121. if (info) {
  122. info = info + '-' + this.customer.mobile
  123. } else {
  124. info = this.customer.mobile
  125. }
  126. } else {
  127. info = this.orderBundle.custMobile
  128. if (this.orderBundle.vehicleNumber) {
  129. info += '(' + this.orderBundle.vehicleNumber + ')'
  130. }
  131. }
  132. return info
  133. }
  134. },
  135. data () {
  136. return {
  137. form: this.$form.createForm(this),
  138. loading: false,
  139. // showBackNum:true,
  140. customerCoupon: {},
  141. palyStatusList: [],
  142. yanqiModal: false,
  143. hexiaoModal: false,
  144. buyModal: false,
  145. orderBundleId: '',
  146. yanQiData: null,
  147. hxCustomerBundleItemId: '',
  148. dataSourceName: '',
  149. salesChannelSettleStatus: '', // 结算状态
  150. customer: null,
  151. orderBundle: {},
  152. payDetail: {},
  153. verificationList: [],
  154. customerBundleItemList: [],
  155. coupon: {},
  156. columns: [
  157. {
  158. title: '服务名称',
  159. dataIndex: 'itemName',
  160. width: 100,
  161. align: 'center'
  162. },
  163. {
  164. title: '到期时间',
  165. dataIndex: 'expiryDate',
  166. width: 100,
  167. align: 'center'
  168. },
  169. {
  170. title: '购买数量',
  171. dataIndex: 'times',
  172. width: 100,
  173. align: 'center'
  174. },
  175. {
  176. title: '剩余次数',
  177. dataIndex: 'remainTimes',
  178. width: 100,
  179. align: 'center'
  180. },
  181. {
  182. title: '已用次数',
  183. dataIndex: 'usedTimes',
  184. width: 100,
  185. align: 'center'
  186. },
  187. {
  188. title: '过期次数',
  189. dataIndex: 'expiryTimes',
  190. width: 100,
  191. align: 'center'
  192. },
  193. {
  194. title: '退款次数',
  195. dataIndex: 'refundTimes',
  196. width: 100,
  197. align: 'center'
  198. },
  199. {
  200. title: '操作',
  201. width: 100,
  202. align: 'center',
  203. scopedSlots: {
  204. customRender: 'hexiao'
  205. }
  206. }
  207. ],
  208. usedColumns: [{
  209. title: '序号',
  210. scopedSlots: {
  211. customRender: 'no'
  212. },
  213. width: 60,
  214. align: 'center'
  215. },
  216. {
  217. title: '服务名称',
  218. dataIndex: 'itemName',
  219. width: 100,
  220. align: 'center'
  221. },
  222. {
  223. title: '使用时间',
  224. dataIndex: 'usedTime',
  225. width: 100,
  226. align: 'center'
  227. },
  228. {
  229. title: '使用门店',
  230. dataIndex: 'usedStoreName',
  231. width: 100,
  232. align: 'center'
  233. },
  234. {
  235. title: '核销单号',
  236. dataIndex: 'bizNum',
  237. width: 200,
  238. align: 'center'
  239. },
  240. {
  241. title: '门店结算金额',
  242. dataIndex: 'accountPrice',
  243. width: 100,
  244. align: 'center'
  245. }
  246. ]
  247. }
  248. },
  249. created () {
  250. this.initPage()
  251. },
  252. beforeRouteEnter (to, from, next) {
  253. next(vm => {
  254. console.log(vm.$route.params.id)
  255. // vm.clear()
  256. if (to.query.id) {
  257. vm.initPage()
  258. }
  259. })
  260. },
  261. methods: {
  262. moment,
  263. // 不可选日期
  264. disabledDate (current) {
  265. return current && current < moment().subtract(1, 'days')
  266. },
  267. initPage () {
  268. const _this = this
  269. this.loading = true
  270. getLookUpDataBy({
  271. type: 'PAY_STATUS'
  272. }).then(res => {
  273. if (res.status === '200') {
  274. _this.palyStatusList = res.data
  275. }
  276. return customerBundleDetail({
  277. id: _this.$route.params.id
  278. })
  279. }).then(res => {
  280. if (res.status + '' === '200') {
  281. const _data = res.data
  282. _this.orderBundleId = _data.orderBundleId
  283. _this.customer = _data.customer
  284. _this.dataSourceName = _data.dataSourceName
  285. _this.salesChannelSettleStatus = _data.salesChannelSettleStatus
  286. _this.orderBundle = _data.orderBundle
  287. if (_data.paymentDetailList && _data.paymentDetailList.length) {
  288. _this.paymentDetailList = _data.paymentDetailList[0]
  289. }
  290. _this.coupon = _data.coupon
  291. if (_data.customerCoupon) {
  292. _this.customerCoupon = _data.customerCoupon
  293. }
  294. _this.customerBundleItemList = _data.customerBundleItemList
  295. _this.customerBundleItemList.map((item, index) => {
  296. // item.no = index + 1
  297. item.isDelay = item.expiryDate ? item.expiryDate.substr(0, 10) != '2099-01-01' : false
  298. })
  299. _this.verificationList = _data.verificationList
  300. }
  301. this.loading = false
  302. })
  303. },
  304. // 延期
  305. yanQi (row) {
  306. this.yanQiData = row
  307. this.yanqiModal = true
  308. },
  309. // 关闭延期弹窗
  310. canselYq () {
  311. this.initPage()
  312. this.yanQiData = null
  313. this.yanqiModal = false
  314. },
  315. // 取消购买
  316. canselBuy () {
  317. this.$confirm({
  318. title: '取消购买',
  319. content: '取消购买后,套餐内所有服务的剩余次数变为0,用户无法再使用套餐。确认取消购买吗?',
  320. onOk: () => {
  321. orderCancel({
  322. id: this.$route.params.id
  323. }).then(res => {
  324. if (res.status == 200) {
  325. this.$message.info(res.message)
  326. this.$router.push({ name: 'PurchasedServiceList' })
  327. }
  328. })
  329. },
  330. onCancel () {}
  331. })
  332. },
  333. toList () {
  334. this.$router.push({ name: 'PurchasedServiceList' })
  335. },
  336. // quxiao
  337. canselGM () {
  338. this.buyModal = false
  339. this.hxCustomerBundleItemId = ''
  340. }
  341. }
  342. }
  343. </script>
  344. <style scoped>
  345. .detail-card+.detail-card {
  346. margin-top: 10px;
  347. }
  348. .detail-card-info {
  349. text-align: center;
  350. font-size: 1.1em;
  351. }
  352. .button-row {
  353. padding-top: 20px;
  354. text-align: center;
  355. }
  356. .button-row .ant-btn {
  357. margin-left: 20px;
  358. }
  359. </style>