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

519 lines
15 KiB

  1. <template>
  2. <view>
  3. <block v-if="$isRight(order)">
  4. <view class="head">
  5. <view class="lf-row-between list">
  6. <image :src="order.supplier.logo" class="image"></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. <image :src="item" @click="lookImage(index, 'supplier_voucher')" class="ms-img" v-for="(item, index) in supplier_voucher" :key="index"></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. <image :src="item" @click="lookImage(index, 'canteen_voucher')" class="ms-img" v-for="(item, index) in canteen_voucher" :key="index"></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" @click="orderStateChange('待接单')">立即发单</button>
  68. </view>
  69. <view v-else-if="type == '待接单'" class="lf-row-flex-end">
  70. <button class="btn btn2" 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" @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. }
  176. },
  177. onLoad(options){
  178. this.p_sn = options.p_sn || '';
  179. this.getData();
  180. },
  181. onShow(){
  182. this.show_count++;
  183. if(this.show_count > 1){
  184. this.getData();
  185. }
  186. },
  187. methods: {
  188. // 拨打电话
  189. call(phone) {
  190. uni.makePhoneCall({
  191. phoneNumber: String(phone)
  192. });
  193. },
  194. getData(){
  195. this.$http(this.API.API_CANTEEN_PURCHASEDETAIL, {
  196. p_sn: this.p_sn
  197. }).then(res => {
  198. let order = res.data.order;
  199. order.state_log.forEach((item, index) => {
  200. item.isFinished = false;
  201. if(index == order.state_log.length - 1){
  202. let actionState = [
  203. '订单已完成',
  204. '订单已退款',
  205. '订单已撤销',
  206. '订单已确认,物资入库'
  207. ];
  208. if(actionState.includes(item.action)){
  209. item.isFinished = true;
  210. }
  211. }
  212. })
  213. let supplier_voucher = [];
  214. let canteen_voucher = [];
  215. order.voucher.map(item => {
  216. if(item.client_type == '供应商'){
  217. supplier_voucher.push(item.voucher_pic);
  218. }else if(item.client_type == '食堂'){
  219. canteen_voucher.push(item.voucher_pic);
  220. }
  221. })
  222. this.supplier_voucher = supplier_voucher;
  223. this.canteen_voucher = canteen_voucher;
  224. this.order = order;
  225. let list = order.items || [];
  226. let contents = list.map(item => {
  227. return {
  228. name: item?.material?.m_name,
  229. spec: item?.spec?.name,
  230. brand: item?.material?.brand,
  231. quality_level: item?.material?.quality_level,
  232. m_sn: item?.material?.m_sn,
  233. supplier_name: order?.supplier?.supplier_name,
  234. pre_tax_price: item.tax_price,
  235. after_tax_price: item.non_tax_price,
  236. purchase_limit: item?.p_order_item.purchase_limit,
  237. purchase_number: item.purchase_number,
  238. unit: item?.material?.unit?.unit_name || '',
  239. category: item?.material?.category?.m_cate_name || '',
  240. total_tax_amount: item.total_tax_amount,
  241. total_non_tax_amount: item.total_non_tax_amount
  242. }
  243. })
  244. this.contents = contents;
  245. this.type = order.state;
  246. }).catch(err => this.$toBack());
  247. },
  248. // 预览图片
  249. lookImage(current, list){
  250. if(this[list].length <= 0) return;
  251. this.$u.throttle(() => {
  252. this.$refs.previewimage.show({ images: this[list], current: current });
  253. }, 500);
  254. },
  255. // 移除图片
  256. removeInage(current){
  257. this.voucher_list.splice(current, 1);
  258. },
  259. // 上传凭证图片
  260. uploadImage(){
  261. let current_count = this.voucher_count - this.voucher_list.length;
  262. if(current_count == 0) return;
  263. uni.chooseImage({
  264. count: current_count,
  265. complete: result => {
  266. this.voucher_list.push(...result.tempFilePaths);
  267. console.log(this.voucher_list)
  268. }
  269. })
  270. },
  271. // 用户点击确定,将图片上传至oss,并将url发送给后端
  272. submitImage(){
  273. let that = this;
  274. let voucher_list = that.voucher_list;
  275. if(voucher_list.length <= 0){
  276. return that.$msg('您未上传图片哦');
  277. };
  278. that.is_show_voucher = false;
  279. uni.showLoading({
  280. title: '正在上传中...'
  281. })
  282. let http_list = [];
  283. voucher_list.map(item => {
  284. let itemP = new Promise((resolve, reject) => {
  285. uploadFile(item, (res) => {
  286. resolve(res);
  287. }, (err) => {
  288. reject(err);
  289. }, this);
  290. })
  291. http_list.push(itemP);
  292. })
  293. Promise.all(http_list).then(res => {
  294. console.log("sssssss", res);
  295. let images = res.map(item => item.path);
  296. that.$http(that.API.API_SUPPLIER_PURCHASEUPLOADVOUCHER, {
  297. p_sn: that.p_sn,
  298. images: images,
  299. }).then(result => {
  300. uni.hideLoading();
  301. that.voucher_list = [];
  302. that.$msg('凭证已上传成功!');
  303. that.getData();
  304. }).catch(err => uni.hideLoading());
  305. }).catch(err => {
  306. uni.hideLoading();
  307. uni.showModal({
  308. title: '',
  309. content: JSON.stringify(err),
  310. showCancel: false,
  311. confirmColor: '#1833F2'
  312. })
  313. })
  314. },
  315. // 改变订单状态
  316. orderStateChange(state){
  317. let that = this;
  318. if(state == '已退单'){
  319. uni.showModal({
  320. title: '温馨提示',
  321. content: '退单前请与供应商协商,以免造成损失!确定继续退单操作吗?',
  322. confirmColor: '#FF0000',
  323. cancelColor: '#11D189',
  324. success: result => {
  325. if(result.confirm){
  326. $change();
  327. }
  328. }
  329. })
  330. }else{
  331. $change();
  332. }
  333. function $change(){
  334. that.$http(that.API.API_CANTEEN_PURCHASEUPDATE, {
  335. p_sn: that.p_sn,
  336. state: state
  337. }).then(res => {
  338. that.$msg('操作成功').then(()=> that.getData());
  339. })
  340. }
  341. }
  342. }
  343. }
  344. </script>
  345. <style lang="scss" scoped="scoped">
  346. .head{
  347. padding: 0 32rpx;
  348. width: 750rpx;
  349. box-sizing: border-box;
  350. height: auto;
  351. .list{
  352. padding: 30rpx 0;
  353. // border-bottom: 1rpx solid #e5e5e5;
  354. font-size: 28rpx;
  355. color: #555555;
  356. &:last-child{
  357. border-bottom: none;
  358. }
  359. .image{
  360. width: 140rpx;
  361. height: 140rpx;
  362. border-radius: 10rpx;
  363. background-color: #EEEEEE;
  364. }
  365. .info{
  366. display: flex;
  367. flex-direction: column;
  368. justify-content: space-around;
  369. width: 530rpx;
  370. height: 140rpx;
  371. }
  372. }
  373. }
  374. .fixed-bottom{
  375. position: fixed;
  376. bottom: 0rpx;
  377. left: 0rpx;
  378. z-index: 99;
  379. width: 750rpx;
  380. height: 98rpx;
  381. display: flex;
  382. // justify-content: flex-end;
  383. align-items: center;
  384. border-top: 1rpx solid #E5E5E5;
  385. background-color: #FFFFFF;
  386. box-sizing: border-box;
  387. padding: 0 32rpx;
  388. .btn{
  389. width: 212rpx;
  390. height: 82rpx;
  391. border-radius: 41rpx;
  392. margin: 0;
  393. padding: 0;
  394. font-size: 32rpx;
  395. display: flex;
  396. justify-content: center;
  397. align-items: center;
  398. }
  399. .btn1{
  400. border: 2rpx solid #555555;
  401. opacity: .5;
  402. }
  403. .btn2{
  404. background: #11D189;
  405. color: #FFFFFF;
  406. margin-left: 20rpx;
  407. }
  408. }
  409. .fixed-bottom>view{
  410. width: 100%;
  411. }
  412. .ms-img{
  413. width: 160rpx;
  414. height: 160rpx;
  415. margin-right: 15rpx;
  416. margin-top: 15rpx;
  417. background-color: #EEEEEE;
  418. &:nth-of-type(4n){
  419. margin-right: 0rpx;
  420. }
  421. }
  422. .voucher-popup-box{
  423. width: 686rpx;
  424. height: max-content;
  425. display: flex;
  426. justify-content: space-between;
  427. flex-direction: column;
  428. .popup-content{
  429. .popup-title{
  430. font-size: 32rpx;
  431. font-weight: bold;
  432. color: #222222;
  433. text-align: center;
  434. margin-top: 40rpx;
  435. }
  436. .popup-desc{
  437. font-size: 28rpx;
  438. color: #555555;
  439. text-align: center;
  440. margin-top: 20rpx;
  441. margin-bottom: 18rpx;
  442. }
  443. .popup-images{
  444. display: flex;
  445. flex-wrap: wrap;
  446. padding: 22rpx;
  447. margin-bottom: 18rpx;
  448. .popup-image-item{
  449. width: 198rpx;
  450. height: 198rpx;
  451. margin: 8rpx;
  452. background: #F5F5F5;
  453. border-radius: 10rpx;
  454. position: relative;
  455. image{
  456. width: 100%;
  457. height: 100%;
  458. }
  459. .remove-image{
  460. position: absolute;
  461. right: -8rpx;
  462. top: -16rpx;
  463. color: #e74c3c;
  464. font-size: 40rpx;
  465. padding: 8rpx;
  466. }
  467. }
  468. .popup-image-item-after::after{
  469. content: '+';
  470. position: absolute;
  471. left: 30%;
  472. top: 14%;
  473. font-size: 100rpx;
  474. color: #777777;
  475. }
  476. }
  477. .popup-input{
  478. padding: 0 60rpx;
  479. box-sizing: border-box;
  480. height: 90rpx;
  481. font-size: 28rpx;
  482. color: #555555;
  483. input{
  484. text-align: right;
  485. }
  486. }
  487. }
  488. .foot-btn{
  489. height: 90rpx;
  490. width: 100%;
  491. border-top: 1rpx solid #E5E5E5;
  492. display: flex;
  493. box-sizing: border-box;
  494. .popup-btn{
  495. width: 50%;
  496. height: 100%;
  497. border: none;
  498. border-radius: initial;
  499. &:last-child{
  500. border-left: 1rpx solid #E5E5E5;
  501. color: #1833F2;
  502. }
  503. }
  504. }
  505. }
  506. // 去掉u-button 外边框线
  507. /deep/.u-hairline-border::after{
  508. border: none;
  509. }
  510. </style>