order-details.vue 12 KB

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