procureOrder.vue 12 KB

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