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

533 lines
14 KiB

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