procureOrder.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  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.promoType=='BUY_PROD_GIVE_VALID'">
  44. 返<text>{{item.resultValue}}</text>元
  45. </view>
  46. <view class="flex align_center rebate-tag" v-if="item.promoType=='BUY_PROD_GIVE_PROD'">
  47. 买{{item.conditionValue}}赠{{item.resultValue}}
  48. </view>
  49. <view class="flex align_center tejia-tag" v-if="item.promoType=='PROMO_PROD'">
  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.giftQty">
  61. <view style="height: 120rpx;width: 120rpx;margin-left: 40rpx;">
  62. <u-image :src="item.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.product.productName}}</text>
  70. </view>
  71. <view class="item-nums ellipsis-one" v-if="item.product&&item.product.origCode">
  72. <text style="color: #666;">{{item.product.origCode}}</text>
  73. </view>
  74. <view class="item-nums ellipsis-one" v-if="item.product&&item.product.code">
  75. <text>{{item.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.giftQty}}</text>{{item.product&&item.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. this.partList.map(item=>{
  210. const a = item.shopPromoProduct
  211. if(a){
  212. item.promoType = a.promoType
  213. item.resultValue = a.resultValue
  214. item.conditionValue = a.conditionValue
  215. item.discountType = a.discountType
  216. item.promoProductSn = a.promoProductSn
  217. item.promoSn = a.promoSn
  218. // 满赠数量
  219. item.giftQty = item.promoType=='BUY_PROD_GIVE_PROD' ? Math.floor(item.qty / item.conditionValue)*item.resultValue : 0
  220. }
  221. item.priceStr = Number(item.price).toFixed(2).toString().split('.')
  222. delete item.shopPromoProduct
  223. })
  224. this.total = res.data ? res.data.count : 0
  225. }
  226. // 滚动到顶部
  227. this.$nextTick(()=>{
  228. uni.pageScrollTo({
  229. scrollTop: 0,
  230. duration: 300
  231. });
  232. uni.hideLoading()
  233. })
  234. })
  235. },
  236. message(title){
  237. uni.showToast({
  238. icon:'none',
  239. title: title
  240. })
  241. },
  242. // 取消订单
  243. cancelOrder(item){
  244. let _this = this
  245. uni.showModal({
  246. title: '提示',
  247. content: '确定取消订单吗?',
  248. success: function (res) {
  249. if (res.confirm) {
  250. purchaseCancel({purchaseSn:_this.purchaseSn}).then(res => {
  251. if (res.status == 200) {
  252. _this.message('取消成功')
  253. uni.$emit('refreshOrder')
  254. uni.navigateBack()
  255. } else {
  256. _this.message(res.message)
  257. }
  258. })
  259. }
  260. }
  261. });
  262. },
  263. // 确认收货
  264. receiveOrder(item){
  265. let _this = this
  266. uni.showModal({
  267. title: '提示',
  268. content: '确定收货吗?',
  269. success: function (res) {
  270. if (res.confirm) {
  271. purchaseReceive({purchaseSn:_this.purchaseSn}).then(res => {
  272. if (res.status == 200) {
  273. _this.message('收货成功')
  274. uni.$emit('refreshOrder')
  275. uni.navigateBack()
  276. } else {
  277. _this.message(res.message)
  278. }
  279. })
  280. }
  281. }
  282. });
  283. },
  284. }
  285. }
  286. </script>
  287. <style lang="less">
  288. page{
  289. height: 100%;
  290. }
  291. .orderDetail-digitalShel{
  292. height: 100%;
  293. .redText{
  294. color: #FB1E1E;
  295. margin: 0 10rpx;
  296. }
  297. .cText{
  298. color: #666;
  299. margin: 0 6rpx;
  300. font-size: 14px;
  301. }
  302. .gray-text{
  303. text{
  304. font-size: 14px;
  305. color: #999;
  306. }
  307. }
  308. .order-body{
  309. flex-grow: 1;
  310. overflow: auto;
  311. .partList{
  312. margin-top: 20rpx;
  313. }
  314. }
  315. .contHead {
  316. .statusH{
  317. > view{
  318. padding: 10upx 12%;
  319. font-size: 34upx;
  320. }
  321. .status-row{
  322. font-size: 42upx;
  323. text{
  324. margin-left: 10rpx;
  325. }
  326. }
  327. .messageText{
  328. font-size: 28upx;
  329. text-align: center;
  330. text{
  331. color: #f3e781;
  332. }
  333. padding: 20rpx 0;
  334. }
  335. }
  336. }
  337. .price-txt{
  338. color: red;
  339. display: flex;
  340. align-items: baseline;
  341. font-size: 12px;
  342. text{
  343. font-size: 32rpx;
  344. }
  345. }
  346. .info{
  347. background-color: #FFFFFF;
  348. padding: 10rpx 30upx;
  349. font-size: 32rpx;
  350. margin-bottom: 20rpx;
  351. .infoList{
  352. display: flex;
  353. justify-content: space-between;
  354. align-items: center;
  355. padding: 20rpx 0;
  356. border-bottom: 2rpx solid #f2f2f2;
  357. &:last-child{
  358. border: none;
  359. }
  360. .title{
  361. font-weight: bold;
  362. > text{
  363. color: #ff9808;
  364. font-size: 24upx;
  365. }
  366. }
  367. > text{
  368. &:first-child{
  369. color: #666E75;
  370. }
  371. }
  372. }
  373. .item-list-box{
  374. border-bottom: 2rpx solid #f2f2f2;
  375. }
  376. .item-list{
  377. padding: 20rpx 0;
  378. &:last-child{
  379. border: none;
  380. }
  381. > view{
  382. &:first-child{
  383. margin-right: 20rpx;
  384. position: relative;
  385. overflow: hidden;
  386. width: 160rpx;
  387. height: 160rpx;
  388. border-radius: 6px;
  389. border: 1px solid #eee;
  390. }
  391. &:last-child{
  392. flex-grow: 1;
  393. width: 60%;
  394. }
  395. }
  396. .item-name{
  397. word-wrap: break-word;
  398. font-size: 28rpx;
  399. color: #333;
  400. font-weight: bold;
  401. }
  402. .item-nums{
  403. text{
  404. font-size: 28rpx;
  405. color: #666;
  406. }
  407. }
  408. .item-head{
  409. display: flex;
  410. align-items: center;
  411. justify-content: space-between;
  412. color: #666;
  413. margin-top: 5px;
  414. > view:last-child{
  415. font-size: 24rpx;
  416. text{
  417. margin: 0 10rpx;
  418. font-size: 28rpx;
  419. }
  420. }
  421. }
  422. .rebate-tag{
  423. background: #ffe7df;
  424. color: #E91E63;
  425. padding: 2px 5px;
  426. font-size: 10px;
  427. border-radius: 3px;
  428. margin-left: 6px;
  429. }
  430. .tejia-tag{
  431. color: #E91E63;
  432. margin-left: 6px;
  433. font-size: 12px;
  434. text{
  435. font-size: 12px;
  436. color: #999;
  437. margin-left: 5px;
  438. text-decoration: line-through;
  439. }
  440. }
  441. }
  442. }
  443. .gift-box.item-list{
  444. .item-name{
  445. color: #666;
  446. font-size: 12px;
  447. font-weight: normal;
  448. }
  449. .item-nums{
  450. text{
  451. color: #666;
  452. font-size: 12px;
  453. }
  454. }
  455. .rebate-tag{
  456. width: 40px;
  457. margin-left: 0;
  458. margin-right: 5px;
  459. }
  460. }
  461. .footer{
  462. padding: 20upx 60upx;
  463. background: #FFFFFF;
  464. button{
  465. &:after{
  466. border: 0;
  467. }
  468. color: #585858;
  469. font-size: 32rpx;
  470. margin: 0 20rpx;
  471. }
  472. }
  473. }
  474. </style>