order-details.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. <template>
  2. <view class="container details clearfix" :style="{paddingBottom :isIphoneX ? (130+68)+'rpx' : '130rpx'}">
  3. <!-- 自定义返回 -->
  4. <header-back :systeminfo='systeminfo'
  5. :navbar-data='nvabarData'
  6. :headerBtnPosi ="headerBtnPosi"
  7. :isShare='isOrderShare'>
  8. </header-back>
  9. <view class="container-details" :style="{paddingTop:navbarHeight+'px'}">
  10. <view class="status-text">
  11. <view class="view-type">{{ information.status | TextFormat }}</view>
  12. </view>
  13. <!-- 地址选择 -->
  14. <order-address ref="orderAddress" v-if="isRequest" :addressData="addressData"></order-address>
  15. <!-- 商品 -->
  16. <goods-list ref='goods' v-if="isRequest" :shopOrderData="shopOrderData" :information="information" @popupClick="hanldePopupFn"></goods-list>
  17. <!-- 订单信息 -->
  18. <order-information ref="information" v-if="isRequest" :information="information"></order-information>
  19. <!-- 底部button -->
  20. <order-button ref="orderButton"
  21. v-if= "isRequest"
  22. :status= "btnStatus"
  23. :shareCode= "shareCode"
  24. :order="orderInfo"
  25. @buttonConfirm="handButtonConfirm">
  26. </order-button>
  27. </view>
  28. <!-- 操作弹窗 -->
  29. <tui-modal :show="modal" @click="handleClick" @cancel="hideMobel(1)" :content="contentModalText" color="#333" :size="32" shape="circle" :maskClosable="false"></tui-modal>
  30. <!-- 再次购买订单商品全部下架弹窗 -->
  31. <tui-modal :show="modal2" @click="handleClick2" @cancel="hideMobel(2)" shape="circle" content="订单内商品已全部下架,不能购买!" :button="button"></tui-modal>
  32. <!-- 再次购买部分商品失效弹窗 -->
  33. <tui-modal :show="modal3" @cancel="hideMobel(3)" :custom="true">
  34. <view class="tui-modal-custom">
  35. <view class="tui-modal-custom-text">
  36. <view class="title">以下商品已失效,不能进行购买;是否先将其他商品加入购物车?</view>
  37. <scroll-view scroll-y class="tui-modal-custom-list">
  38. <view class="custom-list" v-for="(invalid,index) in invalidList" :key="index">
  39. <view class="custom-list-image"><image :src="invalid.productImage" mode=""></image></view>
  40. <view class="custom-list-name">{{ invalid.name }}</view>
  41. </view>
  42. </scroll-view>
  43. </view>
  44. <view class="tui-modal-button">
  45. <button class="modal-button cancel" @click="hideMobel(3)">我再想想</button>
  46. <button class="modal-button confirm" @click="handleClick3">加入购物车</button>
  47. </view>
  48. </view>
  49. </tui-modal>
  50. <!-- 促销活动弹窗 -->
  51. <activi-popup :Promotion="handlerPros" :popupShow="popupShow"></activi-popup>
  52. </view>
  53. </template>
  54. <script>
  55. import authorize from '@/common/config/authorize.js'
  56. import headerBack from '@/components/cm-module/headerNavbar/header-back' //自定义导航
  57. import orderAddress from '@/components/cm-module/orderDetails/orderAddress' //地址信息
  58. import goodsList from '@/components/cm-module/orderDetails/goodsList' //商品列表
  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. export default {
  65. components:{
  66. headerBack,
  67. orderInformation,
  68. orderAddress,
  69. goodsList,
  70. transfeRecord,
  71. paymentRecord,
  72. refundRecord,
  73. orderButton,
  74. },
  75. data() {
  76. return {
  77. state:0,
  78. orderId:'',
  79. shareCode:'', //分享码
  80. shareType:'', //分享登录页过来记录的状态
  81. cellPhone:'', //客服电话
  82. payStatus:0,
  83. btnStatus:0, //按钮组件状态
  84. onlinePayFlag:'',
  85. isRequest:false, //是否加载完成渲染子组件
  86. isOrderShare:false,
  87. isConfim:false,
  88. modelType:0,
  89. orderInfo:{},
  90. alertOrderInfo:{},
  91. addressData:{}, //地址信息初始化
  92. information:{}, //订单信息初始化
  93. shopOrderData:{}, //商品信息初始化
  94. orderInvoice:{}, //发票信息初始化
  95. returnedPurchaseList:{}, //退款信息初始化
  96. discernReceiptList:{}, //支付信息初始化
  97. receiptAmount:0, //支付金额
  98. returnedPurchaseFee:0, //退款金额
  99. navbarHeight:'',
  100. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  101. systeminfo: this.setSysteminfo(), //获取设备信息
  102. isIphoneX:this.$store.state.isIphoneX,
  103. CustomBar:this.CustomBar,// 顶部导航栏高度
  104. popupShow:false,
  105. handlerPros:{},
  106. nvabarData: { //顶部自定义导航
  107. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示
  108. title: '订单详情', // 导航栏 中间的标题
  109. },
  110. clauseData:{},
  111. orderSubmitType:false,//自主订单
  112. userId:0,
  113. modal:false,
  114. modal2:false,
  115. modal3:false,
  116. OperationType:'',
  117. contentModalText:'',
  118. button: [
  119. {
  120. text: '确定',
  121. type:'danger'
  122. }
  123. ],
  124. invalidList:[]
  125. }
  126. },
  127. onLoad(option){
  128. console.log(option)
  129. this.$api.getStorage().then((resolve) =>{
  130. this.userId = resolve.userId ? resolve.userId : 0
  131. })
  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. this.isConfim = true
  140. }else{
  141. this.state = option.state
  142. }
  143. this.getHeaderTopHeight()
  144. this.GetOrderDetaileData()
  145. },
  146. filters:{
  147. TextFormat(status) {//处理金额
  148. let HtmlText,
  149. typeTextObject={
  150. 4:'交易完成',
  151. 5:'订单完成',
  152. 6:'已关闭',
  153. 7:'交易全退',
  154. 77:'交易全退',
  155. 11:'待付款待发货',
  156. 12:'待付款部分发货',
  157. 13:'待付款已发货',
  158. 21:'部分付款待发货',
  159. 22:'部分付款部分发货',
  160. 23:'部分付款已发货',
  161. 31:'已付款待发货',
  162. 32:'已付款部分发货',
  163. 33:'已付款已发货',
  164. 111:'待付款待发货',
  165. };
  166. Object.keys(typeTextObject).forEach(key => {
  167. if(key == status){
  168. HtmlText = typeTextObject[key]
  169. }
  170. })
  171. return HtmlText
  172. },
  173. },
  174. methods: {
  175. openclauseConten(id){
  176. this.$api.navigateTo(`/pages/service/sellconten?clauseId=${id}`)
  177. },
  178. GetOrderDetaileData(){//初始化页面数据@参数:订单ID
  179. this.OrderService.QueryOrderDetails({ orderId : this.orderId }).then(response =>{
  180. let resData = response.data;
  181. this.isRequest = true
  182. this.orderInfo = resData.order
  183. this.userId = resData.order.userId
  184. this.shareCode = resData.shareCode
  185. this.addressData = resData.userInfo
  186. this.information = resData.order
  187. this.btnStatus = resData.order.status
  188. this.payStatus = resData.order.payStatus
  189. this.payableAmount = resData.order.payableAmount
  190. this.shopOrderData = resData.shopOrderList
  191. this.orderInvoice = resData.orderInvoice
  192. this.onlinePayFlag = resData.order.onlinePayFlag
  193. this.returnedPurchaseList = resData.returnedPurchaseList
  194. this.discernReceiptList = resData.discernReceiptList
  195. this.receiptAmount = resData.order.receiptAmount
  196. this.returnedPurchaseFee = resData.order.returnedPurchaseFee
  197. this.clauseData = resData.clause
  198. if(this.information.orderSubmitType == 0 || this.information.orderSubmitType == 1 ||this.information.orderSubmitType == 2){
  199. this.orderSubmitType=true
  200. }else{
  201. this.orderSubmitType=false
  202. }
  203. }).catch(error =>{
  204. this.$util.modal('提示','订单查询失败,请稍后重试~','确定','',false,() =>{
  205. this.$api.switchTabTo('/pages/tabBar/index/index')
  206. })
  207. })
  208. },
  209. handButtonConfirm(data) {//获取点击
  210. console.log(data)
  211. this.hanldOrder = data
  212. this.btnoRderID = data.orderId
  213. this.OperationType = data.type
  214. this.handShowAlert(data)
  215. },
  216. handShowAlert(data) {//执行
  217. switch(data.type){
  218. case 'cancel':
  219. this.modal = true;
  220. this.contentModalText = '确认取消该订单吗?';
  221. break;
  222. case 'delete':
  223. this.modal = true;
  224. this.contentModalText = '确认删除该订单吗?';
  225. break;
  226. case 'confirm':
  227. this.modal = true;
  228. this.contentModalText = '是否确认收货?'
  229. break;
  230. case 'query':
  231. this.isModalLayer = true;
  232. this.$api.navigateTo('/pages/user/order/order-logistics?orderId='+data.orderId)
  233. break;
  234. case 'again':
  235. this.handBuyAgainInfo()
  236. break;
  237. case 'pay':
  238. this.MiniWxPayFor(data.order)
  239. break;
  240. }
  241. },
  242. handleClick(e) {//用户操作订单
  243. let index = e.index;
  244. if(index == 1){
  245. switch(this.OperationType){
  246. case 'delete':
  247. this.handOrderDetele(this.orderId);
  248. break
  249. case 'cancel':
  250. this.handCenceConfirm(this.orderId)
  251. break
  252. case 'confirm':
  253. this.handOrderConfirm(this.orderId);
  254. break
  255. }
  256. }
  257. this.modal = false;
  258. },
  259. handleClick2(){
  260. this.modal2 = false;
  261. },
  262. handleClick3(){
  263. this.handShoppingAgainCart()
  264. this.modal3 = false
  265. },
  266. hideMobel(index) {
  267. switch(index){
  268. case 1:this.modal = false;break;
  269. case 2:this.modal2 = false;break;
  270. case 3:this.modal3 = false;break;
  271. }
  272. },
  273. handBuyAgainInfo(){//再次购买初始化查询订单商品信息
  274. this.OrderService.GetOrderBuyAgain(
  275. {
  276. orderId:this.orderId,
  277. }
  278. )
  279. .then(response =>{
  280. this.handShoppingAgainCart()
  281. })
  282. .catch(error =>{
  283. console.log(error.data)
  284. if(error.data && error.data.length > 0){
  285. this.modal3 = true
  286. this.invalidList = error.data
  287. }else{
  288. this.modal2 = true
  289. }
  290. })
  291. },
  292. handShoppingAgainCart(){ //一键加入购物车
  293. this.ProductService.ShoppingAgainCart(
  294. {
  295. orderId:this.orderId,
  296. }
  297. )
  298. .then(response => {
  299. this.ProductService.QueryShoppingQuantity({userId:this.userId}).then(response => {
  300. this.$api.switchTabTo('/pages/tabBar/cart/index');
  301. }).catch(error =>{
  302. console.log('查询购物车数量错误信息',error)
  303. })
  304. })
  305. .catch(error =>{
  306. this.$util.msg(error.msg,2000);
  307. })
  308. },
  309. handOrderConfirm (id){//确认收货
  310. this.OrderService.ConfirmReceipt({orderId:id}).then(response =>{
  311. this.$util.msg(response.msg,2000,true,'success');
  312. setTimeout(() => {
  313. this.GetOrderDatainit(this.currentTab)
  314. },2000)
  315. }).catch(error =>{
  316. this.$util.msg(error.msg,2000)
  317. })
  318. },
  319. handOrderDetele(id){//删除订单
  320. this.OrderService.DeleteOrder({orderId:id}).then(response =>{
  321. this.$util.msg(response.msg,2000,true,'success');
  322. setTimeout(() => {
  323. this.GetOrderDatainit(this.currentTab)
  324. },2000)
  325. }).catch(error =>{
  326. this.$util.msg(error.msg,2000)
  327. })
  328. },
  329. handCenceConfirm(id){//取消订单
  330. this.OrderService.CancelOrder({orderId:id}).then(response =>{
  331. this.$util.msg(response.msg,2000,true,'success');
  332. setTimeout(() => {
  333. this.GetOrderDatainit(this.currentTab)
  334. },2000)
  335. }).catch(error =>{
  336. this.$util.msg(error.msg,2000)
  337. })
  338. },
  339. MiniWxPayFor(data){
  340. this.PayService.PayOrderOnLineSwitch().then(response =>{
  341. if(response.data === 1 ){
  342. this.WeChatMiniWxPay(data)
  343. }else{
  344. this.$api.navigateTo(`/pages/user/order/order-payment?money=${data.payableAmount}`)
  345. }
  346. })
  347. },
  348. async WeChatMiniWxPay(data){
  349. const wechatCode = await authorize.getCode('weixin')
  350. this.PayService.WeChatMiniWxPay(
  351. {
  352. payAmount:data.payableAmount*100,
  353. payWay:"WEIXIN",
  354. code:wechatCode,
  355. orderId:data.orderId
  356. }
  357. )
  358. .then(response =>{
  359. let PayInfo = JSON.parse(response.data.data.payInfo);
  360. this.WxRequestPayment(PayInfo)
  361. })
  362. .catch(error =>{
  363. this.$util.msg(error.msg,2000)
  364. })
  365. },
  366. WxRequestPayment(data){
  367. let self = this
  368. wx.requestPayment({
  369. 'timeStamp': data.timeStamp,
  370. 'nonceStr': data.nonceStr,
  371. 'package': data.package,
  372. 'signType': data.signType,
  373. 'paySign': data.paySign,
  374. 'success':function(res){
  375. wx.reLaunch({url: '/pages/tabBar/index/index'});
  376. },
  377. 'fail':function(res){
  378. console.log(res)
  379. console.log('ORDERiD',self.hanldOrder)
  380. self.$api.redirectTo(`/pages/user/order/success?data=${JSON.stringify({data:self.hanldOrder.order})}`)
  381. },
  382. 'complete':function(res){
  383. }
  384. })
  385. },
  386. hanldePopupFn(data){//监听活动内容
  387. this.popupShow = true
  388. this.handlerPros = data
  389. },
  390. getHeaderTopHeight(){
  391. let statusBarHeight = this.systeminfo.statusBarHeight // 状态栏高度
  392. let headerPosi = this.headerBtnPosi
  393. let btnPosi = { // 胶囊实际位置,坐标信息不是左上角原点
  394. height: headerPosi.height,
  395. width: headerPosi.width,
  396. // 胶囊top - 状态栏高度
  397. top: headerPosi.top - statusBarHeight,
  398. // 胶囊bottom - 胶囊height - 状态栏height (现胶囊bottom 为距离导航栏底部的长度)
  399. bottom: headerPosi.bottom - headerPosi.height - statusBarHeight,
  400. // 屏幕宽度 - 胶囊right
  401. right: this.systeminfo.screenWidth - headerPosi.right
  402. }
  403. this.navbarHeight= headerPosi.bottom + btnPosi.bottom// 原胶囊bottom + 现胶囊bottom
  404. },
  405. setHeaderBtnPosi(){
  406. // 获得胶囊按钮位置信息
  407. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  408. return headerBtnPosi
  409. },
  410. setSysteminfo(){
  411. let systeminfo;
  412. uni.getSystemInfo({ // 获取设备信息
  413. success: (res) => {
  414. systeminfo = res
  415. },
  416. })
  417. return systeminfo
  418. },
  419. },
  420. onShow() {
  421. }
  422. }
  423. </script>
  424. <style lang="scss">
  425. page {
  426. height: auto;
  427. background:#F7F7F7;
  428. }
  429. .details{
  430. padding-bottom: 130rpx;
  431. }
  432. .btn-hover{
  433. background: #FFFFFF;
  434. }
  435. .animation{
  436. /* transition: transform 0.3s ease;*/
  437. transition-property: transform;
  438. transition-duration: 0.3s;
  439. transition-timing-function: ease;
  440. }
  441. .invoice-balance{
  442. width: 702rpx;
  443. height: auto;
  444. padding:0 24rpx;
  445. background: #FFFFFF;
  446. float: left;
  447. margin-top: 24rpx;
  448. margin-bottom: 24rpx;
  449. .balabce-t{
  450. width: 100%;
  451. height: 86rpx;
  452. line-height: 86rpx;
  453. font-size: $font-size-28;
  454. color: $text-color;
  455. float: left;
  456. .balabce-t-le{
  457. float: left;
  458. font-weight: bold;
  459. }
  460. .balabce-t-ri{
  461. float: right;
  462. display: flex;
  463. align-items: center;
  464. .money{
  465. display: flex;
  466. float: left;
  467. }
  468. .checkbox-box{
  469. display: flex;
  470. width: 60rpx;
  471. float: left;
  472. height: 100%;
  473. font-size: $font-size-24;
  474. .checkbox{
  475. width: 40rpx;
  476. text-align: right;
  477. box-sizing: border-box;
  478. text-align: center;
  479. text-decoration: none;
  480. border-radius: 0;
  481. -webkit-tap-highlight-color: transparent;
  482. overflow: hidden;
  483. }
  484. }
  485. }
  486. }
  487. .balabce-b{
  488. width: 100%;
  489. float: left;
  490. overflow: hidden;
  491. .balabce-b-text{
  492. width: 100%;
  493. line-height: 58rpx;
  494. font-size: $font-size-24;
  495. color: #FF2A2A;
  496. text-align: right;
  497. float: right;
  498. }
  499. &.balabce-b--hide {
  500. padding: 0 0;
  501. height: 0px;
  502. line-height: 0px;
  503. }
  504. }
  505. }
  506. .clause{
  507. float: right;
  508. font-size: 24rpx;
  509. color: #999999;
  510. margin-top: 60rpx;
  511. margin-right: 24rpx;
  512. &.noclick{
  513. pointer-events: none;
  514. }
  515. .text{
  516. color: #1890f9;
  517. &.color-bg{
  518. color: #333333;
  519. }
  520. }
  521. }
  522. .status-text{
  523. overflow: hidden;
  524. padding:0 24rpx;
  525. background: #fff;
  526. font-size: $font-size-26;
  527. .view-type{
  528. float: left;
  529. color: $color-system;
  530. }
  531. }
  532. .tui-modal-custom-text{
  533. min-height: 300rpx;
  534. margin-bottom: 30rpx;
  535. .title{
  536. width: 100%;
  537. height: auto;
  538. font-size: $font-size-30;
  539. text-align: justify;
  540. color: #333333;
  541. line-height: 40rpx;
  542. margin-bottom: 30rpx;
  543. }
  544. .tui-modal-custom-list{
  545. width: 100%;
  546. height: 350rpx;
  547. overflow: hidden;
  548. .custom-list{
  549. width: 100%;
  550. height: 117rpx;
  551. box-sizing: border-box;
  552. float: left;
  553. padding: 15rpx 0;
  554. .custom-list-image{
  555. width: 86rpx;
  556. height: 86rpx;
  557. float: left;
  558. border-radius: 6rpx;
  559. box-sizing: border-box;
  560. border: 1px solid #e1e1e1;
  561. image{
  562. width: 84rpx;
  563. height: 84rpx;
  564. border-radius: 6rpx;
  565. display: block;
  566. }
  567. }
  568. .custom-list-name{
  569. width: 400rpx;
  570. height: 86rpx;
  571. float: right;
  572. line-height: 43rpx;
  573. font-size: $font-size-26;
  574. color: #666666;
  575. text-overflow: ellipsis;
  576. overflow: hidden;
  577. display: -webkit-box;
  578. -webkit-line-clamp: 2;
  579. line-clamp: 2;
  580. -webkit-box-orient: vertical;
  581. }
  582. }
  583. }
  584. }
  585. .tui-modal-button{
  586. width: 100%;
  587. height: 72rpx;
  588. display: flex;
  589. .modal-button{
  590. width: 200rpx;
  591. height: 72rpx;
  592. line-height: 72rpx;
  593. border-radius: 36rpx;
  594. box-sizing: border-box;
  595. &.cancel{
  596. border: 1px solid #b2b2b2;
  597. background: #FFFFFF;
  598. color: #333333;
  599. }
  600. &.confirm{
  601. background: $btn-confirm;
  602. color: #FFFFFF;
  603. }
  604. }
  605. }
  606. </style>