order-details.vue 13 KB

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