order-details.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  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. <!-- 地址选择 -->
  7. <order-address ref="orderAddress" v-if="isRequest" :addressData="addressData"></order-address>
  8. <!-- 订单信息 -->
  9. <order-information ref="information" v-if="isRequest" :information="information"></order-information>
  10. <!-- 商品 -->
  11. <goods-list ref='goods' v-if="isRequest" :shopOrderData="shopOrderData" @popupClick="hanldePopupFn"></goods-list>
  12. <!-- 发票信息 -->
  13. <invoice-tent ref="invoice" v-if="isRequest" :orderInvoice="orderInvoice"></invoice-tent>
  14. <!-- 转账信息 -->
  15. <transfe-record ref="transfe" v-if="isRequest"></transfe-record>
  16. <!-- 支付记录 -->
  17. <payment-record ref="payment" v-if="isRequest" :discernReceiptList="discernReceiptList" :receiptAmount="receiptAmount"></payment-record>
  18. <!-- 退款记录 -->
  19. <refund-record ref="refund" v-if="isRequest" :returnedPurchaseList="returnedPurchaseList" :returnedPurchaseFee="returnedPurchaseFee"></refund-record>
  20. <!-- 底部button -->
  21. <order-button ref="orderButton"
  22. v-if= "isRequest"
  23. :status= "btnStatus"
  24. :order="information"
  25. :rechargeGoods = "rechargeGoods"
  26. :ableUserMoney = "ableUserMoney"
  27. :shareCode= "shareCode"
  28. @buttonConfirm="handButtonConfirm">
  29. </order-button>
  30. </view>
  31. <!-- 付款弹窗 -->
  32. <order-model v-if="isPayModel"
  33. :payModelData="payModelData"
  34. :modelType='modelType'
  35. @paymentConfirm ='hanldPaymentConfirm'/>
  36. <!-- 分享弹窗 -->
  37. <share-alert :orderID="orderID"
  38. v-if="isShareModal"
  39. @shareConfirm ='onShareAppMessage'>
  40. </share-alert>
  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/sellerDetaileButton' //底部按钮
  55. import shareAlert from '@/components/cm-module/modelAlert/sellerShareAlert.vue' //分享弹窗
  56. import orderModel from '@/components/cm-module/modelAlert/order-alert' //付款弹窗
  57. import activiPopup from "@/components/cm-module/orderDetails/activipopu" //促销活动弹窗
  58. import { queryOrderDetails,cancelOrder,deleteOrder,affirmOrder } from "@/api/order.js"
  59. export default {
  60. components:{
  61. headerBack,
  62. orderInformation,
  63. orderAddress,
  64. invoiceTent,
  65. goodsList,
  66. transfeRecord,
  67. paymentRecord,
  68. refundRecord,
  69. orderButton,
  70. shareAlert,
  71. orderModel,
  72. activiPopup
  73. },
  74. data() {
  75. return {
  76. state:0,
  77. userID:'',
  78. orderID:'',
  79. serviceProviderId:'', //协销ID
  80. shareCode:'', //分享码
  81. shareType:'', //分享登录页过来记录的状态
  82. cellPhone:'', //客服电话
  83. payStatus:0,
  84. btnStatus:0, //按钮组件状态
  85. isRequest:false, //是否加载完成渲染子组件
  86. isOrderShare:false,
  87. isShareModal:false,
  88. isPayModel:false,
  89. modelType:0,
  90. ableUserMoney:'', //机构余额
  91. payModelData:{},
  92. addressData:{}, //地址信息初始化
  93. information:{}, //订单信息初始化
  94. shopOrderData:{}, //商品信息初始化
  95. orderInvoice:{}, //发票信息初始化
  96. returnedPurchaseList:{}, //退款信息初始化
  97. discernReceiptList:{}, //支付信息初始化
  98. receiptAmount:0, //支付金额
  99. returnedPurchaseFee:0, //退款金额
  100. navbarHeight:'',
  101. rechargeGoods:false,
  102. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  103. systeminfo: this.setSysteminfo(), //获取设备信息
  104. isIphoneX:this.$store.state.isIphoneX,
  105. CustomBar:this.CustomBar,// 顶部导航栏高度
  106. popupShow:false,
  107. handlerPros:{},
  108. nvabarData: { //顶部自定义导航
  109. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示
  110. title: '订单详情', // 导航栏 中间的标题
  111. }
  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.listType = 0
  120. this.isOrderShare = true
  121. }else if(option.type === 'confim' || option.type === 'search' || option.type === 'cash'){
  122. this.listType = 0
  123. }else{
  124. this.listType = option.listType
  125. }
  126. this.getHeaderTopHeight()
  127. this.initOrderDetaileData()
  128. },
  129. methods: {
  130. initOrderDetaileData(){//初始化页面数据@参数:订单ID
  131. queryOrderDetails({ orderID : this.orderID }).then(response =>{
  132. let resData = response.data;
  133. this.isRequest = true
  134. this.rechargeGoods = resData.rechargeGoods
  135. this.userID = resData.order.userID
  136. this.shareCode = resData.shareCode
  137. this.addressData = resData.userInfo
  138. this.information = resData.order
  139. this.btnStatus = resData.order.status
  140. this.payStatus = resData.order.payStatus
  141. this.shopOrderData = resData.shopOrderList
  142. this.orderInvoice = resData.orderInvoice
  143. this.returnedPurchaseList = resData.returnedPurchaseList
  144. this.discernReceiptList = resData.discernReceiptList
  145. this.receiptAmount = resData.order.receiptAmount
  146. this.returnedPurchaseFee = resData.order.returnedPurchaseFee
  147. this.ableUserMoney = resData.ableUserMoney
  148. }).catch(error =>{
  149. this.$util.modal('提示','订单查询失败,请稍后重试~','确定','',false,() =>{
  150. this.$api.switchTabTo('/seller/pages/index/index')
  151. })
  152. })
  153. },
  154. handButtonConfirm(data){//监听点击时间的按钮类型并执行...
  155. this.handShowAlert(data)
  156. },
  157. handShowAlert(data){//判断点击的按钮类型并执行...
  158. switch(data.type){
  159. case 'delete':
  160. this.handOrderDetele();
  161. break;
  162. case 'cancel':
  163. this.handCenceConfirm();
  164. break;
  165. case 'confirm':
  166. this.handOrderConfirm(data)
  167. break;
  168. case 'balance':
  169. this.getOrderPaymentValidation(data)
  170. break;
  171. }
  172. },
  173. handOrderConfirm(data){//确认订单
  174. this.$util.modal('提示','确认此订单?','确定','取消',true,() =>{
  175. affirmOrder({orderID:this.orderID}).then(response =>{
  176. this.$util.msg(response.msg,2000,true,'success');
  177. this.initOrderDetaileData()
  178. }).catch(error =>{
  179. this.$util.msg(error.msg,2000)
  180. })
  181. })
  182. },
  183. hanldPaymentConfirm(data){//监听余额抵扣按钮
  184. switch(data.type){
  185. case 3:
  186. this.OrderService.OrderBalanceDeduction({orderId:this.orderID}).then(response =>{
  187. this.$util.msg('余额抵扣成功',2000)
  188. this.initOrderDetaileData()
  189. }).catch(error =>{
  190. this.$util.msg(error.msg,2000)
  191. })
  192. break;
  193. }
  194. },
  195. getOrderPaymentValidation(data){//监听根据付款状态做操作
  196. this.OrderService.OrderPaymentValidation({orderId:data.orderId}).then(response =>{
  197. let dataCode = response.data.code
  198. this.payModelData = response.data
  199. if(dataCode == -1){
  200. this.$util.modal('','订单已申请全部退款,无需再付款!','确定','',false,() =>{})
  201. }else{
  202. this.isPayModel = true;
  203. this.modelType = 3
  204. }
  205. }).catch(error =>{
  206. this.$util.msg(error.msg,2000)
  207. })
  208. },
  209. handOrderDetele(){//删除订单
  210. this.$util.modal('提示','确认删除该订单吗?','确定','取消',true,() =>{
  211. deleteOrder({orderID:this.orderID}).then(response =>{
  212. this.$util.msg(response.msg,2000,true,'success');
  213. setTimeout(() => {
  214. if(this.shareType ==='share'){
  215. this.$api.navigateTo('/seller/pages/index/index')
  216. }else{
  217. this.$api.navigateTo(`/seller/pages/order/order-list?type=detele&listType=${this.listType}`)
  218. }
  219. },500)
  220. }).catch(error =>{
  221. this.$util.msg(error.msg,2000)
  222. })
  223. })
  224. },
  225. handCenceConfirm(){//取消订单
  226. this.$util.modal('提示','确认取消该订单吗?','确定','取消',true,() =>{
  227. cancelOrder({orderID:this.orderID}).then(response =>{
  228. this.$util.msg(response.msg,2000,true,'success');
  229. this.initOrderDetaileData()
  230. }).catch(error =>{
  231. this.$util.msg(error.msg,2000)
  232. })
  233. })
  234. },
  235. hanldePopupFn(data){//监听活动内容
  236. this.popupShow = true
  237. this.handlerPros = data
  238. },
  239. onShareAppMessage(res){//分享转发
  240. this.isShareModal = false
  241. if (res.from === 'button') {
  242. // 来自页面内转发按钮
  243. }
  244. return {
  245. title: '您有新的订单,请点击查看~',
  246. path: `/pages/user/order/order-sharelogin?orderID=${this.orderID}&userID=${this.userID}&serviceProviderId=${this.serviceProviderId}`,
  247. imageUrl:'https://img.caimei365.com/group1/M00/03/95/Cmis216Sk_SABnOFABZCgCzFV_g063.png'
  248. }
  249. },
  250. getHeaderTopHeight(){
  251. let statusBarHeight = this.systeminfo.statusBarHeight // 状态栏高度
  252. let headerPosi = this.headerBtnPosi
  253. let btnPosi = { // 胶囊实际位置,坐标信息不是左上角原点
  254. height: headerPosi.height,
  255. width: headerPosi.width,
  256. // 胶囊top - 状态栏高度
  257. top: headerPosi.top - statusBarHeight,
  258. // 胶囊bottom - 胶囊height - 状态栏height (现胶囊bottom 为距离导航栏底部的长度)
  259. bottom: headerPosi.bottom - headerPosi.height - statusBarHeight,
  260. // 屏幕宽度 - 胶囊right
  261. right: this.systeminfo.screenWidth - headerPosi.right
  262. }
  263. this.navbarHeight= headerPosi.bottom + btnPosi.bottom// 原胶囊bottom + 现胶囊bottom
  264. },
  265. setHeaderBtnPosi(){
  266. // 获得胶囊按钮位置信息
  267. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  268. return headerBtnPosi
  269. },
  270. setSysteminfo(){
  271. let systeminfo;
  272. uni.getSystemInfo({ // 获取设备信息
  273. success: (res) => {
  274. systeminfo = res
  275. },
  276. })
  277. return systeminfo
  278. },
  279. },
  280. onShow() {
  281. this.$api.getStorage().then((resolve) =>{
  282. this.serviceProviderId = resolve.serviceProviderID
  283. })
  284. }
  285. }
  286. </script>
  287. <style lang="scss">
  288. page {
  289. height: auto;
  290. background:#F7F7F7;
  291. }
  292. .btn-hover{
  293. background: #FFFFFF;
  294. }
  295. .animation{
  296. /* transition: transform 0.3s ease;*/
  297. transition-property: transform;
  298. transition-duration: 0.3s;
  299. transition-timing-function: ease;
  300. }
  301. .invoice-balance{
  302. width: 702rpx;
  303. height: auto;
  304. padding:0 24rpx;
  305. background: #FFFFFF;
  306. float: left;
  307. margin-top: 24rpx;
  308. margin-bottom: 24rpx;
  309. .balabce-t{
  310. width: 100%;
  311. height: 86rpx;
  312. line-height: 86rpx;
  313. font-size: $font-size-28;
  314. color: $text-color;
  315. float: left;
  316. .balabce-t-le{
  317. float: left;
  318. font-weight: bold;
  319. }
  320. .balabce-t-ri{
  321. float: right;
  322. display: flex;
  323. align-items: center;
  324. .money{
  325. display: flex;
  326. float: left;
  327. }
  328. .checkbox-box{
  329. display: flex;
  330. width: 60rpx;
  331. float: left;
  332. height: 100%;
  333. font-size: $font-size-24;
  334. .checkbox{
  335. width: 40rpx;
  336. text-align: right;
  337. box-sizing: border-box;
  338. text-align: center;
  339. text-decoration: none;
  340. border-radius: 0;
  341. -webkit-tap-highlight-color: transparent;
  342. overflow: hidden;
  343. }
  344. }
  345. }
  346. }
  347. .balabce-b{
  348. width: 100%;
  349. float: left;
  350. overflow: hidden;
  351. .balabce-b-text{
  352. width: 100%;
  353. line-height: 58rpx;
  354. font-size: $font-size-24;
  355. color: #FF2A2A;
  356. text-align: right;
  357. float: right;
  358. }
  359. &.balabce-b--hide {
  360. padding: 0 0;
  361. height: 0px;
  362. line-height: 0px;
  363. }
  364. }
  365. }
  366. </style>