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

534 lines
14 KiB

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. <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 lf-m-r-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. ]
  218. if(actionState.includes(item.action)){
  219. item.isFinished = true;
  220. }
  221. }
  222. return item;
  223. })
  224. let supplier_voucher = [];
  225. let canteen_voucher = [];
  226. order.voucher.map(item => {
  227. if(item.client_type == '供应商'){
  228. supplier_voucher.push(item.voucher_pic);
  229. }else if(item.client_type == '食堂'){
  230. canteen_voucher.push(item.voucher_pic);
  231. }
  232. })
  233. this.supplier_voucher = supplier_voucher;
  234. this.canteen_voucher = canteen_voucher;
  235. let list = order.items || [];
  236. let contents = list.map(item => {
  237. let obj = {
  238. m_name: item.material?.m_name || '',
  239. material_id: item.material?.id,
  240. spec: item.spec?.name || '',
  241. spec_id: item.spec?.id,
  242. brand: item?.material?.brand || '',
  243. quality_level: item?.material?.quality_level || '',
  244. m_sn: item?.material?.m_sn || '',
  245. tax_price: item.tax_price,
  246. non_tax_price: item.non_tax_price,
  247. purchase_limit: item?.p_order_item?.purchase_limit || '',
  248. purchase_number: item.purchase_number,
  249. unit: item?.material?.unit?.unit_name || '',
  250. category: item?.material?.category?.m_cate_name || ''
  251. }
  252. return obj;
  253. });
  254. this.contents = contents;
  255. });
  256. },
  257. // 上传凭证图片
  258. uploadImage(){
  259. let current_count = this.voucher_count - this.voucher_list.length;
  260. if(current_count == 0) return;
  261. uni.chooseImage({
  262. count: current_count,
  263. complete: result => {
  264. this.voucher_list.push(...result.tempFilePaths);
  265. }
  266. })
  267. },
  268. // 预览图片
  269. lookImage(current, list){
  270. if(this[list].length <= 0) return;
  271. this.$u.throttle(() => {
  272. uni.previewImage({
  273. urls: this[list],
  274. current: current
  275. })
  276. }, 500);
  277. },
  278. // 移除图片
  279. removeInage(current){
  280. this.voucher_list.splice(current, 1);
  281. },
  282. // 用户点击确定,将图片上传至oss,并将url发送给后端
  283. submitImage(){
  284. let that = this;
  285. let voucher_list = that.voucher_list;
  286. if(voucher_list.length <= 0){
  287. return that.$msg('您未上传图片哦');
  288. };
  289. that.is_show_voucher = false;
  290. uni.showLoading({
  291. title: '正在上传中...'
  292. })
  293. let http_list = [];
  294. voucher_list.map(item => {
  295. let itemP = new Promise((resolve, reject) => {
  296. uploadFile(item, (res) => {
  297. resolve(res);
  298. }, (err) => {
  299. reject(err);
  300. }, this);
  301. })
  302. http_list.push(itemP);
  303. })
  304. Promise.all(http_list).then(res => {
  305. console.log("上传完毕", res);
  306. let images = res.map(item => item.path);
  307. that.$http(that.API.API_SUPPLIER_PURCHASESAVEVOUCHER, {
  308. p_sn: that.p_sn,
  309. images: images,
  310. }).then(result => {
  311. uni.hideLoading();
  312. that.voucher_list = [];
  313. that.$msg('凭证已上传成功!');
  314. that.getData();
  315. }).catch(err => uni.hideLoading());
  316. }).catch(err => {
  317. uni.hideLoading();
  318. uni.showModal({
  319. title: '',
  320. content: JSON.stringify(err),
  321. showCancel: false,
  322. confirmColor: '#1833F2'
  323. })
  324. })
  325. },
  326. // 立即接单
  327. orderTaking(){
  328. this.$http(this.API.API_SUPPLIER_PURCHASEORDERACCEPT, {
  329. p_sn: this.p_sn
  330. }).then(res => {
  331. this.$msg('接单成功');
  332. this.getData();
  333. });
  334. },
  335. // 确认发货
  336. confirmDeliver(){
  337. let l_p_num = this.l_p_num;
  338. let driver_name = this.driver_name;
  339. let driver_phone = this.driver_phone;
  340. if(!l_p_num){
  341. return this.$msg('请输入车牌号')
  342. }else if(!driver_name){
  343. return this.$msg('请输入司机姓名')
  344. }else if(!driver_phone){
  345. return this.$msg('请输入司机电话')
  346. }
  347. this.is_show_receiving = false;
  348. this.$http(this.API.API_SUPPLIER_PURCHASEORDERSENDOUT, {
  349. p_sn: this.p_sn,
  350. deliver_phone: driver_phone,
  351. deliver_man: driver_name,
  352. car_license: l_p_num
  353. }).then(res => {
  354. this.$msg('确认收货成功');
  355. this.getData();
  356. });
  357. }
  358. }
  359. }
  360. </script>
  361. <style lang="scss" scoped="scoped">
  362. .head{
  363. padding: 0 32rpx;
  364. width: 750rpx;
  365. box-sizing: border-box;
  366. height: auto;
  367. .list{
  368. padding: 30rpx 0;
  369. // border-bottom: 1rpx solid #e5e5e5;
  370. font-size: 28rpx;
  371. color: #555555;
  372. &:last-child{
  373. border-bottom: none;
  374. }
  375. .image{
  376. width: 140rpx;
  377. height: 140rpx;
  378. border-radius: 10rpx;
  379. }
  380. .info{
  381. display: flex;
  382. flex-direction: column;
  383. // justify-content: space-around;
  384. justify-content: space-between;
  385. width: 530rpx;
  386. height: 140rpx;
  387. }
  388. }
  389. }
  390. .fixed-bottom{
  391. position: fixed;
  392. bottom: 0rpx;
  393. left: 0rpx;
  394. z-index: 99;
  395. width: 750rpx;
  396. height: 98rpx;
  397. display: flex;
  398. // justify-content: flex-end;
  399. align-items: center;
  400. border-top: 1rpx solid #E5E5E5;
  401. background-color: #FFFFFF;
  402. box-sizing: border-box;
  403. padding: 0 32rpx;
  404. .btn{
  405. width: 212rpx;
  406. height: 82rpx;
  407. border-radius: 41rpx;
  408. margin: 0;
  409. padding: 0;
  410. font-size: 32rpx;
  411. display: flex;
  412. justify-content: center;
  413. align-items: center;
  414. }
  415. .btn1{
  416. border: 2rpx solid #555555;
  417. opacity: .5;
  418. }
  419. .btn2{
  420. background: #1833F2;
  421. color: #FFFFFF;
  422. margin-left: 20rpx;
  423. }
  424. }
  425. .fixed-bottom>view{
  426. width: 100%;
  427. }
  428. .ms-img{
  429. width: 160rpx;
  430. height: 160rpx;
  431. margin-right: 15rpx;
  432. margin-top: 15rpx;
  433. background-color: #EEEEEE;
  434. &:nth-of-type(4n){
  435. margin-right: 0rpx;
  436. }
  437. }
  438. .popup-box{
  439. width: 686rpx;
  440. // height: 727rpx;
  441. height: max-content;
  442. display: flex;
  443. justify-content: space-between;
  444. flex-direction: column;
  445. .content{
  446. .popup-title{
  447. font-size: 32rpx;
  448. font-weight: bold;
  449. color: #222222;
  450. text-align: center;
  451. margin-top: 40rpx;
  452. }
  453. .popup-desc{
  454. font-size: 28rpx;
  455. color: #555555;
  456. text-align: center;
  457. margin-top: 20rpx;
  458. margin-bottom: 18rpx;
  459. }
  460. .popup-images{
  461. display: flex;
  462. flex-wrap: wrap;
  463. padding: 22rpx;
  464. margin-bottom: 18rpx;
  465. .popup-image-item{
  466. width: 198rpx;
  467. height: 198rpx;
  468. margin: 8rpx;
  469. background: #F5F5F5;
  470. border-radius: 10rpx;
  471. position: relative;
  472. image{
  473. width: 100%;
  474. height: 100%;
  475. }
  476. .remove-image{
  477. position: absolute;
  478. right: -8rpx;
  479. top: -16rpx;
  480. color: #e74c3c;
  481. font-size: 40rpx;
  482. padding: 8rpx;
  483. }
  484. }
  485. .popup-image-item-after::after{
  486. content: '+';
  487. position: absolute;
  488. left: 30%;
  489. top: 14%;
  490. font-size: 100rpx;
  491. color: #777777;
  492. }
  493. }
  494. .popup-input{
  495. padding: 0 60rpx;
  496. box-sizing: border-box;
  497. height: 90rpx;
  498. font-size: 28rpx;
  499. color: #555555;
  500. input{
  501. text-align: right;
  502. }
  503. }
  504. }
  505. .foot-btn{
  506. height: 90rpx;
  507. width: 100%;
  508. border-top: 1rpx solid #E5E5E5;
  509. display: flex;
  510. box-sizing: border-box;
  511. .popup-btn{
  512. width: 50%;
  513. height: 100%;
  514. border: none;
  515. border-radius: initial;
  516. &:last-child{
  517. border-left: 1rpx solid #E5E5E5;
  518. color: #1833F2;
  519. }
  520. }
  521. }
  522. }
  523. // 去掉u-button 外边框线
  524. /deep/.u-hairline-border::after{
  525. border: none;
  526. }
  527. </style>