orderDetail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. <template>
  2. <view class="orderDetail-digitalShel flex flex_column">
  3. <view class="contHead" :style="{background:state!= 'error'&&state!= 'AUDIT_REJECT'&&state!='CANCEL'&&state!='WAIT_PAY' ? '#066cff':'#e61100',color:'#fff'}">
  4. <view class="statusH">
  5. <view class="flex flex_column align_center">
  6. <view class="status-row">
  7. <u-icon :name="statusIcon" size="42" color="#fff">
  8. </u-icon>
  9. <text>{{statusText}}</text>
  10. </view>
  11. <view class="messageText" v-if="statusMessage"><text>{{statusMessage}}</text></view>
  12. <view v-if="info.billStatus=='WAIT_PAY'" class="messageText">
  13. 请尽快支付,
  14. <u-count-down separator="zh" :separator-size="24" bg-color="none" color="#ffff7f" separator-color="#ffff7f" :timestamp="info.timestamp" :show-days="false" :show-hours="false"></u-count-down>
  15. 后订单将自动取消。
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="order-body">
  21. <view class="info partList" v-if="partList.length" style="max-height: 50vh;overflow: auto;">
  22. <view class="infoList">
  23. <view class="title">
  24. 产品列表
  25. </view>
  26. <view v-if="info">
  27. 共<text class="cText">{{info.totalCategory}}</text>款
  28. </view>
  29. </view>
  30. <view v-for="(item,dix) in partList" :key="item.id" class="item-list-box">
  31. <view class="item-list flex">
  32. <view style="height: 160rpx;width: 160rpx;">
  33. <u-image :src="item.product.images+'?x-oss-process=image/resize,p_50'" border-radius="16" width="160" height="160" bg-color="#EBEBEB" ></u-image>
  34. </view>
  35. <view>
  36. <view class="item-name">
  37. <text>{{item.product.productName}}</text>
  38. </view>
  39. <view class="item-nums" v-if="item.product&&item.product.code">
  40. <text>{{item.product.code}}</text>
  41. </view>
  42. <view class="item-nums" v-if="item.product&&item.product.origCode">
  43. <text style="color: #00aaff;">{{item.product.origCode}}</text>
  44. </view>
  45. <view class="item-head">
  46. <view class="flex align_center">
  47. <view class="price-txt">¥<text>{{item.priceStr[0]}}</text>.{{item.priceStr[1]}}</view>
  48. <view class="flex align_center rebate-tag" v-if="item.promoProductType=='TICKET_PRODUCT'">
  49. 返<text>{{item.resultValue}}</text>元
  50. </view>
  51. <view class="flex align_center rebate-tag" v-if="item.promoProductType=='REGULAR_PRODUCT'">
  52. 买{{item.conditionValue}}赠{{item.resultValue}}
  53. </view>
  54. <view class="flex align_center tejia-tag" v-if="item.promoProductType=='SPECIAL_PRODUCT'">
  55. 特价<text>¥{{item.priceOrig}}</text>
  56. </view>
  57. </view>
  58. <view>
  59. X <text class="cText">{{item.qty}}</text>{{item.product&&item.product.unit||''}}
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <!-- 赠品 -->
  65. <view class="item-list flex gift-box" v-if="item.giftObj">
  66. <view style="height: 120rpx;width: 120rpx;margin-left: 40rpx;">
  67. <u-image :src="item.giftObj.product.images+'?x-oss-process=image/resize,p_50'" border-radius="16" width="120" height="120" bg-color="#EBEBEB" ></u-image>
  68. </view>
  69. <view>
  70. <view class="item-name flex align_center">
  71. <view class="flex align_center rebate-tag">
  72. 赠品
  73. </view>
  74. <text class="ellipsis-one">{{item.giftObj.product.productName}}</text>
  75. </view>
  76. <view class="item-nums ellipsis-one" v-if="item.giftObj.product&&item.giftObj.product.code">
  77. <text>{{item.giftObj.product.code}}</text>
  78. </view>
  79. <view class="item-nums ellipsis-one" v-if="item.giftObj.product&&item.giftObj.product.origCode">
  80. <text style="color: #666;">{{item.giftObj.product.origCode}}</text>
  81. </view>
  82. <view class="item-head">
  83. <view class="flex align_center"></view>
  84. <view>
  85. X <text class="cText">{{item.giftObj.qty}}</text>{{item.giftObj.product&&item.giftObj.product.unit||''}}
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. <!-- 分页 -->
  92. <view class="product-pages" v-if="totalPages>1">
  93. <uni-pages-nav :totalPages="totalPages" :showShadow="false" :currentPage="pageNo" @pagechanged="getRow"></uni-pages-nav>
  94. </view>
  95. </view>
  96. <view class="info" v-if="info">
  97. <view class="infoList gray-text" v-if="info.totalTicketGiveAmount">
  98. <text>代金券</text>
  99. <text class="cText">¥{{Number(info.totalTicketGiveAmount).toFixed(2)}}</text>
  100. </view>
  101. <view class="infoList gray-text" v-if="info.totalSpecialGiveAmount">
  102. <text>总优惠</text>
  103. <text class="cText">¥{{Number(info.totalSpecialGiveAmount).toFixed(2)}}</text>
  104. </view>
  105. <view class="infoList">
  106. <text>总金额</text>
  107. <view class="price-txt">¥<text>{{Number(info.totalAmount).toFixed(2)}}</text></view>
  108. </view>
  109. </view>
  110. <view class="info" v-if="info">
  111. <view class="infoList">
  112. <view class="title">单据信息</view>
  113. <view class="statu"></view>
  114. </view>
  115. <view class="infoList dju">
  116. <text>订单编号</text>
  117. <text>{{info.purchaseNo||'--'}}</text>
  118. </view>
  119. <view class="infoList">
  120. <text>下单时间</text>
  121. <text>{{info.purchaseDate||'--'}}</text>
  122. </view>
  123. <view class="infoList">
  124. <text>下单人员</text>
  125. <text>{{info.purchaserName || '--'}}</text>
  126. </view>
  127. <!-- 线下支付正常显示 -->
  128. <view class="infoList" v-if="info&&info.payOnlineFlag&&info.payOnlineFlag==0">
  129. <text>付款时间</text>
  130. <text>{{info.purchaseDate||'--'}}</text>
  131. </view>
  132. <!-- 线上支付 显示 -->
  133. <view v-if="info&&info.payOnlineFlag==1&&info.payInfo">>
  134. <view class="infoList">
  135. <text>支付方式</text>
  136. <text>{{info.payInfo.payWay||'--'}}</text>
  137. </view>
  138. <view class="infoList">
  139. <text>支付时间</text>
  140. <text>{{info.payInfo.payDate||'--'}}</text>
  141. </view>
  142. <view class="infoList" v-if="info&&info.billStatus != 'WAIT_AUDIT'&&info.billStatus != 'WAIT_PAY'">
  143. <text>审核时间</text>
  144. <text>{{info.payInfo.purchaseDate||'--'}}</text>
  145. </view>
  146. <view class="infoList">
  147. <text>退款方式</text>
  148. <text>{{info.payInfo.refundWay ||'--'}}</text>
  149. </view>
  150. <view class="infoList">
  151. <text>退款时间</text>
  152. <text>{{info.payInfo.refundDate ||'--'}}</text>
  153. </view>
  154. <view class="infoList" v-if="info&&info.billStatus === 'CANCEL'">
  155. <text>取消时间</text>
  156. <text>{{info.purchaseDate||'--'}}</text>
  157. </view>
  158. <view class="infoList" v-if="info&&(info.billStatus === 'CANCEL'||info.billStatus === 'WAIT_AUDIT'||info.billStatus == 'WAIT_PAY')">
  159. <text>配送汽配商</text>
  160. <text>{{info.purchaseDate||'--'}}</text>
  161. </view>
  162. </view>
  163. </view>
  164. </view>
  165. <view v-if="info&&info.billStatus == 'WAIT_AUDIT'||info.billStatus == 'WAIT_PAY'||info.billStatus == 'WAIT_RECEIVE'" style="background-color: #fff;">
  166. <view class="footer flex align_center justify_center">
  167. <u-button style="margin-left: 10px;" v-if="info.billStatus == 'WAIT_AUDIT'" size="mini" shape="round" type="default" plain @click="cancelOrder(info)">取消订单</u-button>
  168. <u-button style="margin-left: 10px;" v-if="info.billStatus == 'WAIT_PAY'" size="mini" shape="round" type="error" plain @click="payOrder(info)">立即支付</u-button>
  169. <!-- <u-button style="margin-left: 10px;" v-if="info.billStatus == 'FINISH'" size="mini" shape="round" type="error" plain @click="buyAgain(info)">再次购买</u-button> -->
  170. <u-button style="margin-left: 10px;" v-if="info.billStatus == 'WAIT_RECEIVE'" size="mini" shape="round" type="error" plain @click="receiveOrder(info)">确认收货</u-button>
  171. </view>
  172. <view :style="{height:safeAreaBottom+'px'}"></view>
  173. </view>
  174. <!-- 付款弹框 -->
  175. <payModal :showPopu="showPopu" :payInfo="payInfo" :payData="payData" @close="showPopu=false" @payComplete="payComplete"></payModal>
  176. </view>
  177. </template>
  178. <script>
  179. import payModal from '../components/payModal.vue'
  180. import { purchaseQueryDetailPage,purchaseCancel,purchaseReceive,purchasePay } from '@/api/purchase.js'
  181. export default {
  182. name: 'procureDetailOrder',
  183. components:{
  184. payModal
  185. },
  186. data() {
  187. return {
  188. loading: false,
  189. info: null,
  190. statusText: '',
  191. statusIcon: '', // 结算状态icon
  192. statusMessage: '请耐心等待汽配经销商进行配送',
  193. partList: [], // 配件列表
  194. state: 'success',
  195. pageNo:1,
  196. pageSize: 30,
  197. total: 0,
  198. purchaseSn: null,
  199. showPopu: false,
  200. safeAreaBottom: 0, // 底部安全区域高度
  201. payData: null
  202. }
  203. },
  204. onLoad(option) {
  205. this.safeAreaBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
  206. uni.setNavigationBarTitle({
  207. title: '采购订单详情'
  208. })
  209. const data = this.$store.state.vuex_tempOrderData //获取订单信息
  210. if(data){
  211. this.info = data
  212. this.state = data.billStatus
  213. this.purchaseSn = data.purchaseSn
  214. const stateText = {'WAIT_AUDIT':'待审核','WAIT_PAY':'待付款','AUDIT_REJECT':'审核不通过','WAIT_OUT_WAREHOUSE':'待收货','WAIT_RECEIVE':'待收货','FINISH':'已完结','CANCEL':'已取消'}
  215. this.statusText = stateText[this.state]
  216. this.statusIcon = this.state == 'FINISH' ? 'checkmark-circle' : ((this.state == 'AUDIT_REJECT'||this.state == 'CANCEL')?'close-circle':'hourglass')
  217. this.statusMessage = this.state == 'WAIT_OUT_WAREHOUSE'||this.state == 'WAIT_RECEIVE' ? '请耐心等待汽配经销商进行配送' : ''
  218. // 获取明细
  219. this.getDetailList()
  220. // 更改标题栏背景色
  221. uni.setNavigationBarColor({
  222. frontColor: '#ffffff',
  223. backgroundColor: this.state!= 'error'&&this.state!= 'AUDIT_REJECT'&&this.state!= 'CANCEL'&&this.state!= 'WAIT_PAY' ? '#066cff':'#e61100',
  224. })
  225. }
  226. },
  227. onUnload() {
  228. this.$store.state.vuex_tempOrderData = null
  229. },
  230. computed: {
  231. totalPages(){
  232. return Math.ceil(this.total / this.pageSize)
  233. },
  234. // 付款信息
  235. payInfo(){
  236. return this.$store.state.vuex_tempOrderData
  237. }
  238. },
  239. methods: {
  240. getRow(pageNo){
  241. this.pageNo = pageNo
  242. this.getDetailList()
  243. },
  244. getDetailList(){
  245. uni.showLoading({
  246. title: '加载中'
  247. })
  248. purchaseQueryDetailPage({purchaseSn: this.purchaseSn,pageNo:this.pageNo,pageSize:this.pageSize}).then(res => {
  249. if(res.status == 200){
  250. this.partList = res.data ? res.data.list : []
  251. // 是否有赠品
  252. const giftList = this.partList.filter(item => item.promoProductType == 'GIFT_PRODUCT')
  253. // 正品
  254. this.partList = this.partList.filter(item => item.promoProductType !== 'GIFT_PRODUCT')
  255. this.partList.map(item=>{
  256. // 关联赠品
  257. item.giftObj = giftList.find(gift => gift.purchaseDetailParentSn == item.purchaseDetailSn)
  258. item.priceStr = Number(item.price).toFixed(2).toString().split('.')
  259. })
  260. this.total = res.data ? res.data.count : 0
  261. }
  262. // 滚动到顶部
  263. this.$nextTick(()=>{
  264. uni.pageScrollTo({
  265. scrollTop: 0,
  266. duration: 300
  267. });
  268. uni.hideLoading()
  269. })
  270. })
  271. },
  272. message(title){
  273. uni.showToast({
  274. icon:'none',
  275. title: title
  276. })
  277. },
  278. // 取消订单
  279. cancelOrder(item){
  280. let _this = this
  281. uni.showModal({
  282. title: '提示',
  283. content: '确定取消订单吗?',
  284. success: function (res) {
  285. if (res.confirm) {
  286. purchaseCancel({purchaseSn:_this.purchaseSn}).then(res => {
  287. if (res.status == 200) {
  288. _this.message('取消成功')
  289. uni.$emit('refreshPurcaOrder',item,'CANCEL')
  290. uni.navigateBack()
  291. } else {
  292. _this.message(res.message)
  293. }
  294. })
  295. }
  296. }
  297. });
  298. },
  299. // 立即支付
  300. payOrder(item){
  301. purchasePay({
  302. bizSn:item.purchaseSn,
  303. bizNo:item.purchaseNo,
  304. bizType:'PURCHASE',
  305. }).then(res=>{
  306. this.showPopu = true
  307. this.payData = res.data?res.data.payRequestRest:null
  308. })
  309. },
  310. // 付款成功,isOk: false 取消支付或支付失败,true 支付完成
  311. payComplete(item,isOk){
  312. this.showPopu = false
  313. if(isOk){
  314. uni.$emit('refreshPurcaOrder',item,'WAIT_AUDIT')
  315. uni.navigateBack()
  316. }
  317. },
  318. // 再次购买
  319. buyAgain(item){
  320. },
  321. // 确认收货
  322. receiveOrder(item){
  323. let _this = this
  324. uni.showModal({
  325. title: '提示',
  326. content: '确定收货吗?',
  327. success: function (res) {
  328. if (res.confirm) {
  329. purchaseReceive({purchaseSn:_this.purchaseSn}).then(res => {
  330. if (res.status == 200) {
  331. _this.message('收货成功')
  332. uni.$emit('refreshPurcaOrder',item,'FINISH')
  333. uni.navigateBack()
  334. } else {
  335. _this.message(res.message)
  336. }
  337. })
  338. }
  339. }
  340. });
  341. },
  342. }
  343. }
  344. </script>
  345. <style lang="less">
  346. page{
  347. height: 100%;
  348. }
  349. .orderDetail-digitalShel{
  350. height: 100%;
  351. .redText{
  352. color: #FB1E1E;
  353. margin: 0 10rpx;
  354. }
  355. .cText{
  356. color: #666;
  357. margin: 0 6rpx;
  358. font-size: 14px;
  359. }
  360. .gray-text{
  361. text{
  362. font-size: 14px;
  363. color: #999;
  364. }
  365. }
  366. .order-body{
  367. flex-grow: 1;
  368. overflow: auto;
  369. .partList{
  370. margin-top: 20rpx;
  371. }
  372. }
  373. .contHead {
  374. .statusH{
  375. > view{
  376. padding: 10upx 12%;
  377. font-size: 34upx;
  378. }
  379. .status-row{
  380. font-size: 42upx;
  381. text{
  382. margin-left: 10rpx;
  383. }
  384. }
  385. .messageText{
  386. font-size: 28upx;
  387. text-align: center;
  388. text{
  389. color: #f3e781;
  390. }
  391. padding: 20rpx 0;
  392. }
  393. }
  394. }
  395. .price-txt{
  396. color: red;
  397. display: flex;
  398. align-items: baseline;
  399. font-size: 12px;
  400. text{
  401. font-size: 32rpx;
  402. }
  403. }
  404. .info{
  405. background-color: #FFFFFF;
  406. padding: 10rpx 30upx;
  407. font-size: 32rpx;
  408. margin-bottom: 20rpx;
  409. .infoList{
  410. display: flex;
  411. justify-content: space-between;
  412. align-items: center;
  413. padding: 20rpx 0;
  414. border-bottom: 2rpx solid #f2f2f2;
  415. &:last-child{
  416. border: none;
  417. }
  418. .title{
  419. font-weight: bold;
  420. > text{
  421. color: #ff9808;
  422. font-size: 24upx;
  423. }
  424. }
  425. > text{
  426. &:first-child{
  427. color: #666E75;
  428. }
  429. }
  430. }
  431. .item-list-box{
  432. border-bottom: 2rpx solid #f2f2f2;
  433. &:last-child{
  434. border: none;
  435. }
  436. }
  437. .item-list{
  438. padding: 20rpx 0;
  439. > view{
  440. &:first-child{
  441. margin-right: 20rpx;
  442. position: relative;
  443. overflow: hidden;
  444. width: 160rpx;
  445. height: 160rpx;
  446. border-radius: 6px;
  447. border: 1px solid #eee;
  448. }
  449. &:last-child{
  450. flex-grow: 1;
  451. width: 60%;
  452. }
  453. }
  454. .item-name{
  455. word-wrap: break-word;
  456. font-size: 28rpx;
  457. color: #333;
  458. font-weight: bold;
  459. }
  460. .item-nums{
  461. text{
  462. font-size: 28rpx;
  463. color: #666;
  464. }
  465. }
  466. .item-head{
  467. display: flex;
  468. align-items: center;
  469. justify-content: space-between;
  470. color: #666;
  471. margin-top: 5px;
  472. > view:last-child{
  473. font-size: 24rpx;
  474. text{
  475. margin: 0 10rpx;
  476. font-size: 28rpx;
  477. }
  478. }
  479. }
  480. .rebate-tag{
  481. background: #ffe7df;
  482. color: #E91E63;
  483. padding: 2px 5px;
  484. font-size: 10px;
  485. border-radius: 3px;
  486. margin-left: 6px;
  487. }
  488. .tejia-tag{
  489. color: #E91E63;
  490. margin-left: 6px;
  491. font-size: 12px;
  492. text{
  493. font-size: 12px;
  494. color: #999;
  495. margin-left: 5px;
  496. text-decoration: line-through;
  497. }
  498. }
  499. }
  500. }
  501. .gift-box.item-list{
  502. .item-name{
  503. color: #666;
  504. font-size: 12px;
  505. font-weight: normal;
  506. }
  507. .item-nums{
  508. text{
  509. color: #666;
  510. font-size: 12px;
  511. }
  512. }
  513. .rebate-tag{
  514. margin-left: 0;
  515. margin-right: 5px;
  516. }
  517. .ellipsis-one{
  518. flex-grow: 1;
  519. width:80%;
  520. }
  521. }
  522. .footer{
  523. padding: 20upx 20upx 0;
  524. background: #FFFFFF;
  525. }
  526. }
  527. </style>