order-details.vue 17 KB

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