order-details.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  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.$api.navigateTo(`/pages/user/order/order-payment?money=${data.order.payableAmount}`)
  239. // this.MiniWxPayFor(data.order)
  240. break;
  241. }
  242. },
  243. handleClick(e) {//用户操作订单
  244. let index = e.index;
  245. if(index == 1){
  246. switch(this.OperationType){
  247. case 'delete':
  248. this.handOrderDetele(this.orderId);
  249. break
  250. case 'cancel':
  251. this.handCenceConfirm(this.orderId)
  252. break
  253. case 'confirm':
  254. this.handOrderConfirm(this.orderId);
  255. break
  256. }
  257. }
  258. this.modal = false;
  259. },
  260. handleClick2(){
  261. this.modal2 = false;
  262. },
  263. handleClick3(){
  264. this.handShoppingAgainCart()
  265. this.modal3 = false
  266. },
  267. hideMobel(index) {
  268. switch(index){
  269. case 1:this.modal = false;break;
  270. case 2:this.modal2 = false;break;
  271. case 3:this.modal3 = false;break;
  272. }
  273. },
  274. handBuyAgainInfo(){//再次购买初始化查询订单商品信息
  275. this.OrderService.GetOrderBuyAgain(
  276. {
  277. orderId:this.orderId,
  278. }
  279. )
  280. .then(response =>{
  281. this.handShoppingAgainCart()
  282. })
  283. .catch(error =>{
  284. console.log(error.data)
  285. if(error.data && error.data.length > 0){
  286. this.modal3 = true
  287. this.invalidList = error.data
  288. }else{
  289. this.modal2 = true
  290. }
  291. })
  292. },
  293. handShoppingAgainCart(){ //一键加入购物车
  294. this.ProductService.ShoppingAgainCart(
  295. {
  296. orderId:this.orderId,
  297. }
  298. )
  299. .then(response => {
  300. this.ProductService.QueryShoppingQuantity({userId:this.userId}).then(response => {
  301. this.$api.switchTabTo('/pages/tabBar/cart/index');
  302. }).catch(error =>{
  303. console.log('查询购物车数量错误信息',error)
  304. })
  305. })
  306. .catch(error =>{
  307. this.$util.msg(error.msg,2000);
  308. })
  309. },
  310. handOrderConfirm (id){//确认收货
  311. this.OrderService.ConfirmReceipt({orderId:id}).then(response =>{
  312. this.$util.msg(response.msg,2000,true,'success');
  313. setTimeout(() => {
  314. this.GetOrderDatainit(this.currentTab)
  315. },2000)
  316. }).catch(error =>{
  317. this.$util.msg(error.msg,2000)
  318. })
  319. },
  320. handOrderDetele(id){//删除订单
  321. this.OrderService.DeleteOrder({orderId:id}).then(response =>{
  322. this.$util.msg(response.msg,2000,true,'success');
  323. setTimeout(() => {
  324. this.GetOrderDatainit(this.currentTab)
  325. },2000)
  326. }).catch(error =>{
  327. this.$util.msg(error.msg,2000)
  328. })
  329. },
  330. handCenceConfirm(id){//取消订单
  331. this.OrderService.CancelOrder({orderId:id}).then(response =>{
  332. this.$util.msg(response.msg,2000,true,'success');
  333. setTimeout(() => {
  334. this.GetOrderDatainit(this.currentTab)
  335. },2000)
  336. }).catch(error =>{
  337. this.$util.msg(error.msg,2000)
  338. })
  339. },
  340. async MiniWxPayFor(data){
  341. const wechatCode = await authorize.getCode('weixin')
  342. this.PayService.WeChatMiniWxPay(
  343. {
  344. payAmount:data.payableAmount*100,
  345. payWay:"WEIXIN",
  346. code:wechatCode,
  347. orderId:data.orderId
  348. }
  349. )
  350. .then(response =>{
  351. let PayInfo = JSON.parse(response.data.data.payInfo);
  352. this.WxRequestPayment(PayInfo)
  353. })
  354. .catch(error =>{
  355. this.$util.msg(error.msg,2000)
  356. })
  357. },
  358. WxRequestPayment(data){
  359. let self = this
  360. wx.requestPayment({
  361. 'timeStamp': data.timeStamp,
  362. 'nonceStr': data.nonceStr,
  363. 'package': data.package,
  364. 'signType': data.signType,
  365. 'paySign': data.paySign,
  366. 'success':function(res){
  367. wx.reLaunch({url: '/pages/tabBar/index/index'});
  368. },
  369. 'fail':function(res){
  370. console.log(res)
  371. console.log('ORDERiD',self.hanldOrder)
  372. self.$api.redirectTo(`/pages/user/order/success?data=${JSON.stringify({data:self.hanldOrder.order})}`)
  373. },
  374. 'complete':function(res){
  375. }
  376. })
  377. },
  378. hanldePopupFn(data){//监听活动内容
  379. this.popupShow = true
  380. this.handlerPros = data
  381. },
  382. getHeaderTopHeight(){
  383. let statusBarHeight = this.systeminfo.statusBarHeight // 状态栏高度
  384. let headerPosi = this.headerBtnPosi
  385. let btnPosi = { // 胶囊实际位置,坐标信息不是左上角原点
  386. height: headerPosi.height,
  387. width: headerPosi.width,
  388. // 胶囊top - 状态栏高度
  389. top: headerPosi.top - statusBarHeight,
  390. // 胶囊bottom - 胶囊height - 状态栏height (现胶囊bottom 为距离导航栏底部的长度)
  391. bottom: headerPosi.bottom - headerPosi.height - statusBarHeight,
  392. // 屏幕宽度 - 胶囊right
  393. right: this.systeminfo.screenWidth - headerPosi.right
  394. }
  395. this.navbarHeight= headerPosi.bottom + btnPosi.bottom// 原胶囊bottom + 现胶囊bottom
  396. },
  397. setHeaderBtnPosi(){
  398. // 获得胶囊按钮位置信息
  399. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  400. return headerBtnPosi
  401. },
  402. setSysteminfo(){
  403. let systeminfo;
  404. uni.getSystemInfo({ // 获取设备信息
  405. success: (res) => {
  406. systeminfo = res
  407. },
  408. })
  409. return systeminfo
  410. },
  411. },
  412. onShow() {
  413. }
  414. }
  415. </script>
  416. <style lang="scss">
  417. page {
  418. height: auto;
  419. background:#F7F7F7;
  420. }
  421. .details{
  422. padding-bottom: 130rpx;
  423. }
  424. .btn-hover{
  425. background: #FFFFFF;
  426. }
  427. .animation{
  428. /* transition: transform 0.3s ease;*/
  429. transition-property: transform;
  430. transition-duration: 0.3s;
  431. transition-timing-function: ease;
  432. }
  433. .invoice-balance{
  434. width: 702rpx;
  435. height: auto;
  436. padding:0 24rpx;
  437. background: #FFFFFF;
  438. float: left;
  439. margin-top: 24rpx;
  440. margin-bottom: 24rpx;
  441. .balabce-t{
  442. width: 100%;
  443. height: 86rpx;
  444. line-height: 86rpx;
  445. font-size: $font-size-28;
  446. color: $text-color;
  447. float: left;
  448. .balabce-t-le{
  449. float: left;
  450. font-weight: bold;
  451. }
  452. .balabce-t-ri{
  453. float: right;
  454. display: flex;
  455. align-items: center;
  456. .money{
  457. display: flex;
  458. float: left;
  459. }
  460. .checkbox-box{
  461. display: flex;
  462. width: 60rpx;
  463. float: left;
  464. height: 100%;
  465. font-size: $font-size-24;
  466. .checkbox{
  467. width: 40rpx;
  468. text-align: right;
  469. box-sizing: border-box;
  470. text-align: center;
  471. text-decoration: none;
  472. border-radius: 0;
  473. -webkit-tap-highlight-color: transparent;
  474. overflow: hidden;
  475. }
  476. }
  477. }
  478. }
  479. .balabce-b{
  480. width: 100%;
  481. float: left;
  482. overflow: hidden;
  483. .balabce-b-text{
  484. width: 100%;
  485. line-height: 58rpx;
  486. font-size: $font-size-24;
  487. color: #FF2A2A;
  488. text-align: right;
  489. float: right;
  490. }
  491. &.balabce-b--hide {
  492. padding: 0 0;
  493. height: 0px;
  494. line-height: 0px;
  495. }
  496. }
  497. }
  498. .clause{
  499. float: right;
  500. font-size: 24rpx;
  501. color: #999999;
  502. margin-top: 60rpx;
  503. margin-right: 24rpx;
  504. &.noclick{
  505. pointer-events: none;
  506. }
  507. .text{
  508. color: #1890f9;
  509. &.color-bg{
  510. color: #333333;
  511. }
  512. }
  513. }
  514. .status-text{
  515. overflow: hidden;
  516. padding:0 24rpx;
  517. background: #fff;
  518. font-size: $font-size-26;
  519. .view-type{
  520. float: left;
  521. color: $color-system;
  522. }
  523. }
  524. .tui-modal-custom-text{
  525. min-height: 300rpx;
  526. margin-bottom: 30rpx;
  527. .title{
  528. width: 100%;
  529. height: auto;
  530. font-size: $font-size-30;
  531. text-align: justify;
  532. color: #333333;
  533. line-height: 40rpx;
  534. margin-bottom: 30rpx;
  535. }
  536. .tui-modal-custom-list{
  537. width: 100%;
  538. height: 350rpx;
  539. overflow: hidden;
  540. .custom-list{
  541. width: 100%;
  542. height: 117rpx;
  543. box-sizing: border-box;
  544. float: left;
  545. padding: 15rpx 0;
  546. .custom-list-image{
  547. width: 86rpx;
  548. height: 86rpx;
  549. float: left;
  550. border-radius: 6rpx;
  551. box-sizing: border-box;
  552. border: 1px solid #e1e1e1;
  553. image{
  554. width: 84rpx;
  555. height: 84rpx;
  556. border-radius: 6rpx;
  557. display: block;
  558. }
  559. }
  560. .custom-list-name{
  561. width: 400rpx;
  562. height: 86rpx;
  563. float: right;
  564. line-height: 43rpx;
  565. font-size: $font-size-26;
  566. color: #666666;
  567. text-overflow: ellipsis;
  568. overflow: hidden;
  569. display: -webkit-box;
  570. -webkit-line-clamp: 2;
  571. line-clamp: 2;
  572. -webkit-box-orient: vertical;
  573. }
  574. }
  575. }
  576. }
  577. .tui-modal-button{
  578. width: 100%;
  579. height: 72rpx;
  580. display: flex;
  581. .modal-button{
  582. width: 200rpx;
  583. height: 72rpx;
  584. line-height: 72rpx;
  585. border-radius: 36rpx;
  586. box-sizing: border-box;
  587. &.cancel{
  588. border: 1px solid #b2b2b2;
  589. background: #FFFFFF;
  590. color: #333333;
  591. }
  592. &.confirm{
  593. background: $btn-confirm;
  594. color: #FFFFFF;
  595. }
  596. }
  597. }
  598. </style>