order-details.vue 14 KB

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