order-details.vue 18 KB

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