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

499 lines
14 KiB

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