order-details.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  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. </view>
  9. <!-- 地址选择 -->
  10. <order-address ref="orderAddress" v-if="isRequest" :addressData="addressData"></order-address>
  11. <!-- 商品 -->
  12. <goods-list ref='goods' v-if="isRequest" :shopOrderData="shopOrderData" :information="information" @popupClick="hanldePopupFn"></goods-list>
  13. <!-- 订单信息 -->
  14. <order-information ref="information" v-if="isRequest" :information="information"></order-information>
  15. <!-- 发票信息 -->
  16. <invoice-tent ref="invoice" v-if="isRequest" :orderInvoice="orderInvoice"></invoice-tent>
  17. <!-- 转账信息 -->
  18. <!-- <transfe-record ref="transfe" v-if="receiptAmount == 0 || onlinePayFlag == '1'"></transfe-record> -->
  19. <!-- 支付记录 -->
  20. <payment-record ref="payment" v-if="isRequest" :discernReceiptList="discernReceiptList" :receiptAmount="receiptAmount"></payment-record>
  21. <!-- 退款记录 -->
  22. <refund-record ref="refund" v-if="isRequest" :returnedPurchaseList="returnedPurchaseList" :returnedPurchaseFee="returnedPurchaseFee"></refund-record>
  23. <!-- 底部button -->
  24. <order-button ref="orderButton"
  25. v-if= "isRequest"
  26. :status= "btnStatus"
  27. :shareCode= "shareCode"
  28. :order="orderInfo"
  29. @buttonConfirm="handButtonConfirm">
  30. </order-button>
  31. </view>
  32. <!-- 分享弹窗 -->
  33. <share-alert :orderID="orderId"
  34. v-if="isShareModal"
  35. @btnConfirm ='onShareAppMessage'>
  36. </share-alert>
  37. <!-- 操作弹窗 -->
  38. <tui-modal :show="modal" @click="handleClick" @cancel="hideMobel" :content="contentModalText" color="#333" :size="32" shape="circle" :maskClosable="false"></tui-modal>
  39. <!-- 促销活动弹窗 -->
  40. <activi-popup :Promotion="handlerPros" :popupShow="popupShow"></activi-popup>
  41. </view>
  42. </template>
  43. <script>
  44. import headerBack from '@/components/cm-module/headerNavbar/header-back' //自定义导航
  45. import orderAddress from '@/components/cm-module/orderDetails/orderAddress' //地址信息
  46. import goodsList from '@/components/cm-module/orderDetails/goodsList' //商品列表
  47. import invoiceTent from '@/components/cm-module/orderDetails/invoiceTent' //发票信息
  48. import orderInformation from '@/components/cm-module/orderDetails/orderInformation' //订单信息
  49. import transfeRecord from '@/components/cm-module/orderDetails/transfeRecord' //转账信息
  50. import paymentRecord from '@/components/cm-module/orderDetails/paymentRecord' //支付记录
  51. import refundRecord from '@/components/cm-module/orderDetails/refundRecord' //退款记录
  52. import orderButton from '@/components/cm-module/orderDetails/orderButton' //底部按钮
  53. import shareAlert from '@/components/cm-module/modelAlert/shareAlert.vue' //分享弹窗
  54. import orderModel from '@/components/cm-module/modelAlert/order-alert' //付款弹窗
  55. import activiPopup from "@/components/cm-module/orderDetails/activipopu" //促销活动弹窗
  56. export default {
  57. components:{
  58. headerBack,
  59. orderInformation,
  60. orderAddress,
  61. invoiceTent,
  62. goodsList,
  63. transfeRecord,
  64. paymentRecord,
  65. refundRecord,
  66. orderButton,
  67. shareAlert,
  68. orderModel,
  69. activiPopup
  70. },
  71. data() {
  72. return {
  73. state:0,
  74. userID:'',
  75. orderId:'',
  76. shareCode:'', //分享码
  77. shareType:'', //分享登录页过来记录的状态
  78. cellPhone:'', //客服电话
  79. payStatus:0,
  80. btnStatus:0, //按钮组件状态
  81. onlinePayFlag:'',
  82. isRequest:false, //是否加载完成渲染子组件
  83. isOrderShare:false,
  84. isShareModal:false,
  85. modelType:0,
  86. orderInfo:{},
  87. alertOrderInfo:{},
  88. addressData:{}, //地址信息初始化
  89. information:{}, //订单信息初始化
  90. shopOrderData:{}, //商品信息初始化
  91. orderInvoice:{}, //发票信息初始化
  92. returnedPurchaseList:{}, //退款信息初始化
  93. discernReceiptList:{}, //支付信息初始化
  94. receiptAmount:0, //支付金额
  95. returnedPurchaseFee:0, //退款金额
  96. navbarHeight:'',
  97. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  98. systeminfo: this.setSysteminfo(), //获取设备信息
  99. isIphoneX:this.$store.state.isIphoneX,
  100. CustomBar:this.CustomBar,// 顶部导航栏高度
  101. popupShow:false,
  102. handlerPros:{},
  103. nvabarData: { //顶部自定义导航
  104. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示
  105. title: '订单详情', // 导航栏 中间的标题
  106. },
  107. clauseData:{},
  108. orderSubmitType:false,//自主订单
  109. modal:false,
  110. OperationType:'',
  111. contentModalText:''
  112. }
  113. },
  114. onLoad(option){
  115. console.log(option)
  116. this.shareType = option.type;
  117. this.orderId = option.orderId
  118. if(this.shareType ==='share'){
  119. this.state = 0
  120. this.isOrderShare = true
  121. }else if(option.type === 'confim' ||option.type === 'search'){
  122. this.state = 0
  123. }else{
  124. this.state = option.state
  125. }
  126. this.getHeaderTopHeight()
  127. this.initOrderDetaileData()
  128. },
  129. filters:{
  130. TextFormat(status) {//处理金额
  131. let HtmlText,
  132. typeTextObject={
  133. 0:'待确认',
  134. 4:'交易完成',
  135. 5:'订单完成',
  136. 6:'已关闭',
  137. 7:'交易全退',
  138. 77:'交易全退',
  139. 11:'待付款待发货',
  140. 12:'待付款部分发货',
  141. 13:'待付款已发货',
  142. 21:'部分付款待发货',
  143. 22:'部分付款部分发货',
  144. 23:'部分付款已发货',
  145. 31:'已付款待发货',
  146. 32:'已付款部分发货',
  147. 33:'已付款已发货',
  148. 111:'待付款待发货',
  149. };
  150. Object.keys(typeTextObject).forEach(key => {
  151. if(key == status){
  152. HtmlText = typeTextObject[key]
  153. }
  154. })
  155. return HtmlText
  156. },
  157. },
  158. methods: {
  159. openclauseConten(id){
  160. this.$api.navigateTo(`/pages/service/sellconten?clauseId=${id}`)
  161. },
  162. initOrderDetaileData(){//初始化页面数据@参数:订单ID
  163. this.OrderService.QueryOrderDetails({ orderId : this.orderId }).then(response =>{
  164. let resData = response.data;
  165. this.isRequest = true
  166. this.orderInfo = resData.order
  167. this.userID = resData.order.userID
  168. this.shareCode = resData.shareCode
  169. this.addressData = resData.userInfo
  170. this.information = resData.order
  171. this.btnStatus = resData.order.status
  172. this.payStatus = resData.order.payStatus
  173. this.payableAmount = resData.order.payableAmount
  174. this.shopOrderData = resData.shopOrderList
  175. this.orderInvoice = resData.orderInvoice
  176. this.onlinePayFlag = resData.order.onlinePayFlag
  177. this.returnedPurchaseList = resData.returnedPurchaseList
  178. this.discernReceiptList = resData.discernReceiptList
  179. this.receiptAmount = resData.order.receiptAmount
  180. this.returnedPurchaseFee = resData.order.returnedPurchaseFee
  181. this.clauseData = resData.clause
  182. if(this.information.orderSubmitType == 0 || this.information.orderSubmitType == 1 ||this.information.orderSubmitType == 2){
  183. this.orderSubmitType=true
  184. }else{
  185. this.orderSubmitType=false
  186. }
  187. }).catch(error =>{
  188. this.$util.modal('提示','订单查询失败,请稍后重试~','确定','',false,() =>{
  189. this.$api.switchTabTo('/pages/tabBar/home/index')
  190. })
  191. })
  192. },
  193. handButtonConfirm(data) {//获取点击
  194. console.log(data)
  195. this.hanldOrder = data
  196. this.btnoRderID = data.orderId
  197. this.OperationType = data.type
  198. this.handShowAlert(data)
  199. },
  200. handShowAlert(data) {//执行
  201. switch(data.type){
  202. case 'pay':
  203. this.$api.navigateTo(`/pages/user/order/order-details?path=pay&state=0&orderId=${this.btnoRderID}`)
  204. // this.WeChatMiniWxPay(this.hanldOrder);
  205. break;
  206. case 'delete':
  207. this.modal = true;
  208. this.contentModalText = '确认删除该订单吗?';
  209. break;
  210. case 'cancel':
  211. this.modal = true;
  212. this.contentModalText = '确认取消该订单吗?';
  213. break;
  214. case 'refund':
  215. uni.setStorageSync('refundData',data.order)
  216. this.$api.navigateTo('/pages/user/order/order-refund')
  217. break;
  218. case 'returned':
  219. uni.setStorageSync('refundData',data.order)
  220. this.$api.navigateTo('/pages/user/order/order-refund')
  221. break;
  222. case 'query':
  223. this.isModalLayer = true;
  224. this.$api.navigateTo('/pages/user/order/order-logistics?orderId='+data.orderId)
  225. break;
  226. case 'confirm':
  227. this.modal = true;
  228. this.contentModalText = '是否确认收货?'
  229. // this.handOrderConfirm(data.orderId);
  230. break;
  231. case 'cancelRefund':
  232. this.modal = true;
  233. this.contentModalText = '确定取消退货/退款?'
  234. // this.handCancelRefundConfirm(data.orderId);
  235. break;
  236. }
  237. },
  238. handleClick(e) {//用户操作订单
  239. let index = e.index;
  240. if(index == 1){
  241. switch(this.OperationType){
  242. case 'delete':
  243. this.handOrderDetele(data.orderId);
  244. break
  245. case 'cancel':
  246. this.handCenceConfirm(data.orderId)
  247. break
  248. case 'query':
  249. this.isModalLayer = true;
  250. this.$api.navigateTo('/pages/user/order/order-logistics?orderId='+data.orderId)
  251. break
  252. case 'confirm':
  253. this.handOrderConfirm(data.orderId);
  254. break
  255. case 'pay':
  256. this.hanldOrderData = data.order;
  257. this.getOrderPaymentValidation(data)
  258. break
  259. }
  260. }
  261. this.modal = false;
  262. },
  263. handOrderConfirm(){//确认收货
  264. this.$util.modal('提示','是否确认收货','确定','取消',true,() =>{
  265. this.OrderService.ConfirmReceipt({orderID:this.orderID}).then(response =>{
  266. this.$util.msg(response.msg,2000,true,'success');
  267. this.initOrderDetaileData()
  268. }).catch(error =>{
  269. this.$util.msg(error.msg,2000)
  270. })
  271. })
  272. },
  273. handOrderDetele(){//删除订单
  274. this.$util.modal('提示','确认删除该订单吗?','确定','取消',true,() =>{
  275. this.OrderService.DeleteOrder({orderID:this.orderID}).then(response =>{
  276. this.$util.msg(response.msg,2000,true,'success');
  277. setTimeout(() => {
  278. if(this.shareType ==='share'){
  279. this.$api.switchTabTo('/pages/tabBar/home/index')
  280. }else{
  281. this.$api.redirectTo(`/pages/user/order/order-list?type=detele&state=${this.state}`)
  282. }
  283. },500)
  284. }).catch(error =>{
  285. this.$util.msg(error.msg,2000)
  286. })
  287. })
  288. },
  289. handCenceConfirm(){//取消订单
  290. this.$util.modal('提示','确认取消该订单吗?','确定','取消',true,() =>{
  291. this.OrderService.CancelOrder({orderID:this.orderID}).then(response =>{
  292. this.$util.msg(response.msg,2000,true,'success');
  293. this.initOrderDetaileData()
  294. }).catch(error =>{
  295. this.$util.msg(error.msg,2000)
  296. })
  297. })
  298. },
  299. onShareAppMessage(res){//分享转发
  300. this.isShareModal = false
  301. if (res.from === 'button') {
  302. // 来自页面内转发按钮
  303. }
  304. return {
  305. title: '您有新的分享订单,快来查看吧~',
  306. path: `/pages/user/order/order-sharelogin?orderID=${this.orderID}&userID=${this.userID}`,
  307. imageUrl:'https://img.caimei365.com/group1/M00/03/95/Cmis216Sk_SABnOFABZCgCzFV_g063.png'
  308. }
  309. },
  310. hanldePopupFn(data){//监听活动内容
  311. this.popupShow = true
  312. this.handlerPros = data
  313. },
  314. getHeaderTopHeight(){
  315. let statusBarHeight = this.systeminfo.statusBarHeight // 状态栏高度
  316. let headerPosi = this.headerBtnPosi
  317. let btnPosi = { // 胶囊实际位置,坐标信息不是左上角原点
  318. height: headerPosi.height,
  319. width: headerPosi.width,
  320. // 胶囊top - 状态栏高度
  321. top: headerPosi.top - statusBarHeight,
  322. // 胶囊bottom - 胶囊height - 状态栏height (现胶囊bottom 为距离导航栏底部的长度)
  323. bottom: headerPosi.bottom - headerPosi.height - statusBarHeight,
  324. // 屏幕宽度 - 胶囊right
  325. right: this.systeminfo.screenWidth - headerPosi.right
  326. }
  327. this.navbarHeight= headerPosi.bottom + btnPosi.bottom// 原胶囊bottom + 现胶囊bottom
  328. },
  329. setHeaderBtnPosi(){
  330. // 获得胶囊按钮位置信息
  331. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  332. return headerBtnPosi
  333. },
  334. setSysteminfo(){
  335. let systeminfo;
  336. uni.getSystemInfo({ // 获取设备信息
  337. success: (res) => {
  338. systeminfo = res
  339. },
  340. })
  341. return systeminfo
  342. },
  343. },
  344. onShow() {
  345. }
  346. }
  347. </script>
  348. <style lang="scss">
  349. page {
  350. height: auto;
  351. background:#F7F7F7;
  352. }
  353. .details{
  354. padding-bottom: 130rpx;
  355. }
  356. .btn-hover{
  357. background: #FFFFFF;
  358. }
  359. .animation{
  360. /* transition: transform 0.3s ease;*/
  361. transition-property: transform;
  362. transition-duration: 0.3s;
  363. transition-timing-function: ease;
  364. }
  365. .invoice-balance{
  366. width: 702rpx;
  367. height: auto;
  368. padding:0 24rpx;
  369. background: #FFFFFF;
  370. float: left;
  371. margin-top: 24rpx;
  372. margin-bottom: 24rpx;
  373. .balabce-t{
  374. width: 100%;
  375. height: 86rpx;
  376. line-height: 86rpx;
  377. font-size: $font-size-28;
  378. color: $text-color;
  379. float: left;
  380. .balabce-t-le{
  381. float: left;
  382. font-weight: bold;
  383. }
  384. .balabce-t-ri{
  385. float: right;
  386. display: flex;
  387. align-items: center;
  388. .money{
  389. display: flex;
  390. float: left;
  391. }
  392. .checkbox-box{
  393. display: flex;
  394. width: 60rpx;
  395. float: left;
  396. height: 100%;
  397. font-size: $font-size-24;
  398. .checkbox{
  399. width: 40rpx;
  400. text-align: right;
  401. box-sizing: border-box;
  402. text-align: center;
  403. text-decoration: none;
  404. border-radius: 0;
  405. -webkit-tap-highlight-color: transparent;
  406. overflow: hidden;
  407. }
  408. }
  409. }
  410. }
  411. .balabce-b{
  412. width: 100%;
  413. float: left;
  414. overflow: hidden;
  415. .balabce-b-text{
  416. width: 100%;
  417. line-height: 58rpx;
  418. font-size: $font-size-24;
  419. color: #FF2A2A;
  420. text-align: right;
  421. float: right;
  422. }
  423. &.balabce-b--hide {
  424. padding: 0 0;
  425. height: 0px;
  426. line-height: 0px;
  427. }
  428. }
  429. }
  430. .clause{
  431. float: right;
  432. font-size: 24rpx;
  433. color: #999999;
  434. margin-top: 60rpx;
  435. margin-right: 24rpx;
  436. &.noclick{
  437. pointer-events: none;
  438. }
  439. .text{
  440. color: #1890f9;
  441. &.color-bg{
  442. color: #333333;
  443. }
  444. }
  445. }
  446. .status-text{
  447. overflow: hidden;
  448. padding:0 24rpx;
  449. background: #fff;
  450. font-size: $font-size-26;
  451. .view-type{
  452. float: left;
  453. color: #ff2a2a;
  454. }
  455. }
  456. </style>