order-details.vue 12 KB

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