order-details.vue 12 KB

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