orderDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. <template>
  2. <view class="orderDetail-digitalShel flex flex_column">
  3. <view class="contHead" :style="{background:state!= 'error'&&state!= 'AUDIT_REJECT'&&state!='CANCEL' ? '#066cff':'#f34503',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"><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. <view class="infoList">
  123. <text>付款时间</text>
  124. <text>{{info.purchaseDate||'--'}}</text>
  125. </view>
  126. </view>
  127. </view>
  128. <view class="footer" v-if="info">
  129. <view class="flex align_center justify_center">
  130. <u-button style="margin-left: 10px;" v-if="info.billStatus == 'WAIT_AUDIT'" size="mini" shape="round" type="default" plain @click="cancelOrder(info)">取消订单</u-button>
  131. <u-button style="margin-left: 10px;" v-if="info.billStatus == 'WAIT_AUDIT'" size="mini" shape="round" type="error" plain @click="payOrder(info)">立即支付</u-button>
  132. <!-- <u-button style="margin-left: 10px;" v-if="info.billStatus == 'CANCEL'" size="mini" shape="round" type="error" plain @click="buyAgain(info)">再次购买</u-button> -->
  133. <u-button style="margin-left: 10px;" v-if="info.billStatus == 'WAIT_RECEIVE'" size="mini" shape="round" type="error" plain @click="receiveOrder(info)">确认收货</u-button>
  134. </view>
  135. <view :style="{height:safeAreaBottom+'px'}"></view>
  136. </view>
  137. <!-- 付款弹框 -->
  138. <payModal :showPopu="showPopu" :payInfo="payInfo" @close="showPopu=false" @payComplete="payComplete"></payModal>
  139. </view>
  140. </template>
  141. <script>
  142. import payModal from '../components/payModal.vue'
  143. import { purchaseQueryDetailPage,purchaseCancel,purchaseReceive } from '@/api/purchase.js'
  144. export default {
  145. name: 'procureDetailOrder',
  146. components:{
  147. payModal
  148. },
  149. data() {
  150. return {
  151. loading: false,
  152. info: null,
  153. statusText: '',
  154. statusIcon: '', // 结算状态icon
  155. statusMessage: '请耐心等待汽配经销商进行配送',
  156. partList: [], // 配件列表
  157. state: 'success',
  158. pageNo:1,
  159. pageSize: 30,
  160. total: 0,
  161. purchaseSn: null,
  162. showPopu: false,
  163. safeAreaBottom: 0, // 底部安全区域高度
  164. }
  165. },
  166. onLoad(option) {
  167. this.safeAreaBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
  168. uni.setNavigationBarTitle({
  169. title: '采购订单详情'
  170. })
  171. const data = this.$store.state.vuex_tempOrderData
  172. if(data){
  173. this.info = data
  174. this.state = data.billStatus
  175. this.purchaseSn = data.purchaseSn
  176. const stateText = {'WAIT_AUDIT':'待审核','WAIT_PAY':'待付款','AUDIT_REJECT':'审核不通过','WAIT_OUT_WAREHOUSE':'待收货','FINISH':'已完结','CANCEL':'已取消'}
  177. this.statusText = stateText[this.state]
  178. this.statusIcon = this.state == 'FINISH' ? 'checkmark-circle' : (this.state == 'AUDIT_REJECT'?'close':'hourglass')
  179. this.statusMessage = this.state == 'WAIT_OUT_WAREHOUSE' ? '请耐心等待汽配经销商进行配送' : ''
  180. // 获取明细
  181. this.getDetailList()
  182. // 更改标题栏背景色
  183. uni.setNavigationBarColor({
  184. frontColor: '#ffffff',
  185. backgroundColor: this.state!= 'error'&&this.state!= 'AUDIT_REJECT'&&this.state!= 'CANCEL' ? '#066cff':'#f34503',
  186. })
  187. }
  188. },
  189. onUnload() {
  190. this.$store.state.vuex_tempOrderData = null
  191. },
  192. computed: {
  193. totalPages(){
  194. return Math.ceil(this.total / this.pageSize)
  195. },
  196. // 付款信息
  197. payInfo(){
  198. return this.$store.state.vuex_tempOrderData
  199. }
  200. },
  201. methods: {
  202. getRow(pageNo){
  203. this.pageNo = pageNo
  204. this.getDetailList()
  205. },
  206. getDetailList(){
  207. uni.showLoading({
  208. title: '加载中'
  209. })
  210. purchaseQueryDetailPage({purchaseSn: this.purchaseSn,pageNo:this.pageNo,pageSize:this.pageSize}).then(res => {
  211. if(res.status == 200){
  212. this.partList = res.data ? res.data.list : []
  213. // 是否有赠品
  214. const giftList = this.partList.filter(item => item.promoProductType == 'GIFT_PRODUCT')
  215. // 正品
  216. this.partList = this.partList.filter(item => item.promoProductType !== 'GIFT_PRODUCT')
  217. this.partList.map(item=>{
  218. // 关联赠品
  219. item.giftObj = giftList.find(gift => gift.purchaseDetailParentSn == item.purchaseDetailSn)
  220. item.priceStr = Number(item.price).toFixed(2).toString().split('.')
  221. })
  222. this.total = res.data ? res.data.count : 0
  223. }
  224. // 滚动到顶部
  225. this.$nextTick(()=>{
  226. uni.pageScrollTo({
  227. scrollTop: 0,
  228. duration: 300
  229. });
  230. uni.hideLoading()
  231. })
  232. })
  233. },
  234. message(title){
  235. uni.showToast({
  236. icon:'none',
  237. title: title
  238. })
  239. },
  240. // 取消订单
  241. cancelOrder(item){
  242. let _this = this
  243. uni.showModal({
  244. title: '提示',
  245. content: '确定取消订单吗?',
  246. success: function (res) {
  247. if (res.confirm) {
  248. purchaseCancel({purchaseSn:_this.purchaseSn}).then(res => {
  249. if (res.status == 200) {
  250. _this.message('取消成功')
  251. uni.$emit('refreshPurcaOrder')
  252. uni.navigateBack()
  253. } else {
  254. _this.message(res.message)
  255. }
  256. })
  257. }
  258. }
  259. });
  260. },
  261. // 立即支付
  262. payOrder(item){
  263. this.showPopu = true
  264. },
  265. // 付款成功,isOk: false 取消支付或支付失败,true 支付完成
  266. payComplete(item,isOk){
  267. this.showPopu = false
  268. if(isOk){
  269. uni.$emit('refreshPurcaOrder')
  270. uni.navigateBack()
  271. }
  272. },
  273. // 再次购买
  274. buyAgain(item){
  275. },
  276. // 确认收货
  277. receiveOrder(item){
  278. let _this = this
  279. uni.showModal({
  280. title: '提示',
  281. content: '确定收货吗?',
  282. success: function (res) {
  283. if (res.confirm) {
  284. purchaseReceive({purchaseSn:_this.purchaseSn}).then(res => {
  285. if (res.status == 200) {
  286. _this.message('收货成功')
  287. uni.$emit('refreshPurcaOrder')
  288. uni.navigateBack()
  289. } else {
  290. _this.message(res.message)
  291. }
  292. })
  293. }
  294. }
  295. });
  296. },
  297. }
  298. }
  299. </script>
  300. <style lang="less">
  301. page{
  302. height: 100%;
  303. }
  304. .orderDetail-digitalShel{
  305. height: 100%;
  306. .redText{
  307. color: #FB1E1E;
  308. margin: 0 10rpx;
  309. }
  310. .cText{
  311. color: #666;
  312. margin: 0 6rpx;
  313. font-size: 14px;
  314. }
  315. .gray-text{
  316. text{
  317. font-size: 14px;
  318. color: #999;
  319. }
  320. }
  321. .order-body{
  322. flex-grow: 1;
  323. overflow: auto;
  324. .partList{
  325. margin-top: 20rpx;
  326. }
  327. }
  328. .contHead {
  329. .statusH{
  330. > view{
  331. padding: 10upx 12%;
  332. font-size: 34upx;
  333. }
  334. .status-row{
  335. font-size: 42upx;
  336. text{
  337. margin-left: 10rpx;
  338. }
  339. }
  340. .messageText{
  341. font-size: 28upx;
  342. text-align: center;
  343. text{
  344. color: #f3e781;
  345. }
  346. padding: 20rpx 0;
  347. }
  348. }
  349. }
  350. .price-txt{
  351. color: red;
  352. display: flex;
  353. align-items: baseline;
  354. font-size: 12px;
  355. text{
  356. font-size: 32rpx;
  357. }
  358. }
  359. .info{
  360. background-color: #FFFFFF;
  361. padding: 10rpx 30upx;
  362. font-size: 32rpx;
  363. margin-bottom: 20rpx;
  364. .infoList{
  365. display: flex;
  366. justify-content: space-between;
  367. align-items: center;
  368. padding: 20rpx 0;
  369. border-bottom: 2rpx solid #f2f2f2;
  370. &:last-child{
  371. border: none;
  372. }
  373. .title{
  374. font-weight: bold;
  375. > text{
  376. color: #ff9808;
  377. font-size: 24upx;
  378. }
  379. }
  380. > text{
  381. &:first-child{
  382. color: #666E75;
  383. }
  384. }
  385. }
  386. .item-list-box{
  387. border-bottom: 2rpx solid #f2f2f2;
  388. }
  389. .item-list{
  390. padding: 20rpx 0;
  391. &:last-child{
  392. border: none;
  393. }
  394. > view{
  395. &:first-child{
  396. margin-right: 20rpx;
  397. position: relative;
  398. overflow: hidden;
  399. width: 160rpx;
  400. height: 160rpx;
  401. border-radius: 6px;
  402. border: 1px solid #eee;
  403. }
  404. &:last-child{
  405. flex-grow: 1;
  406. width: 60%;
  407. }
  408. }
  409. .item-name{
  410. word-wrap: break-word;
  411. font-size: 28rpx;
  412. color: #333;
  413. font-weight: bold;
  414. }
  415. .item-nums{
  416. text{
  417. font-size: 28rpx;
  418. color: #666;
  419. }
  420. }
  421. .item-head{
  422. display: flex;
  423. align-items: center;
  424. justify-content: space-between;
  425. color: #666;
  426. margin-top: 5px;
  427. > view:last-child{
  428. font-size: 24rpx;
  429. text{
  430. margin: 0 10rpx;
  431. font-size: 28rpx;
  432. }
  433. }
  434. }
  435. .rebate-tag{
  436. background: #ffe7df;
  437. color: #E91E63;
  438. padding: 2px 5px;
  439. font-size: 10px;
  440. border-radius: 3px;
  441. margin-left: 6px;
  442. }
  443. .tejia-tag{
  444. color: #E91E63;
  445. margin-left: 6px;
  446. font-size: 12px;
  447. text{
  448. font-size: 12px;
  449. color: #999;
  450. margin-left: 5px;
  451. text-decoration: line-through;
  452. }
  453. }
  454. }
  455. }
  456. .gift-box.item-list{
  457. .item-name{
  458. color: #666;
  459. font-size: 12px;
  460. font-weight: normal;
  461. }
  462. .item-nums{
  463. text{
  464. color: #666;
  465. font-size: 12px;
  466. }
  467. }
  468. .rebate-tag{
  469. margin-left: 0;
  470. margin-right: 5px;
  471. }
  472. .ellipsis-one{
  473. flex-grow: 1;
  474. width:80%;
  475. }
  476. }
  477. .footer{
  478. padding: 20upx 20upx 0;
  479. background: #FFFFFF;
  480. }
  481. }
  482. </style>