order-details.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  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. 4:'交易完成',
  134. 5:'订单完成',
  135. 6:'已关闭',
  136. 7:'交易全退',
  137. 77:'交易全退',
  138. 11:'待付款待发货',
  139. 12:'待付款部分发货',
  140. 13:'待付款已发货',
  141. 21:'部分付款待发货',
  142. 22:'部分付款部分发货',
  143. 23:'部分付款已发货',
  144. 31:'已付款待发货',
  145. 32:'已付款部分发货',
  146. 33:'已付款已发货',
  147. 111:'待付款待发货',
  148. };
  149. Object.keys(typeTextObject).forEach(key => {
  150. if(key == status){
  151. HtmlText = typeTextObject[key]
  152. }
  153. })
  154. return HtmlText
  155. },
  156. },
  157. methods: {
  158. openclauseConten(id){
  159. this.$api.navigateTo(`/pages/service/sellconten?clauseId=${id}`)
  160. },
  161. initOrderDetaileData(){//初始化页面数据@参数:订单ID
  162. this.OrderService.QueryOrderDetails({ orderId : this.orderId }).then(response =>{
  163. let resData = response.data;
  164. this.isRequest = true
  165. this.orderInfo = resData.order
  166. this.userID = resData.order.userID
  167. this.shareCode = resData.shareCode
  168. this.addressData = resData.userInfo
  169. this.information = resData.order
  170. this.btnStatus = resData.order.status
  171. this.payStatus = resData.order.payStatus
  172. this.payableAmount = resData.order.payableAmount
  173. this.shopOrderData = resData.shopOrderList
  174. this.orderInvoice = resData.orderInvoice
  175. this.onlinePayFlag = resData.order.onlinePayFlag
  176. this.returnedPurchaseList = resData.returnedPurchaseList
  177. this.discernReceiptList = resData.discernReceiptList
  178. this.receiptAmount = resData.order.receiptAmount
  179. this.returnedPurchaseFee = resData.order.returnedPurchaseFee
  180. this.clauseData = resData.clause
  181. if(this.information.orderSubmitType == 0 || this.information.orderSubmitType == 1 ||this.information.orderSubmitType == 2){
  182. this.orderSubmitType=true
  183. }else{
  184. this.orderSubmitType=false
  185. }
  186. }).catch(error =>{
  187. this.$util.modal('提示','订单查询失败,请稍后重试~','确定','',false,() =>{
  188. this.$api.switchTabTo('/pages/tabBar/home/index')
  189. })
  190. })
  191. },
  192. handButtonConfirm(data) {//获取点击
  193. console.log(data)
  194. this.hanldOrder = data
  195. this.btnoRderID = data.orderId
  196. this.OperationType = data.type
  197. this.handShowAlert(data)
  198. },
  199. handShowAlert(data) {//执行
  200. switch(data.type){
  201. case 'cancel':
  202. this.modal = true;
  203. this.contentModalText = '确认取消该订单吗?';
  204. break;
  205. case 'delete':
  206. this.modal = true;
  207. this.contentModalText = '确认删除该订单吗?';
  208. break;
  209. case 'query':
  210. this.isModalLayer = true;
  211. this.$api.navigateTo('/pages/user/order/order-logistics?orderId='+this.orderId)
  212. break;
  213. case 'confirm':
  214. this.modal = true;
  215. this.contentModalText = '是否确认收货?'
  216. break;
  217. case 'pay':
  218. this.$api.navigateTo(`/pages/user/order/order-payment?type=payfirm&orderId=${this.orderId}`)
  219. break;
  220. }
  221. },
  222. handleClick(e) {//用户操作订单
  223. let index = e.index;
  224. if(index == 1){
  225. switch(this.OperationType){
  226. case 'delete':
  227. this.handOrderDetele(this.orderId);
  228. break
  229. case 'cancel':
  230. this.handCenceConfirm(this.orderId)
  231. break
  232. case 'query':
  233. this.isModalLayer = true;
  234. this.$api.navigateTo('/pages/user/order/order-logistics?orderId='+this.orderId)
  235. break
  236. case 'confirm':
  237. this.handOrderConfirm(this.orderId);
  238. break
  239. }
  240. }
  241. this.modal = false;
  242. },
  243. handOrderConfirm (id){//确认收货
  244. this.OrderService.ConfirmReceipt({orderId:id}).then(response =>{
  245. this.$util.msg(response.msg,2000,true,'success');
  246. setTimeout(() => {
  247. this.initOrderDetaileData(this.currentTab)
  248. },2000)
  249. }).catch(error =>{
  250. this.$util.msg(error.msg,2000)
  251. })
  252. },
  253. handOrderDetele(id){//删除订单
  254. this.OrderService.DeleteOrder({orderId:id}).then(response =>{
  255. this.$util.msg(response.msg,2000,true,'success');
  256. setTimeout(() => {
  257. if(this.shareType ==='share'){
  258. this.$api.redirectTo('/pages/index/index')
  259. }else{
  260. this.$api.redirectTo(`/pages/user/order/order-list?type=detele&state=${this.state}`)
  261. }
  262. },500)
  263. }).catch(error =>{
  264. this.$util.msg(error.msg,2000)
  265. })
  266. },
  267. handCenceConfirm(id){//取消订单
  268. this.OrderService.CancelOrder({orderId:id}).then(response =>{
  269. this.$util.msg(response.msg,2000,true,'success');
  270. setTimeout(() => {
  271. this.initOrderDetaileData(this.currentTab)
  272. },2000)
  273. }).catch(error =>{
  274. this.$util.msg(error.msg,2000)
  275. })
  276. },
  277. handlSearchPath(){
  278. this.$api.navigateTo('/pages/user/order/search-order')
  279. },
  280. onShareAppMessage (res){//分享转发
  281. this.isShareModal = false
  282. if (res.from === 'button') {// 来自页面内转发按钮
  283. }
  284. return {
  285. title: '点击查看您的订单~',
  286. path: `/pages/user/order/order-sharelogin?orderID=${this.btnoRderID}&userId=${this.userId}`,
  287. imageUrl:'https://static-b.caimei365.com/app/wisa/img/icon/icon-share.png'
  288. }
  289. },
  290. hanldePopupFn(data){//监听活动内容
  291. this.popupShow = true
  292. this.handlerPros = data
  293. },
  294. getHeaderTopHeight(){
  295. let statusBarHeight = this.systeminfo.statusBarHeight // 状态栏高度
  296. let headerPosi = this.headerBtnPosi
  297. let btnPosi = { // 胶囊实际位置,坐标信息不是左上角原点
  298. height: headerPosi.height,
  299. width: headerPosi.width,
  300. // 胶囊top - 状态栏高度
  301. top: headerPosi.top - statusBarHeight,
  302. // 胶囊bottom - 胶囊height - 状态栏height (现胶囊bottom 为距离导航栏底部的长度)
  303. bottom: headerPosi.bottom - headerPosi.height - statusBarHeight,
  304. // 屏幕宽度 - 胶囊right
  305. right: this.systeminfo.screenWidth - headerPosi.right
  306. }
  307. this.navbarHeight= headerPosi.bottom + btnPosi.bottom// 原胶囊bottom + 现胶囊bottom
  308. },
  309. setHeaderBtnPosi(){
  310. // 获得胶囊按钮位置信息
  311. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  312. return headerBtnPosi
  313. },
  314. setSysteminfo(){
  315. let systeminfo;
  316. uni.getSystemInfo({ // 获取设备信息
  317. success: (res) => {
  318. systeminfo = res
  319. },
  320. })
  321. return systeminfo
  322. },
  323. },
  324. onShow() {
  325. }
  326. }
  327. </script>
  328. <style lang="scss">
  329. page {
  330. height: auto;
  331. background:#F7F7F7;
  332. }
  333. .details{
  334. padding-bottom: 130rpx;
  335. }
  336. .btn-hover{
  337. background: #FFFFFF;
  338. }
  339. .animation{
  340. /* transition: transform 0.3s ease;*/
  341. transition-property: transform;
  342. transition-duration: 0.3s;
  343. transition-timing-function: ease;
  344. }
  345. .invoice-balance{
  346. width: 702rpx;
  347. height: auto;
  348. padding:0 24rpx;
  349. background: #FFFFFF;
  350. float: left;
  351. margin-top: 24rpx;
  352. margin-bottom: 24rpx;
  353. .balabce-t{
  354. width: 100%;
  355. height: 86rpx;
  356. line-height: 86rpx;
  357. font-size: $font-size-28;
  358. color: $text-color;
  359. float: left;
  360. .balabce-t-le{
  361. float: left;
  362. font-weight: bold;
  363. }
  364. .balabce-t-ri{
  365. float: right;
  366. display: flex;
  367. align-items: center;
  368. .money{
  369. display: flex;
  370. float: left;
  371. }
  372. .checkbox-box{
  373. display: flex;
  374. width: 60rpx;
  375. float: left;
  376. height: 100%;
  377. font-size: $font-size-24;
  378. .checkbox{
  379. width: 40rpx;
  380. text-align: right;
  381. box-sizing: border-box;
  382. text-align: center;
  383. text-decoration: none;
  384. border-radius: 0;
  385. -webkit-tap-highlight-color: transparent;
  386. overflow: hidden;
  387. }
  388. }
  389. }
  390. }
  391. .balabce-b{
  392. width: 100%;
  393. float: left;
  394. overflow: hidden;
  395. .balabce-b-text{
  396. width: 100%;
  397. line-height: 58rpx;
  398. font-size: $font-size-24;
  399. color: #FF2A2A;
  400. text-align: right;
  401. float: right;
  402. }
  403. &.balabce-b--hide {
  404. padding: 0 0;
  405. height: 0px;
  406. line-height: 0px;
  407. }
  408. }
  409. }
  410. .clause{
  411. float: right;
  412. font-size: 24rpx;
  413. color: #999999;
  414. margin-top: 60rpx;
  415. margin-right: 24rpx;
  416. &.noclick{
  417. pointer-events: none;
  418. }
  419. .text{
  420. color: #1890f9;
  421. &.color-bg{
  422. color: #333333;
  423. }
  424. }
  425. }
  426. .status-text{
  427. overflow: hidden;
  428. padding:0 24rpx;
  429. background: #fff;
  430. font-size: $font-size-26;
  431. .view-type{
  432. float: left;
  433. color: #ff2a2a;
  434. }
  435. }
  436. </style>