自主产品,供应链食堂系统。将两个端拆开了。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

519 lines
14 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <template>
  2. <view>
  3. <block v-if="$isRight(order)">
  4. <view class="head">
  5. <view class="lf-row-between list">
  6. <image :src="order.supplier.logo" class="image"></image>
  7. <view class="info">
  8. <view class="lf-font-32 lf-color-black lf-font-bold">{{ order.supplier.supplier_name }}</view>
  9. <view class="lf-font-24 lf-color-555">{{ order.supplier.address }}</view>
  10. <view class="lf-font-24 lf-color-555" @click="call(order.supplier.ctl_phone)">{{order.supplier.ctl_man}} {{ order.supplier.ctl_phone }}</view>
  11. </view>
  12. </view>
  13. </view>
  14. <self-line></self-line>
  15. <view class="lf-bg-white">
  16. <lf-stepbar :list="order.state_log" themeColor="#11D189" v-if="order.state_log"></lf-stepbar>
  17. </view>
  18. <self-line></self-line>
  19. <view class="head">
  20. <view class="lf-row-between list" v-if="order.car_license">
  21. <view>车辆</view>
  22. <view class="lf-font-bold">{{order.car_license}}</view>
  23. </view>
  24. <view class="lf-row-between list" v-if="order.deliver_man">
  25. <view>司机</view>
  26. <view class="lf-font-bold">{{order.deliver_man}}</view>
  27. </view>
  28. <view class="lf-row-between list" @click="call(order.deliver_phone)" v-if="order.deliver_phone">
  29. <view>联系电话</view>
  30. <view class="lf-font-bold" style="color: rgb(17, 209, 137);">{{order.deliver_phone}}</view>
  31. </view>
  32. <view class="lf-row-between list">
  33. <view>采购单</view>
  34. <view class="lf-font-bold">{{ order.p_sn }}</view>
  35. </view>
  36. <view class="lf-row-between list">
  37. <view>批次号</view>
  38. <view class="lf-font-bold">{{ order.batch_sn }}</view>
  39. </view>
  40. <view class="lf-row-between list">
  41. <view>预计收货时间</view>
  42. <view class="lf-font-bold">{{order.deadline_text}}</view>
  43. </view>
  44. <view class="list" v-if="supplier_voucher.length">
  45. <view>证明材料-供应端</view>
  46. <view class="lf-flex-wrap lf-m-t-10">
  47. <image :src="item" @click="lookImage(index, 'supplier_voucher')" class="ms-img" v-for="(item, index) in supplier_voucher" :key="index"></image>
  48. </view>
  49. </view>
  50. <view class="list" v-if="canteen_voucher.length">
  51. <view>证明材料-食堂端</view>
  52. <view class="lf-flex-wrap lf-m-t-10">
  53. <image :src="item" @click="lookImage(index, 'canteen_voucher')" class="ms-img" v-for="(item, index) in canteen_voucher" :key="index"></image>
  54. </view>
  55. </view>
  56. </view>
  57. <self-line></self-line>
  58. <view class="lf-m-t-30 lf-m-l-32 lf-m-r-32">
  59. <view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">物资明细</view>
  60. <wyb-table :first-line-fixed="true" contentBgColor="#ecfaf5" :headers="headers" :contents="contents" width="max-content" height="80vh"></wyb-table>
  61. </view>
  62. <view style="height: 140rpx;"></view>
  63. <!-- 操作按钮 -->
  64. <view class="fixed-bottom" v-if="type && type != '备货中'">
  65. <view v-if="type == '待发单'" class="lf-row-flex-end">
  66. <button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=1')">编辑</button>
  67. <button class="btn btn2" @click="orderStateChange('待接单')">立即发单</button>
  68. </view>
  69. <view v-else-if="type == '待接单'" class="lf-row-flex-end">
  70. <button class="btn btn2" style="background-color: #FF0000;" @click="orderStateChange('已撤销')">撤销订单</button>
  71. </view>
  72. <view v-else-if="type == '已发货'" class="lf-row-flex-end">
  73. <button class="btn btn1" @click="orderStateChange('已退单')">退单</button>
  74. <button class="btn btn1 lf-m-l-20" @click="is_show_voucher = true">上传凭证</button>
  75. <button class="btn btn2" @click="$url('/pages/purchase/receipt?p_sn='+ order.p_sn)">确认收货</button>
  76. </view>
  77. <view v-else-if="type == '已收货' || type == '已入库'" class="lf-row-between">
  78. <button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=2')">复用采购单</button>
  79. <view class="lf-font-32" style="color: #11D189;">{{order.state}}</view>
  80. </view>
  81. <view v-else-if="type == '已撤销'" class="lf-row-between">
  82. <button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=2')">复用采购单</button>
  83. <view class="lf-font-32" style="color: #ff0000;">{{ type }}</view>
  84. </view>
  85. <view v-else class="lf-row-flex-end">
  86. <view class="lf-font-32">{{ type }}</view>
  87. </view>
  88. </view>
  89. <!-- 弹出层-上传凭证 -->
  90. <u-popup v-model="is_show_voucher" mode="center" border-radius="20">
  91. <view class="popup-box">
  92. <view class="content">
  93. <view class="popup-title">上传凭证信息</view>
  94. <view class="popup-desc">请在此处上传检验检疫凭证售卖资质等证书</view>
  95. <view class="popup-images">
  96. <view class="popup-image-item" v-for="(item, index) in voucher_list" :key="index" @click="lookImage(index, 'voucher_list')">
  97. <image :src="item" mode="aspectFill"></image>
  98. <view class="remove-image" @click.stop="removeInage(index)">
  99. <u-icon name="close-circle"></u-icon>
  100. </view>
  101. </view>
  102. <view class="popup-image-item popup-image-item-after" @click="uploadImage" v-if="voucher_list.length < 6"></view>
  103. </view>
  104. </view>
  105. <view class="foot-btn">
  106. <u-button class="popup-btn" @click="is_show_voucher = false">取消</u-button>
  107. <u-button class="popup-btn" @click="submitImage">确定</u-button>
  108. </view>
  109. </view>
  110. </u-popup>
  111. </block>
  112. </view>
  113. </template>
  114. <script>
  115. import { uploadFile } from '@/common/uploadFile.js'
  116. import wybTable from '@/components/wyb-table/wyb-table';
  117. export default {
  118. components: { wybTable },
  119. data(){
  120. return {
  121. headers: [{
  122. key: 'name',
  123. label: '物资名称'
  124. },{
  125. key: 'spec',
  126. label: '规格'
  127. },{
  128. label: '单位',
  129. key: 'unit'
  130. },{
  131. label: '分类',
  132. key: 'category'
  133. },{
  134. key: 'brand',
  135. label: '品牌'
  136. },{
  137. key: 'quality_level',
  138. label: '品级'
  139. },{
  140. label: '编号',
  141. key: 'm_sn'
  142. },{
  143. label: '供应商',
  144. key: 'supplier_name'
  145. },{
  146. key: 'pre_tax_price',
  147. label: '含税价'
  148. },{
  149. key: 'total_tax_amount',
  150. label: '含税价合计'
  151. },{
  152. key: 'after_tax_price',
  153. label: '不含税价'
  154. },{
  155. key: 'total_non_tax_amount',
  156. label: '不含税合计'
  157. },{
  158. key: 'purchase_limit',
  159. label: '起购数'
  160. },{
  161. key: 'purchase_number',
  162. label: '采购数量'
  163. }],
  164. contents: [],
  165. order: {},
  166. p_sn: '',
  167. type: '',
  168. is_show_voucher: false,
  169. voucher_list: [],
  170. voucher_count: 6,
  171. show_count: 0,
  172. canteen_voucher: [], // 食堂端凭证
  173. supplier_voucher: [] // 供应端凭证
  174. }
  175. },
  176. onLoad(options){
  177. this.p_sn = options.p_sn || '';
  178. this.getData();
  179. },
  180. onShow(){
  181. this.show_count++;
  182. if(this.show_count > 1){
  183. this.getData();
  184. }
  185. },
  186. methods: {
  187. call(phone) {
  188. uni.makePhoneCall({
  189. phoneNumber: phone //仅为示例
  190. });
  191. },
  192. // 移除图片
  193. removeInage(current){
  194. this.voucher_list.splice(current, 1);
  195. },
  196. // 上传凭证图片
  197. uploadImage(){
  198. let current_count = this.voucher_count - this.voucher_list.length;
  199. if(current_count == 0) return;
  200. uni.chooseImage({
  201. count: current_count,
  202. complete: result => {
  203. this.voucher_list.push(...result.tempFilePaths);
  204. console.log(this.voucher_list)
  205. }
  206. })
  207. },
  208. // 用户点击确定,将图片上传至oss,并将url发送给后端
  209. submitImage(){
  210. let that = this;
  211. let voucher_list = that.voucher_list;
  212. if(voucher_list.length <= 0){
  213. return that.$msg('您未上传图片哦');
  214. };
  215. that.is_show_voucher = false;
  216. uni.showLoading({
  217. title: '正在上传中...'
  218. })
  219. let http_list = [];
  220. voucher_list.map(item => {
  221. let itemP = new Promise((resolve, reject) => {
  222. uploadFile(item, (res) => {
  223. resolve(res);
  224. }, (err) => {
  225. reject(err);
  226. }, this);
  227. })
  228. http_list.push(itemP);
  229. })
  230. Promise.all(http_list).then(res => {
  231. let images = res.map(item => item.path);
  232. that.$http(that.API.API_SUPPLIER_PURCHASEUPLOADVOUCHER, {
  233. p_sn: that.p_sn,
  234. images: images,
  235. }).then(result => {
  236. uni.hideLoading();
  237. that.voucher_list = [];
  238. that.$msg('凭证已上传成功!')
  239. that.getData();
  240. }).catch(err => uni.hideLoading());
  241. }).catch(err => {
  242. console.log(err)
  243. uni.hideLoading();
  244. uni.showModal({
  245. title: '',
  246. content: JSON.stringify(err),
  247. showCancel: false,
  248. confirmColor: '#1833F2'
  249. })
  250. })
  251. },
  252. getData(){
  253. this.$http(this.API.API_CANTEEN_PURCHASEDETAIL, {
  254. p_sn: this.p_sn
  255. }).then(res => {
  256. let order = res.data.order;
  257. order.state_log.forEach((item, index) => {
  258. item.isFinished = false;
  259. if(index == order.state_log.length - 1){
  260. let actionState = [
  261. '订单已完成',
  262. '订单已退款',
  263. '订单已撤销',
  264. '订单已确认,物资入库'
  265. ];
  266. if(actionState.includes(item.action)){
  267. item.isFinished = true;
  268. }
  269. }
  270. })
  271. let supplier_voucher = [];
  272. let canteen_voucher = [];
  273. order.voucher.map(item => {
  274. if(item.client_type == '供应商'){
  275. supplier_voucher.push(item.voucher_pic);
  276. }else if(item.client_type == '食堂'){
  277. canteen_voucher.push(item.voucher_pic);
  278. }
  279. })
  280. this.supplier_voucher = supplier_voucher;
  281. this.canteen_voucher = canteen_voucher;
  282. this.order = order;
  283. let list = order.items || [];
  284. let contents = list.map(item => {
  285. return {
  286. name: item.material.m_name,
  287. spec: item.spec.name,
  288. brand: item.material.brand,
  289. quality_level: item.material.quality_level,
  290. m_sn: item.material.m_sn,
  291. supplier_name: order.supplier.supplier_name,
  292. pre_tax_price: item.tax_price,
  293. after_tax_price: item.non_tax_price,
  294. purchase_limit: item.p_order_item.purchase_limit,
  295. purchase_number: item.purchase_number,
  296. unit: item?.material?.unit?.unit_name || '',
  297. category: item?.material?.category?.m_cate_name || '',
  298. total_tax_amount: item.total_tax_amount,
  299. total_non_tax_amount: item.total_non_tax_amount
  300. }
  301. })
  302. this.contents = contents;
  303. this.type = order.state;
  304. }).catch(err => this.$toBack());
  305. },
  306. // 预览图片
  307. lookImage(index, list){
  308. if(this[list].length <= 0) return;
  309. this.$u.throttle(() => {
  310. uni.previewImage({
  311. urls: this[list],
  312. current: index
  313. })
  314. }, 500);
  315. },
  316. // 改变订单状态
  317. orderStateChange(state){
  318. let that = this;
  319. if(state == '已退单'){
  320. uni.showModal({
  321. title: '温馨提示',
  322. content: '退单前请与供应商协商,以免造成损失!确定继续退单操作吗?',
  323. confirmColor: '#FF0000',
  324. cancelColor: '#11D189',
  325. success: result => {
  326. if(result.confirm){
  327. $change();
  328. }
  329. }
  330. })
  331. }else{
  332. $change();
  333. }
  334. function $change(){
  335. that.$http(that.API.API_CANTEEN_PURCHASEUPDATE, {
  336. p_sn: that.p_sn,
  337. state: state
  338. }).then(res => {
  339. that.$msg('操作成功').then(()=> that.getData());
  340. })
  341. }
  342. }
  343. }
  344. }
  345. </script>
  346. <style lang="scss" scoped="scoped">
  347. .head{
  348. padding: 0 32rpx;
  349. width: 750rpx;
  350. box-sizing: border-box;
  351. height: auto;
  352. .list{
  353. padding: 30rpx 0;
  354. // border-bottom: 1rpx solid #e5e5e5;
  355. font-size: 28rpx;
  356. color: #555555;
  357. &:last-child{
  358. border-bottom: none;
  359. }
  360. .image{
  361. width: 140rpx;
  362. height: 140rpx;
  363. border-radius: 10rpx;
  364. background-color: #EEEEEE;
  365. }
  366. .info{
  367. display: flex;
  368. flex-direction: column;
  369. justify-content: space-around;
  370. width: 530rpx;
  371. height: 140rpx;
  372. }
  373. }
  374. }
  375. .fixed-bottom{
  376. position: fixed;
  377. bottom: 0rpx;
  378. left: 0rpx;
  379. z-index: 99;
  380. width: 750rpx;
  381. height: 98rpx;
  382. display: flex;
  383. // justify-content: flex-end;
  384. align-items: center;
  385. border-top: 1rpx solid #E5E5E5;
  386. background-color: #FFFFFF;
  387. box-sizing: border-box;
  388. padding: 0 32rpx;
  389. .btn{
  390. width: 212rpx;
  391. height: 82rpx;
  392. border-radius: 41rpx;
  393. margin: 0;
  394. padding: 0;
  395. font-size: 32rpx;
  396. display: flex;
  397. justify-content: center;
  398. align-items: center;
  399. }
  400. .btn1{
  401. border: 2rpx solid #555555;
  402. opacity: .5;
  403. }
  404. .btn2{
  405. background: #11D189;
  406. color: #FFFFFF;
  407. margin-left: 20rpx;
  408. }
  409. }
  410. .fixed-bottom>view{
  411. width: 100%;
  412. }
  413. .ms-img{
  414. width: 160rpx;
  415. height: 160rpx;
  416. margin-right: 15rpx;
  417. margin-top: 15rpx;
  418. background-color: #EEEEEE;
  419. &:nth-of-type(4n){
  420. margin-right: 0rpx;
  421. }
  422. }
  423. .popup-box{
  424. width: 686rpx;
  425. height: max-content;
  426. display: flex;
  427. justify-content: space-between;
  428. flex-direction: column;
  429. .content{
  430. .popup-title{
  431. font-size: 32rpx;
  432. font-weight: bold;
  433. color: #222222;
  434. text-align: center;
  435. margin-top: 40rpx;
  436. }
  437. .popup-desc{
  438. font-size: 28rpx;
  439. color: #555555;
  440. text-align: center;
  441. margin-top: 20rpx;
  442. margin-bottom: 18rpx;
  443. }
  444. .popup-images{
  445. display: flex;
  446. flex-wrap: wrap;
  447. padding: 22rpx;
  448. margin-bottom: 18rpx;
  449. .popup-image-item{
  450. width: 198rpx;
  451. height: 198rpx;
  452. margin: 8rpx;
  453. background: #F5F5F5;
  454. border-radius: 10rpx;
  455. position: relative;
  456. image{
  457. width: 100%;
  458. height: 100%;
  459. }
  460. .remove-image{
  461. position: absolute;
  462. right: -8rpx;
  463. top: -16rpx;
  464. color: #e74c3c;
  465. font-size: 40rpx;
  466. padding: 8rpx;
  467. }
  468. }
  469. .popup-image-item-after::after{
  470. content: '+';
  471. position: absolute;
  472. left: 30%;
  473. top: 14%;
  474. font-size: 100rpx;
  475. color: #777777;
  476. }
  477. }
  478. .popup-input{
  479. padding: 0 60rpx;
  480. box-sizing: border-box;
  481. height: 90rpx;
  482. font-size: 28rpx;
  483. color: #555555;
  484. input{
  485. text-align: right;
  486. }
  487. }
  488. }
  489. .foot-btn{
  490. height: 90rpx;
  491. width: 100%;
  492. border-top: 1rpx solid #E5E5E5;
  493. display: flex;
  494. box-sizing: border-box;
  495. .popup-btn{
  496. width: 50%;
  497. height: 100%;
  498. border: none;
  499. border-radius: initial;
  500. &:last-child{
  501. border-left: 1rpx solid #E5E5E5;
  502. color: #1833F2;
  503. }
  504. }
  505. }
  506. }
  507. // 去掉u-button 外边框线
  508. /deep/.u-hairline-border::after{
  509. border: none;
  510. }
  511. </style>