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

554 lines
16 KiB

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