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

543 lines
15 KiB

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