order-details.vue 14 KB

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