order-details.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  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. async MiniWxPayFor(data){
  340. const wechatCode = await authorize.getCode('weixin')
  341. this.PayService.WeChatMiniWxPay(
  342. {
  343. payAmount:data.payableAmount*100,
  344. payWay:"WEIXIN",
  345. code:wechatCode,
  346. orderId:data.orderId
  347. }
  348. )
  349. .then(response =>{
  350. let PayInfo = JSON.parse(response.data.data.payInfo);
  351. this.WxRequestPayment(PayInfo)
  352. })
  353. .catch(error =>{
  354. this.$util.msg(error.msg,2000)
  355. })
  356. },
  357. WxRequestPayment(data){
  358. let self = this
  359. wx.requestPayment({
  360. 'timeStamp': data.timeStamp,
  361. 'nonceStr': data.nonceStr,
  362. 'package': data.package,
  363. 'signType': data.signType,
  364. 'paySign': data.paySign,
  365. 'success':function(res){
  366. wx.reLaunch({url: '/pages/tabBar/index/index'});
  367. },
  368. 'fail':function(res){
  369. console.log(res)
  370. console.log('ORDERiD',self.hanldOrder)
  371. self.$api.redirectTo(`/pages/user/order/success?data=${JSON.stringify({data:self.hanldOrder.order})}`)
  372. },
  373. 'complete':function(res){
  374. }
  375. })
  376. },
  377. hanldePopupFn(data){//监听活动内容
  378. this.popupShow = true
  379. this.handlerPros = data
  380. },
  381. getHeaderTopHeight(){
  382. let statusBarHeight = this.systeminfo.statusBarHeight // 状态栏高度
  383. let headerPosi = this.headerBtnPosi
  384. let btnPosi = { // 胶囊实际位置,坐标信息不是左上角原点
  385. height: headerPosi.height,
  386. width: headerPosi.width,
  387. // 胶囊top - 状态栏高度
  388. top: headerPosi.top - statusBarHeight,
  389. // 胶囊bottom - 胶囊height - 状态栏height (现胶囊bottom 为距离导航栏底部的长度)
  390. bottom: headerPosi.bottom - headerPosi.height - statusBarHeight,
  391. // 屏幕宽度 - 胶囊right
  392. right: this.systeminfo.screenWidth - headerPosi.right
  393. }
  394. this.navbarHeight= headerPosi.bottom + btnPosi.bottom// 原胶囊bottom + 现胶囊bottom
  395. },
  396. setHeaderBtnPosi(){
  397. // 获得胶囊按钮位置信息
  398. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  399. return headerBtnPosi
  400. },
  401. setSysteminfo(){
  402. let systeminfo;
  403. uni.getSystemInfo({ // 获取设备信息
  404. success: (res) => {
  405. systeminfo = res
  406. },
  407. })
  408. return systeminfo
  409. },
  410. },
  411. onShow() {
  412. }
  413. }
  414. </script>
  415. <style lang="scss">
  416. page {
  417. height: auto;
  418. background:#F7F7F7;
  419. }
  420. .details{
  421. padding-bottom: 130rpx;
  422. }
  423. .btn-hover{
  424. background: #FFFFFF;
  425. }
  426. .animation{
  427. /* transition: transform 0.3s ease;*/
  428. transition-property: transform;
  429. transition-duration: 0.3s;
  430. transition-timing-function: ease;
  431. }
  432. .invoice-balance{
  433. width: 702rpx;
  434. height: auto;
  435. padding:0 24rpx;
  436. background: #FFFFFF;
  437. float: left;
  438. margin-top: 24rpx;
  439. margin-bottom: 24rpx;
  440. .balabce-t{
  441. width: 100%;
  442. height: 86rpx;
  443. line-height: 86rpx;
  444. font-size: $font-size-28;
  445. color: $text-color;
  446. float: left;
  447. .balabce-t-le{
  448. float: left;
  449. font-weight: bold;
  450. }
  451. .balabce-t-ri{
  452. float: right;
  453. display: flex;
  454. align-items: center;
  455. .money{
  456. display: flex;
  457. float: left;
  458. }
  459. .checkbox-box{
  460. display: flex;
  461. width: 60rpx;
  462. float: left;
  463. height: 100%;
  464. font-size: $font-size-24;
  465. .checkbox{
  466. width: 40rpx;
  467. text-align: right;
  468. box-sizing: border-box;
  469. text-align: center;
  470. text-decoration: none;
  471. border-radius: 0;
  472. -webkit-tap-highlight-color: transparent;
  473. overflow: hidden;
  474. }
  475. }
  476. }
  477. }
  478. .balabce-b{
  479. width: 100%;
  480. float: left;
  481. overflow: hidden;
  482. .balabce-b-text{
  483. width: 100%;
  484. line-height: 58rpx;
  485. font-size: $font-size-24;
  486. color: #FF2A2A;
  487. text-align: right;
  488. float: right;
  489. }
  490. &.balabce-b--hide {
  491. padding: 0 0;
  492. height: 0px;
  493. line-height: 0px;
  494. }
  495. }
  496. }
  497. .clause{
  498. float: right;
  499. font-size: 24rpx;
  500. color: #999999;
  501. margin-top: 60rpx;
  502. margin-right: 24rpx;
  503. &.noclick{
  504. pointer-events: none;
  505. }
  506. .text{
  507. color: #1890f9;
  508. &.color-bg{
  509. color: #333333;
  510. }
  511. }
  512. }
  513. .status-text{
  514. overflow: hidden;
  515. padding:0 24rpx;
  516. background: #fff;
  517. font-size: $font-size-26;
  518. .view-type{
  519. float: left;
  520. color: $color-system;
  521. }
  522. }
  523. .tui-modal-custom-text{
  524. min-height: 300rpx;
  525. margin-bottom: 30rpx;
  526. .title{
  527. width: 100%;
  528. height: auto;
  529. font-size: $font-size-30;
  530. text-align: justify;
  531. color: #333333;
  532. line-height: 40rpx;
  533. margin-bottom: 30rpx;
  534. }
  535. .tui-modal-custom-list{
  536. width: 100%;
  537. height: 350rpx;
  538. overflow: hidden;
  539. .custom-list{
  540. width: 100%;
  541. height: 117rpx;
  542. box-sizing: border-box;
  543. float: left;
  544. padding: 15rpx 0;
  545. .custom-list-image{
  546. width: 86rpx;
  547. height: 86rpx;
  548. float: left;
  549. border-radius: 6rpx;
  550. box-sizing: border-box;
  551. border: 1px solid #e1e1e1;
  552. image{
  553. width: 84rpx;
  554. height: 84rpx;
  555. border-radius: 6rpx;
  556. display: block;
  557. }
  558. }
  559. .custom-list-name{
  560. width: 400rpx;
  561. height: 86rpx;
  562. float: right;
  563. line-height: 43rpx;
  564. font-size: $font-size-26;
  565. color: #666666;
  566. text-overflow: ellipsis;
  567. overflow: hidden;
  568. display: -webkit-box;
  569. -webkit-line-clamp: 2;
  570. line-clamp: 2;
  571. -webkit-box-orient: vertical;
  572. }
  573. }
  574. }
  575. }
  576. .tui-modal-button{
  577. width: 100%;
  578. height: 72rpx;
  579. display: flex;
  580. .modal-button{
  581. width: 200rpx;
  582. height: 72rpx;
  583. line-height: 72rpx;
  584. border-radius: 36rpx;
  585. box-sizing: border-box;
  586. &.cancel{
  587. border: 1px solid #b2b2b2;
  588. background: #FFFFFF;
  589. color: #333333;
  590. }
  591. &.confirm{
  592. background: $btn-confirm;
  593. color: #FFFFFF;
  594. }
  595. }
  596. }
  597. </style>