orderDetail.vue 15 KB

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