order-details.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <template>
  2. <view class="container details clearfix" :style="{paddingBottom :isIphoneX ? (130+68)+'rpx' : '130rpx'}">
  3. <!-- 自定义返回 -->
  4. <header-back :systeminfo='systeminfo' :navbar-data='nvabarData' :headerBtnPosi ="headerBtnPosi" :isShare='isOrderShare'></header-back>
  5. <view class="container-details" :style="{paddingTop:navbarHeight+'px'}">
  6. <view class="status-text">
  7. <view class="view-type">{{ information.status | TextFormat }}</view>
  8. <text class="bage-buss" v-if="information.orderSubmitType == 3 || information.orderSubmitType == 4">协销</text>
  9. <text class="bage-auto" v-if="information.orderSubmitType == 0 || information.orderSubmitType == 1 ||information.orderSubmitType == 2">自主</text>
  10. </view>
  11. <!-- 地址选择 -->
  12. <order-address ref="orderAddress" v-if="isRequest" :addressData="addressData"></order-address>
  13. <!-- 商品 -->
  14. <goods-list ref='goods' v-if="isRequest" :shopOrderData="shopOrderData" @popupClick="hanldePopupFn"></goods-list>
  15. <!-- 订单信息 -->
  16. <order-information ref="information" v-if="isRequest" :information="information"></order-information>
  17. <!-- 发票信息 -->
  18. <invoice-tent ref="invoice" v-if="isRequest" :orderInvoice="orderInvoice"></invoice-tent>
  19. <!-- 转账信息 -->
  20. <!-- <transfe-record ref="transfe" v-if="receiptAmount == 0 || onlinePayFlag == '1'"></transfe-record> -->
  21. <!-- 支付记录 -->
  22. <payment-record ref="payment" v-if="isRequest" :discernReceiptList="discernReceiptList" :receiptAmount="receiptAmount"></payment-record>
  23. <!-- 退款记录 -->
  24. <refund-record ref="refund" v-if="isRequest" :returnedPurchaseList="returnedPurchaseList" :returnedPurchaseFee="returnedPurchaseFee"></refund-record>
  25. <view class="clause" @tap.stop="openclauseConten(clauseData.id)" :class="clauseData.name=='无条款'?'noclick':''">
  26. 售后条款:<label class="text" :class="clauseData.name=='无条款'?'color-bg':''">{{clauseData.name}}</label>
  27. </view>
  28. <!-- 底部button -->
  29. <order-button ref="orderButton"
  30. v-if= "isRequest"
  31. :status= "btnStatus"
  32. :shareCode= "shareCode"
  33. :order="orderInfo"
  34. @buttonConfirm="handButtonConfirm">
  35. </order-button>
  36. </view>
  37. <!-- 付款弹窗 -->
  38. <order-model v-if="isPayModel"
  39. :payModelData="payModelData"
  40. :modelType='modelType'
  41. @cancelConfirm = "hanldCancelConfirm"
  42. @paymentConfirm ='hanldPaymentConfirm'/>
  43. <!-- 分享弹窗 -->
  44. <share-alert :orderID="orderID"
  45. v-if="isShareModal"
  46. @btnConfirm ='onShareAppMessage'>
  47. </share-alert>
  48. <!-- 促销活动弹窗 -->
  49. <activi-popup :Promotion="handlerPros" :popupShow="popupShow"></activi-popup>
  50. </view>
  51. </template>
  52. <script>
  53. import headerBack from '@/components/cm-module/headerNavbar/header-back' //自定义导航
  54. import orderAddress from '@/components/cm-module/orderDetails/orderAddress' //地址信息
  55. import goodsList from '@/components/cm-module/orderDetails/goodsList' //商品列表
  56. import invoiceTent from '@/components/cm-module/orderDetails/invoiceTent' //发票信息
  57. import orderInformation from '@/components/cm-module/orderDetails/orderInformation' //订单信息
  58. import transfeRecord from '@/components/cm-module/orderDetails/transfeRecord' //转账信息
  59. import paymentRecord from '@/components/cm-module/orderDetails/paymentRecord' //支付记录
  60. import refundRecord from '@/components/cm-module/orderDetails/refundRecord' //退款记录
  61. import orderButton from '@/components/cm-module/orderDetails/orderButton' //底部按钮
  62. import shareAlert from '@/components/cm-module/modelAlert/shareAlert.vue' //分享弹窗
  63. import orderModel from '@/components/cm-module/modelAlert/order-alert' //付款弹窗
  64. import activiPopup from "@/components/cm-module/orderDetails/activipopu" //促销活动弹窗
  65. import { queryOrderDetails,cancelOrder,deleteOrder,confirmReceipt,affirmOrder } from "@/api/order.js"
  66. export default {
  67. components:{
  68. headerBack,
  69. orderInformation,
  70. orderAddress,
  71. invoiceTent,
  72. goodsList,
  73. transfeRecord,
  74. paymentRecord,
  75. refundRecord,
  76. orderButton,
  77. shareAlert,
  78. orderModel,
  79. activiPopup
  80. },
  81. data() {
  82. return {
  83. state:0,
  84. userID:'',
  85. orderID:'',
  86. shareCode:'', //分享码
  87. shareType:'', //分享登录页过来记录的状态
  88. cellPhone:'', //客服电话
  89. payStatus:0,
  90. btnStatus:0, //按钮组件状态
  91. onlinePayFlag:'',
  92. isRequest:false, //是否加载完成渲染子组件
  93. isOrderShare:false,
  94. isShareModal:false,
  95. isPayModel:false,
  96. modelType:0,
  97. orderInfo:{},
  98. alertOrderInfo:{},
  99. payModelData:{},
  100. addressData:{}, //地址信息初始化
  101. information:{}, //订单信息初始化
  102. shopOrderData:{}, //商品信息初始化
  103. orderInvoice:{}, //发票信息初始化
  104. returnedPurchaseList:{}, //退款信息初始化
  105. discernReceiptList:{}, //支付信息初始化
  106. receiptAmount:0, //支付金额
  107. returnedPurchaseFee:0, //退款金额
  108. navbarHeight:'',
  109. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  110. systeminfo: this.setSysteminfo(), //获取设备信息
  111. isIphoneX:this.$store.state.isIphoneX,
  112. CustomBar:this.CustomBar,// 顶部导航栏高度
  113. popupShow:false,
  114. handlerPros:{},
  115. nvabarData: { //顶部自定义导航
  116. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示
  117. title: '订单详情', // 导航栏 中间的标题
  118. },
  119. clauseData:{},
  120. }
  121. },
  122. onLoad(option){
  123. this.shareType = option.type;
  124. this.orderID = option.orderID
  125. if(this.shareType ==='share'){
  126. this.state = 0
  127. this.isOrderShare = true
  128. }else if(option.type === 'confim' ||option.type === 'search'){
  129. this.state = 0
  130. }else{
  131. this.state = option.state
  132. }
  133. this.getHeaderTopHeight()
  134. this.initOrderDetaileData()
  135. },
  136. filters:{
  137. TextFormat(status) {//处理金额
  138. let HtmlText,
  139. typeTextObject={
  140. 0:'待确认',
  141. 4:'交易完成',
  142. 5:'订单完成',
  143. 6:'已关闭',
  144. 7:'交易全退',
  145. 77:'交易全退',
  146. 11:'待付款待发货',
  147. 12:'待付款部分发货',
  148. 13:'待付款已发货',
  149. 21:'部分付款待发货',
  150. 22:'部分付款部分发货',
  151. 23:'部分付款已发货',
  152. 31:'已付款待发货',
  153. 32:'已付款部分发货',
  154. 33:'已付款已发货',
  155. 111:'待付款待发货',
  156. };
  157. Object.keys(typeTextObject).forEach(key => {
  158. if(key == status){
  159. HtmlText = typeTextObject[key]
  160. }
  161. })
  162. return HtmlText
  163. },
  164. },
  165. methods: {
  166. openclauseConten(id){
  167. this.$api.navigateTo(`/pages/service/sellconten?clauseId=${id}`)
  168. },
  169. initOrderDetaileData(){//初始化页面数据@参数:订单ID
  170. queryOrderDetails({ orderID : this.orderID }).then(response =>{
  171. let resData = response.data;
  172. this.isRequest = true
  173. this.orderInfo = resData.order
  174. this.userID = resData.order.userID
  175. this.shareCode = resData.shareCode
  176. this.addressData = resData.userInfo
  177. this.information = resData.order
  178. this.btnStatus = resData.order.status
  179. this.payStatus = resData.order.payStatus
  180. this.payableAmount = resData.order.payableAmount
  181. this.shopOrderData = resData.shopOrderList
  182. this.orderInvoice = resData.orderInvoice
  183. this.onlinePayFlag = resData.order.onlinePayFlag
  184. this.returnedPurchaseList = resData.returnedPurchaseList
  185. this.discernReceiptList = resData.discernReceiptList
  186. this.receiptAmount = resData.order.receiptAmount
  187. this.returnedPurchaseFee = resData.order.returnedPurchaseFee
  188. this.clauseData = resData.clause
  189. }).catch(error =>{
  190. this.$util.modal('提示','订单查询失败,请稍后重试~','确定','',false,() =>{
  191. this.$api.switchTabTo('/pages/tabBar/home/index')
  192. })
  193. })
  194. },
  195. handButtonConfirm(data){//监听点击时间的按钮类型并执行...
  196. this.handShowAlert(data)
  197. },
  198. handShowAlert(data){//判断点击的按钮类型并执行...
  199. switch(data.type){
  200. case 'delete':
  201. this.handOrderDetele();
  202. break
  203. case 'cancel':
  204. this.handCenceConfirm();
  205. break
  206. case 'query':
  207. this.$api.navigateTo('/pages/user/order/order-logistics?orderID='+this.orderID)
  208. break
  209. case 'confirm':
  210. this.handOrderConfirm()
  211. break
  212. case 'pay':
  213. this.getOrderPaymentValidation(data)
  214. break
  215. case 'confirmation':
  216. this.handOrderConfirmation()
  217. break
  218. }
  219. },
  220. getOrderPaymentValidation(data){//监听根据付款状态做操作
  221. this.OrderService.OrderPaymentValidation({orderId:data.orderId}).then(response =>{
  222. let dataCode = response.data.code
  223. this.payModelData = response.data
  224. switch(dataCode){
  225. case 1:
  226. this.isPayModel = true;
  227. this.modelType = 1
  228. break;
  229. case 2:
  230. this.isPayModel = true;
  231. this.modelType = 2
  232. break;
  233. case -1:
  234. this.$util.modal('','订单已申请全部退款,无需再付款!','确定','',false,() =>{})
  235. break;
  236. default:
  237. if(response.data.onlinePayFlag == '1'){
  238. this.$api.navigateTo(`/pages/user/order/order-payment?type=onlinePay&Amount=${response.data.pendingPayments}&orderID=${data.orderId}`)
  239. }else{
  240. this.$api.navigateTo(`/pages/user/order/order-payment?type=payfirm&orderID=${data.orderId}`)
  241. }
  242. }
  243. }).catch(error =>{
  244. this.$util.msg(error.msg,2000)
  245. })
  246. },
  247. hanldPaymentConfirm(data){//余额抵扣跳转
  248. this.OrderService.OrderBalanceDeduction({orderId:data.order.orderId}).then(response =>{
  249. if(data.type === 2){
  250. let _data = {orderID:data.order.orderId}
  251. this.$api.navigateTo(`/pages/user/order/success?type=deduction&data=${JSON.stringify({data:_data})}`)
  252. }else{
  253. if(data.order.onlinePayFlag === '1'){
  254. this.$api.navigateTo(`/pages/user/order/order-payment?type=onlinePay&Amount=${data.order.pendingPayments}&orderID=${data.order.orderId}`)
  255. }else{
  256. this.$api.navigateTo(`/pages/user/order/order-payment?type=payfirm&orderID=${data.order.orderId}`)
  257. }
  258. }
  259. }).catch(error =>{
  260. this.$util.msg(error.msg,2000)
  261. })
  262. },
  263. hanldCancelConfirm(data){//不使用余额抵扣直接跳转收银台
  264. if(data.onlinePayFlag == '1'){
  265. this.$api.navigateTo(`/pages/user/order/order-payment?type=onlinePay&Amount=${this.orderInfo.pendingPayments}&orderID=${data.orderId}`)
  266. }else{
  267. this.$api.navigateTo(`/pages/user/order/order-payment?type=payfirm&orderID=${data.orderId}`)
  268. }
  269. },
  270. handOrderConfirm(){//确认收货
  271. this.$util.modal('提示','是否确认收货','确定','取消',true,() =>{
  272. confirmReceipt({orderID:this.orderID}).then(response =>{
  273. this.$util.msg(response.msg,2000,true,'success');
  274. this.initOrderDetaileData()
  275. }).catch(error =>{
  276. this.$util.msg(error.msg,2000)
  277. })
  278. })
  279. },
  280. handOrderConfirmation (){//确认订单
  281. this.$util.modal('提示','确认此订单?','确定','取消',true,() =>{
  282. affirmOrder({orderID:this.orderID}).then(response =>{
  283. this.$util.msg(response.msg,2000,true,'success');
  284. this.initOrderDetaileData()
  285. }).catch(error =>{
  286. this.$util.msg(error.msg,2000)
  287. })
  288. })
  289. },
  290. handOrderDetele(){//删除订单
  291. this.$util.modal('提示','确认删除该订单吗?','确定','取消',true,() =>{
  292. deleteOrder({orderID:this.orderID}).then(response =>{
  293. this.$util.msg(response.msg,2000,true,'success');
  294. setTimeout(() => {
  295. if(this.shareType ==='share'){
  296. this.$api.switchTabTo('/pages/tabBar/home/index')
  297. }else{
  298. this.$api.redirectTo(`/pages/user/order/order-list?type=detele&state=${this.state}`)
  299. }
  300. },500)
  301. }).catch(error =>{
  302. this.$util.msg(error.msg,2000)
  303. })
  304. })
  305. },
  306. handCenceConfirm(){//取消订单
  307. this.$util.modal('提示','确认取消该订单吗?','确定','取消',true,() =>{
  308. cancelOrder({orderID:this.orderID}).then(response =>{
  309. this.$util.msg(response.msg,2000,true,'success');
  310. this.initOrderDetaileData()
  311. }).catch(error =>{
  312. this.$util.msg(error.msg,2000)
  313. })
  314. })
  315. },
  316. onShareAppMessage(res){//分享转发
  317. this.isShareModal = false
  318. if (res.from === 'button') {
  319. // 来自页面内转发按钮
  320. }
  321. return {
  322. title: '您有新的分享订单,快来查看吧~',
  323. path: `/pages/user/order/order-sharelogin?orderID=${this.orderID}&userID=${this.userID}`,
  324. imageUrl:'https://img.caimei365.com/group1/M00/03/95/Cmis216Sk_SABnOFABZCgCzFV_g063.png'
  325. }
  326. },
  327. hanldePopupFn(data){//监听活动内容
  328. this.popupShow = true
  329. this.handlerPros = data
  330. },
  331. getHeaderTopHeight(){
  332. let statusBarHeight = this.systeminfo.statusBarHeight // 状态栏高度
  333. let headerPosi = this.headerBtnPosi
  334. let btnPosi = { // 胶囊实际位置,坐标信息不是左上角原点
  335. height: headerPosi.height,
  336. width: headerPosi.width,
  337. // 胶囊top - 状态栏高度
  338. top: headerPosi.top - statusBarHeight,
  339. // 胶囊bottom - 胶囊height - 状态栏height (现胶囊bottom 为距离导航栏底部的长度)
  340. bottom: headerPosi.bottom - headerPosi.height - statusBarHeight,
  341. // 屏幕宽度 - 胶囊right
  342. right: this.systeminfo.screenWidth - headerPosi.right
  343. }
  344. this.navbarHeight= headerPosi.bottom + btnPosi.bottom// 原胶囊bottom + 现胶囊bottom
  345. },
  346. setHeaderBtnPosi(){
  347. // 获得胶囊按钮位置信息
  348. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  349. return headerBtnPosi
  350. },
  351. setSysteminfo(){
  352. let systeminfo;
  353. uni.getSystemInfo({ // 获取设备信息
  354. success: (res) => {
  355. systeminfo = res
  356. },
  357. })
  358. return systeminfo
  359. },
  360. },
  361. onShow() {
  362. }
  363. }
  364. </script>
  365. <style lang="scss">
  366. page {
  367. height: auto;
  368. background:#F7F7F7;
  369. }
  370. .details{
  371. padding-bottom: 130rpx;
  372. }
  373. .btn-hover{
  374. background: #FFFFFF;
  375. }
  376. .animation{
  377. /* transition: transform 0.3s ease;*/
  378. transition-property: transform;
  379. transition-duration: 0.3s;
  380. transition-timing-function: ease;
  381. }
  382. .invoice-balance{
  383. width: 702rpx;
  384. height: auto;
  385. padding:0 24rpx;
  386. background: #FFFFFF;
  387. float: left;
  388. margin-top: 24rpx;
  389. margin-bottom: 24rpx;
  390. .balabce-t{
  391. width: 100%;
  392. height: 86rpx;
  393. line-height: 86rpx;
  394. font-size: $font-size-28;
  395. color: $text-color;
  396. float: left;
  397. .balabce-t-le{
  398. float: left;
  399. font-weight: bold;
  400. }
  401. .balabce-t-ri{
  402. float: right;
  403. display: flex;
  404. align-items: center;
  405. .money{
  406. display: flex;
  407. float: left;
  408. }
  409. .checkbox-box{
  410. display: flex;
  411. width: 60rpx;
  412. float: left;
  413. height: 100%;
  414. font-size: $font-size-24;
  415. .checkbox{
  416. width: 40rpx;
  417. text-align: right;
  418. box-sizing: border-box;
  419. text-align: center;
  420. text-decoration: none;
  421. border-radius: 0;
  422. -webkit-tap-highlight-color: transparent;
  423. overflow: hidden;
  424. }
  425. }
  426. }
  427. }
  428. .balabce-b{
  429. width: 100%;
  430. float: left;
  431. overflow: hidden;
  432. .balabce-b-text{
  433. width: 100%;
  434. line-height: 58rpx;
  435. font-size: $font-size-24;
  436. color: #FF2A2A;
  437. text-align: right;
  438. float: right;
  439. }
  440. &.balabce-b--hide {
  441. padding: 0 0;
  442. height: 0px;
  443. line-height: 0px;
  444. }
  445. }
  446. }
  447. .clause{
  448. float: right;
  449. font-size: 24rpx;
  450. color: #999999;
  451. margin-top: 60rpx;
  452. margin-right: 24rpx;
  453. &.noclick{
  454. pointer-events: none;
  455. }
  456. .text{
  457. color: #1890f9;
  458. &.color-bg{
  459. color: #333333;
  460. }
  461. }
  462. }
  463. .status-text{
  464. overflow: hidden;
  465. padding: 24rpx;
  466. background: #fff;
  467. font-size: $font-size-26;
  468. .view-type{
  469. float: left;
  470. color: #ff2a2a;
  471. }
  472. .bage-buss{
  473. display: inline-block;
  474. width: 72rpx;
  475. height: 32rpx;
  476. background:radial-gradient(circle,rgba(255,39,180,1) 0%,rgba(193,77,245,1) 100%);
  477. border-radius: 6rpx;
  478. line-height: 32rpx;
  479. text-align: center;
  480. color: #FFFFFF;
  481. margin-top: 10rpx;
  482. float: right;
  483. }
  484. .bage-auto{
  485. display: inline-block;
  486. width: 72rpx;
  487. height: 32rpx;
  488. background:radial-gradient(circle,rgba(255,180,39,1) 0%,rgba(245,142,77,1) 100%);
  489. border-radius: 6rpx;
  490. line-height: 32rpx;
  491. text-align: center;
  492. color: #FFFFFF;
  493. margin-top: 10rpx;
  494. float: right;
  495. }
  496. }
  497. </style>