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

545 lines
15 KiB

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