自主产品,供应链食堂系统。将两个端拆开了。
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

  1. <template>
  2. <view>
  3. <view class="head">
  4. <view class="lf-row-between lf-color-gray list">
  5. <view>采购单 {{ order.p_sn }}</view>
  6. </view>
  7. <view class="lf-row-between list" v-if="order.canteen">
  8. <image :src="order.canteen.logo" class="image"></image>
  9. <view class="info">
  10. <view class="lf-font-32 lf-color-black lf-font-bold">{{ order.canteen.canteen_name }}</view>
  11. <view class="lf-font-24 lf-color-555">{{ order.canteen.address }}</view>
  12. </view>
  13. </view>
  14. <view class="lf-row-between lf-color-gray list">
  15. <view>食堂联系电话 <text style="color:#1833F2" @click="call(order.canteen.ctl_phone)" class="lf-m-l-10">{{ order.canteen.ctl_phone }}</text></view>
  16. </view>
  17. <view class="lf-row-between lf-color-gray list">
  18. <view>采购人 {{ order.contact_name }}</view>
  19. </view>
  20. <view class="lf-row-between lf-color-gray list">
  21. <view>采购人联系电话 <text style="color:#1833F2" @click="call(order.contact_phone)" class="lf-m-l-10">{{ order.contact_phone }}</text></view>
  22. </view>
  23. </view>
  24. <self-line></self-line>
  25. <view class="lf-border-box lf-bg-white">
  26. <lf-stepbar :list="stepList"></lf-stepbar>
  27. </view>
  28. <self-line v-if="order.car_license || supplier_voucher.length || canteen_voucher.length"></self-line>
  29. <view class="head">
  30. <block v-if="order.car_license">
  31. <view class="lf-row-between list">
  32. <view>车辆</view>
  33. <view class="lf-font-bold">{{order.car_license}}</view>
  34. </view>
  35. <view class="lf-row-between list">
  36. <view>司机</view>
  37. <view class="lf-font-bold">{{order.deliver_man}}</view>
  38. </view>
  39. <view class="lf-row-between list">
  40. <view>联系电话</view>
  41. <view class="lf-font-bold">{{order.deliver_phone}}</view>
  42. </view>
  43. </block>
  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" class="ms-img" @click="lookImage(index, 'supplier_voucher')" 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" class="ms-img" @click="lookImage(index, 'canteen_voucher')" 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">
  59. <view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">物资明细</view>
  60. <wyb-table v-if="contents.length" :first-line-fixed="true" contentBgColor="#eef6fe" :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">
  65. <view v-if="type == '待接单'" class="lf-row-flex-end">
  66. <button class="btn btn2" style="background-color: #1833F2;" @click="orderTaking">立即接单</button>
  67. </view>
  68. <view v-else-if="type == '备货中'" class="lf-row-flex-end">
  69. <button class="btn btn1" @click="is_show_voucher = true">上传凭证</button>
  70. <button class="btn btn2" @click="is_show_receiving = true">确认发货</button>
  71. </view>
  72. <view v-else-if="type == '已发货'" class="lf-row-between">
  73. <button class="btn btn1" @click="is_show_voucher = true">上传凭证</button>
  74. <view class="lf-font-32" style="color: #11D189;">{{ type }}</view>
  75. </view>
  76. <view v-else class="lf-row-flex-end">
  77. <view class="lf-font-32">{{ type }}</view>
  78. </view>
  79. </view>
  80. <!-- 弹出层-上传凭证 -->
  81. <u-popup v-model="is_show_voucher" mode="center" border-radius="20">
  82. <view class="popup-box">
  83. <view class="content">
  84. <view class="popup-title">上传凭证信息</view>
  85. <view class="popup-desc">请在此处上传检验检疫凭证售卖资质等证书</view>
  86. <view class="popup-images">
  87. <view class="popup-image-item" v-for="(item, index) in voucher_list" :key="index" @click="lookImage(index, 'voucher_list')">
  88. <image :src="item" mode="aspectFill"></image>
  89. <view class="remove-image" @click.stop="removeInage(index)">
  90. <u-icon name="close-circle"></u-icon>
  91. </view>
  92. </view>
  93. <view class="popup-image-item popup-image-item-after" @click="uploadImage" v-if="voucher_list.length < 6"></view>
  94. </view>
  95. </view>
  96. <view class="foot-btn">
  97. <u-button class="popup-btn" @click="is_show_voucher = false">取消</u-button>
  98. <u-button class="popup-btn" @click="submitImage">确定</u-button>
  99. </view>
  100. </view>
  101. </u-popup>
  102. <!-- 弹出层-确认收货 -->
  103. <u-popup v-model="is_show_receiving" mode="center" border-radius="20">
  104. <view class="popup-box">
  105. <view class="content">
  106. <view class="popup-title">发货提醒</view>
  107. <view class="popup-desc">请填写车辆信息司机信息</view>
  108. <view class="lf-row-between popup-input">
  109. <view>车牌号</view>
  110. <input placeholder="请输入车牌号" v-model="l_p_num" />
  111. </view>
  112. <view class="lf-row-between popup-input">
  113. <view>司机姓名</view>
  114. <input placeholder="请输入司机姓名" v-model="driver_name" />
  115. </view>
  116. <view class="lf-row-between popup-input lf-m-b-30">
  117. <view>司机电话</view>
  118. <input placeholder="请输入司机电话" maxlength="11" v-model="driver_phone" />
  119. </view>
  120. </view>
  121. <view class="foot-btn">
  122. <u-button class="popup-btn" @click="is_show_receiving = false">取消</u-button>
  123. <u-button class="popup-btn" @click="confirmDeliver">确定</u-button>
  124. </view>
  125. </view>
  126. </u-popup>
  127. </view>
  128. </template>
  129. <script>
  130. import { uploadFile } from '@/common/uploadFile.js'
  131. import wybTable from '@/components/wyb-table/wyb-table';
  132. export default {
  133. components: { wybTable },
  134. data(){
  135. return {
  136. stepList: [],
  137. headers: [{
  138. key: 'm_name',
  139. label: '物资名称'
  140. },{
  141. key: 'spec',
  142. label: '规格'
  143. },{
  144. key: 'brand',
  145. label: '品牌'
  146. },{
  147. key: 'quality_level',
  148. label: '品级'
  149. },{
  150. label: '编号',
  151. key: 'm_sn'
  152. },{
  153. key: 'tax_price',
  154. label: '含税价'
  155. },{
  156. key: 'non_tax_price',
  157. label: '不含税价'
  158. },{
  159. key: 'purchase_limit',
  160. label: '起购数'
  161. },{
  162. key: 'purchase_number',
  163. label: '采购数量'
  164. }],
  165. contents: [],
  166. is_show_voucher: false, // 是否显示凭证上传弹出层
  167. is_show_receiving: false,
  168. voucher_list: [], // 已上传的凭证列表
  169. voucher_count: 6, // 最多可以上传多少张凭证
  170. type: '', // 订单状态
  171. p_sn: '',
  172. order: {},
  173. l_p_num: '',
  174. driver_name: '',
  175. driver_phone: '',
  176. canteen_voucher: [], // 食堂端凭证
  177. supplier_voucher: [] // 供应端凭证
  178. }
  179. },
  180. onLoad(options){
  181. this.p_sn = options.p_sn;
  182. this.getData();
  183. },
  184. methods: {
  185. call(phone) {
  186. uni.makePhoneCall({
  187. phoneNumber: phone //仅为示例
  188. });
  189. },
  190. getData(){
  191. this.$http(this.API.API_SUPPLIER_PURCHASEDETAIL, {
  192. p_sn: this.p_sn
  193. }).then(res => {
  194. console.log("getData", res);
  195. let order = res.data.order || {};
  196. this.type = order.state;
  197. this.order = order;
  198. this.stepList = order.state_log.map((item, index) => {
  199. item.isFinished = false;
  200. if(index == order.state_log.length - 1){
  201. let actionState = [
  202. '订单已完成',
  203. '订单已退款',
  204. '订单已撤销'
  205. ]
  206. if(actionState.includes(item.action)){
  207. item.isFinished = true;
  208. }
  209. }
  210. return item;
  211. })
  212. let supplier_voucher = [];
  213. let canteen_voucher = [];
  214. order.voucher.map(item => {
  215. if(item.client_type == '供应商'){
  216. supplier_voucher.push(item.voucher_pic);
  217. }else if(item.client_type == '食堂'){
  218. canteen_voucher.push(item.voucher_pic);
  219. }
  220. })
  221. this.supplier_voucher = supplier_voucher;
  222. this.canteen_voucher = canteen_voucher;
  223. let list = order.items || [];
  224. let contents = list.map(item => {
  225. let obj = {
  226. m_name: item.material?.m_name || '',
  227. material_id: item.material?.id,
  228. spec: item.spec?.name || '',
  229. spec_id: item.spec?.id,
  230. brand: item?.material?.brand || '',
  231. quality_level: item?.material?.quality_level || '',
  232. m_sn: item?.material?.m_sn || '',
  233. tax_price: item.tax_price,
  234. non_tax_price: item.non_tax_price,
  235. purchase_limit: item?.p_order_item?.purchase_limit || '',
  236. purchase_number: item.purchase_number
  237. }
  238. return obj;
  239. });
  240. this.contents = contents;
  241. });
  242. },
  243. // 上传凭证图片
  244. uploadImage(){
  245. let current_count = this.voucher_count - this.voucher_list.length;
  246. if(current_count == 0) return;
  247. uni.chooseImage({
  248. count: current_count,
  249. complete: result => {
  250. this.voucher_list.push(...result.tempFilePaths);
  251. }
  252. })
  253. },
  254. // 预览图片
  255. lookImage(current, list){
  256. if(this[list].length <= 0) return;
  257. this.$u.throttle(() => {
  258. uni.previewImage({
  259. urls: this[list],
  260. current: current
  261. })
  262. }, 500);
  263. },
  264. // 移除图片
  265. removeInage(current){
  266. this.voucher_list.splice(current, 1);
  267. },
  268. // 用户点击确定,将图片上传至oss,并将url发送给后端
  269. submitImage(){
  270. let that = this;
  271. let voucher_list = that.voucher_list;
  272. if(voucher_list.length <= 0){
  273. return that.$msg('您未上传图片哦');
  274. };
  275. that.is_show_voucher = false;
  276. uni.showLoading({
  277. title: '正在上传中...'
  278. })
  279. let http_list = [];
  280. voucher_list.map(item => {
  281. let itemP = new Promise((resolve, reject) => {
  282. uploadFile(item, (res) => {
  283. resolve(res);
  284. }, (err) => {
  285. reject(err);
  286. }, this);
  287. })
  288. http_list.push(itemP);
  289. })
  290. Promise.all(http_list).then(res => {
  291. console.log("上传完毕", res);
  292. let images = res.map(item => item.path);
  293. that.$http(that.API.API_SUPPLIER_PURCHASESAVEVOUCHER, {
  294. p_sn: that.p_sn,
  295. images: images,
  296. }).then(result => {
  297. uni.hideLoading();
  298. that.voucher_list = [];
  299. that.$msg('凭证已上传成功!');
  300. that.getData();
  301. }).catch(err => uni.hideLoading());
  302. }).catch(err => {
  303. uni.hideLoading();
  304. uni.showModal({
  305. title: '',
  306. content: JSON.stringify(err),
  307. showCancel: false,
  308. confirmColor: '#1833F2'
  309. })
  310. })
  311. },
  312. // 立即接单
  313. orderTaking(){
  314. this.$http(this.API.API_SUPPLIER_PURCHASEORDERACCEPT, {
  315. p_sn: this.p_sn
  316. }).then(res => {
  317. this.$msg('接单成功');
  318. this.getData();
  319. });
  320. },
  321. // 确认发货
  322. confirmDeliver(){
  323. let l_p_num = this.l_p_num;
  324. let driver_name = this.driver_name;
  325. let driver_phone = this.driver_phone;
  326. if(!l_p_num){
  327. return this.$msg('请输入车牌号')
  328. }else if(!driver_name){
  329. return this.$msg('请输入司机姓名')
  330. }else if(!driver_phone){
  331. return this.$msg('请输入司机电话')
  332. }
  333. this.is_show_receiving = false;
  334. this.$http(this.API.API_SUPPLIER_PURCHASEORDERSENDOUT, {
  335. p_sn: this.p_sn,
  336. deliver_phone: driver_phone,
  337. deliver_man: driver_name,
  338. car_license: l_p_num
  339. }).then(res => {
  340. this.$msg('确认收货成功');
  341. this.getData();
  342. });
  343. }
  344. }
  345. }
  346. </script>
  347. <style lang="scss" scoped="scoped">
  348. .head{
  349. padding: 0 32rpx;
  350. width: 750rpx;
  351. box-sizing: border-box;
  352. height: auto;
  353. .list{
  354. padding: 30rpx 0;
  355. border-bottom: 1rpx solid #e5e5e5;
  356. font-size: 28rpx;
  357. color: #555555;
  358. &:last-child{
  359. border-bottom: none;
  360. }
  361. .image{
  362. width: 140rpx;
  363. height: 140rpx;
  364. border-radius: 10rpx;
  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: #1833F2;
  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: 727rpx;
  426. height: max-content;
  427. display: flex;
  428. justify-content: space-between;
  429. flex-direction: column;
  430. .content{
  431. .popup-title{
  432. font-size: 32rpx;
  433. font-weight: bold;
  434. color: #222222;
  435. text-align: center;
  436. margin-top: 40rpx;
  437. }
  438. .popup-desc{
  439. font-size: 28rpx;
  440. color: #555555;
  441. text-align: center;
  442. margin-top: 20rpx;
  443. margin-bottom: 18rpx;
  444. }
  445. .popup-images{
  446. display: flex;
  447. flex-wrap: wrap;
  448. padding: 22rpx;
  449. margin-bottom: 18rpx;
  450. .popup-image-item{
  451. width: 198rpx;
  452. height: 198rpx;
  453. margin: 8rpx;
  454. background: #F5F5F5;
  455. border-radius: 10rpx;
  456. position: relative;
  457. image{
  458. width: 100%;
  459. height: 100%;
  460. }
  461. .remove-image{
  462. position: absolute;
  463. right: -8rpx;
  464. top: -16rpx;
  465. color: #e74c3c;
  466. font-size: 40rpx;
  467. padding: 8rpx;
  468. }
  469. }
  470. .popup-image-item-after::after{
  471. content: '+';
  472. position: absolute;
  473. left: 30%;
  474. top: 14%;
  475. font-size: 100rpx;
  476. color: #777777;
  477. }
  478. }
  479. .popup-input{
  480. padding: 0 60rpx;
  481. box-sizing: border-box;
  482. height: 90rpx;
  483. font-size: 28rpx;
  484. color: #555555;
  485. input{
  486. text-align: right;
  487. }
  488. }
  489. }
  490. .foot-btn{
  491. height: 90rpx;
  492. width: 100%;
  493. border-top: 1rpx solid #E5E5E5;
  494. display: flex;
  495. box-sizing: border-box;
  496. .popup-btn{
  497. width: 50%;
  498. height: 100%;
  499. border: none;
  500. border-radius: initial;
  501. &:last-child{
  502. border-left: 1rpx solid #E5E5E5;
  503. color: #1833F2;
  504. }
  505. }
  506. }
  507. }
  508. // 去掉u-button 外边框线
  509. /deep/.u-hairline-border::after{
  510. border: none;
  511. }
  512. </style>