procureOrder.vue 12 KB

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