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

441 lines
12 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
5 years ago
5 years ago
  1. <template>
  2. <view>
  3. <view class="head" v-if="$isRight(order)">
  4. <view class="lf-row-between lf-color-gray list">
  5. <view>采购单 {{ order.p_sn }}</view>
  6. </view>
  7. <view class="lf-row-between list">
  8. <image :src="order.supplier.logo" class="image"></image>
  9. <view class="info">
  10. <view class="lf-font-32 lf-color-black lf-font-bold">{{ order.supplier.supplier_name }}</view>
  11. <view class="lf-font-24 lf-color-555">{{ order.supplier.address }}</view>
  12. </view>
  13. </view>
  14. </view>
  15. <self-line></self-line>
  16. <view class="lf-p-l-32 lf-p-r-32 lf-border-box lf-bg-white">
  17. <!-- <lf-ysteps :stepList="stepList" color="#11D189"></lf-ysteps> -->
  18. <lf-stepbar :list="order.state_log" v-if="order.state_log"></lf-stepbar>
  19. </view>
  20. <self-line></self-line>
  21. <view class="head">
  22. <view class="lf-row-between list">
  23. <view>车辆</view>
  24. <view class="lf-font-bold">{{order.car_license}}</view>
  25. </view>
  26. <view class="lf-row-between list">
  27. <view>司机</view>
  28. <view class="lf-font-bold">{{order.deliver_man}}</view>
  29. </view>
  30. <view class="lf-row-between list">
  31. <view>联系电话</view>
  32. <view class="lf-font-bold">{{order.deliver_phone}}</view>
  33. </view>
  34. <view class="list">
  35. <view>证明材料-供应端</view>
  36. <view class="lf-flex-wrap lf-m-t-10">
  37. <image :src="item.voucher_pic" @click="lookImage(index)" class="ms-img" v-for="(item, index) in order.voucher" :key="item.id"></image>
  38. </view>
  39. </view>
  40. <view class="list" v-if="voucher_list.length">
  41. <view>证明材料-食堂端</view>
  42. <view class="lf-flex-wrap lf-m-t-10">
  43. <image :src="item" @click="lookPopupImage(index)" class="ms-img" v-for="(item, index) in voucher_list" :key="index"></image>
  44. </view>
  45. </view>
  46. </view>
  47. <self-line></self-line>
  48. <view class="lf-m-t-30 lf-m-l-32">
  49. <view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">物资明细</view>
  50. <wyb-table :first-line-fixed="true" contentBgColor="#ecfaf5" :headers="headers" :contents="contents" width="max-content" height="350rpx"></wyb-table>
  51. </view>
  52. <view style="height: 100rpx;"></view>
  53. <!-- 操作按钮 -->
  54. <view class="fixed-bottom" v-if="type != '备货中'">
  55. <view v-if="type == '待发单'" class="lf-row-flex-end">
  56. <button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=1')">编辑</button>
  57. <button class="btn btn2">立即发单</button>
  58. </view>
  59. <view v-else-if="type == '待接单'" class="lf-row-flex-end">
  60. <button class="btn btn2" style="background-color: #FF0000;" @click="orderStateChange('已撤销')">撤销订单</button>
  61. </view>
  62. <view v-else-if="type == '已发货'" class="lf-row-flex-end">
  63. <button class="btn btn1">退单</button>
  64. <button class="btn btn1 lf-m-l-20" @click="is_show_voucher = true">上传凭证</button>
  65. <button class="btn btn2" @click="$url('/pages/purchase/receipt?p_sn='+ order.p_sn)">确认收货</button>
  66. </view>
  67. <view v-else-if="type == '已收货' || type == '已入库'" class="lf-row-between">
  68. <button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=2')">复用采购单</button>
  69. <view class="lf-font-32" style="color: #11D189;">已完成</view>
  70. </view>
  71. </view>
  72. <!-- 弹出层-上传凭证 -->
  73. <u-popup v-model="is_show_voucher" mode="center" border-radius="20">
  74. <view class="popup-box">
  75. <view class="content">
  76. <view class="popup-title">上传凭证信息</view>
  77. <view class="popup-desc">请在此处上传检验检疫凭证售卖资质等证书</view>
  78. <view class="popup-images">
  79. <view class="popup-image-item" v-for="(item, index) in voucher_list" :key="index" @click="lookPopupImage(index)">
  80. <image :src="item" mode="aspectFill"></image>
  81. <view class="remove-image" @click.stop="removeInage(index)">
  82. <u-icon name="close-circle"></u-icon>
  83. </view>
  84. </view>
  85. <view class="popup-image-item popup-image-item-after" @click="uploadImage" v-if="voucher_list.length < 6"></view>
  86. </view>
  87. </view>
  88. <view class="foot-btn">
  89. <u-button class="popup-btn" @click="is_show_voucher = false">取消</u-button>
  90. <u-button class="popup-btn" @click="submitImage">确定</u-button>
  91. </view>
  92. </view>
  93. </u-popup>
  94. </view>
  95. </template>
  96. <script>
  97. import { uploadFile } from '@/common/uploadFile.js'
  98. import lfYsteps from '@/components/lf-ysteps/lf-ysteps';
  99. import wybTable from '@/components/wyb-table/wyb-table';
  100. export default {
  101. components: { lfYsteps, wybTable },
  102. data(){
  103. return {
  104. headers: [{
  105. key: 'name',
  106. label: '物资名称'
  107. },{
  108. key: 'spec',
  109. label: '规格'
  110. },{
  111. key: 'brand',
  112. label: '品牌'
  113. },{
  114. key: 'quality_level',
  115. label: '品级'
  116. },{
  117. label: '编号',
  118. key: 'm_sn'
  119. },{
  120. label: '供应商',
  121. key: 'supplier_name'
  122. },{
  123. key: 'pre_tax_price',
  124. label: '税前价格'
  125. },{
  126. key: 'after_tax_price',
  127. label: '税后价格'
  128. },{
  129. key: 'purchase_limit',
  130. label: '起购数'
  131. },{
  132. key: 'purchase_number',
  133. label: '采购数量'
  134. }],
  135. contents: [],
  136. order: {},
  137. p_sn: '',
  138. type: 4,
  139. is_show_voucher: false,
  140. voucher_list: [],
  141. voucher_count: 6
  142. }
  143. },
  144. onLoad(options){
  145. // TODO 1、凭证上传流程变动:当采购单状态为已发货状态时,食堂可以上传凭证图片;
  146. // TODO 2、食堂收货时,实到数、实收数默认填充采购数量;
  147. // todo 上传凭证参考页面:/uniapp-supplychain/supplier/pages/gonghuo/detail
  148. this.p_sn = options.p_sn || '';
  149. // TODO 显示车辆等信息,显示table信息
  150. this.getData();
  151. },
  152. methods: {
  153. // 预览图片
  154. lookPopupImage(current){
  155. if(this.voucher_list.length <= 0) return;
  156. this.$u.throttle(() => {
  157. uni.previewImage({
  158. urls: this.voucher_list,
  159. current: current
  160. })
  161. }, 500);
  162. },
  163. // 移除图片
  164. removeInage(current){
  165. this.voucher_list.splice(current, 1);
  166. },
  167. // 上传凭证图片
  168. uploadImage(){
  169. let current_count = this.voucher_count - this.voucher_list.length;
  170. if(current_count == 0) return;
  171. uni.chooseImage({
  172. count: current_count,
  173. complete: result => {
  174. this.voucher_list.push(...result.tempFilePaths);
  175. console.log(this.voucher_list)
  176. }
  177. })
  178. },
  179. // 用户点击确定,将图片上传至oss,并将url发送给后端
  180. submitImage(){
  181. let that = this;
  182. let voucher_list = that.voucher_list;
  183. if(voucher_list.length <= 0){
  184. return that.$msg('您未上传图片哦');
  185. };
  186. that.is_show_voucher = false;
  187. uni.showLoading({
  188. title: '正在上传中...'
  189. })
  190. let http_list = [];
  191. voucher_list.map(item => {
  192. let itemP = new Promise((resolve, reject) => {
  193. uploadFile(item, (res) => {
  194. resolve(res);
  195. }, (err) => {
  196. reject(err);
  197. }, this);
  198. })
  199. http_list.push(itemP);
  200. })
  201. Promise.all(http_list).then(res => {
  202. console.log("上传完毕", res);
  203. let images = res.map(item => item.path);
  204. console.log(images)
  205. // todo 图片上传url给后端
  206. that.$http(that.API.API_SUPPLIER_PURCHASEUPLOADVOUCHER, {
  207. p_sn: that.p_sn,
  208. images: images,
  209. }).then(result => {
  210. uni.hideLoading();
  211. that.voucher_list = [];
  212. that.$msg('凭证已上传成功!')
  213. }).catch(err => uni.hideLoading());
  214. }).catch(err => {
  215. console.log(err)
  216. uni.hideLoading();
  217. uni.showModal({
  218. title: '',
  219. content: JSON.stringify(err),
  220. showCancel: false,
  221. confirmColor: '#1833F2'
  222. })
  223. })
  224. },
  225. getData(){
  226. this.$http(this.API.API_CANTEEN_PURCHASEDETAIL, {
  227. p_sn: this.p_sn
  228. // p_sn: '802316269455228606'
  229. }).then(res => {
  230. console.log("xxx",res)
  231. this.order = res.data.order;
  232. let list = res.data.order.items || [];
  233. let contents = list.map(item => {
  234. return {
  235. name: item.material.m_name,
  236. spec: item.spec.name,
  237. brand: item.material.brand,
  238. quality_level: item.material.quality_level,
  239. m_sn: item.material.m_sn,
  240. supplier_name: this.order.supplier.supplier_name,
  241. pre_tax_price: item.total_tax_amount,
  242. after_tax_price: item.total_non_tax_amount,
  243. purchase_limit: item.p_order_item.purchase_limit,
  244. purchase_number: item.purchase_number
  245. }
  246. })
  247. this.contents = contents;
  248. console.log(this.contents)
  249. this.type = res.data.order.state
  250. })
  251. },
  252. // 预览图片
  253. lookImage(index){
  254. this.$u.throttle(() => {
  255. let images = this.order.voucher.map(item => item.voucher_pic);
  256. uni.previewImage({
  257. urls: images,
  258. current: index
  259. })
  260. }, 200);
  261. },
  262. // 改变订单状态 TODO
  263. orderStateChange(state){
  264. this.$http(this.API.API_CANTEEN_PURCHASEUPDATE, {
  265. p_sn: this.p_sn,
  266. state: state
  267. }).then(res => {
  268. console.log("orderStateChange", res);
  269. this.$msg('操作成功').then(()=>{this.$toBack()});
  270. })
  271. }
  272. }
  273. }
  274. </script>
  275. <style lang="scss" scoped="scoped">
  276. .head{
  277. padding: 0 32rpx;
  278. width: 750rpx;
  279. box-sizing: border-box;
  280. height: auto;
  281. .list{
  282. padding: 30rpx 0;
  283. border-bottom: 1rpx solid #e5e5e5;
  284. font-size: 28rpx;
  285. color: #555555;
  286. &:last-child{
  287. border-bottom: none;
  288. }
  289. .image{
  290. width: 140rpx;
  291. height: 140rpx;
  292. border-radius: 10rpx;
  293. background-color: #EEEEEE;
  294. }
  295. .info{
  296. display: flex;
  297. flex-direction: column;
  298. justify-content: space-around;
  299. width: 530rpx;
  300. height: 140rpx;
  301. }
  302. }
  303. }
  304. .fixed-bottom{
  305. position: fixed;
  306. bottom: 0rpx;
  307. left: 0rpx;
  308. z-index: 99;
  309. width: 750rpx;
  310. height: 98rpx;
  311. display: flex;
  312. // justify-content: flex-end;
  313. align-items: center;
  314. border-top: 1rpx solid #E5E5E5;
  315. background-color: #FFFFFF;
  316. box-sizing: border-box;
  317. padding: 0 32rpx;
  318. .btn{
  319. width: 212rpx;
  320. height: 82rpx;
  321. border-radius: 41rpx;
  322. margin: 0;
  323. padding: 0;
  324. font-size: 32rpx;
  325. display: flex;
  326. justify-content: center;
  327. align-items: center;
  328. }
  329. .btn1{
  330. border: 2rpx solid #555555;
  331. opacity: .5;
  332. }
  333. .btn2{
  334. background: #11D189;
  335. color: #FFFFFF;
  336. margin-left: 20rpx;
  337. }
  338. }
  339. .fixed-bottom>view{
  340. width: 100%;
  341. }
  342. .ms-img{
  343. width: 160rpx;
  344. height: 160rpx;
  345. margin-right: 15rpx;
  346. margin-top: 15rpx;
  347. background-color: #EEEEEE;
  348. &:nth-of-type(4n){
  349. margin-right: 0rpx;
  350. }
  351. }
  352. .popup-box{
  353. width: 686rpx;
  354. height: max-content;
  355. display: flex;
  356. justify-content: space-between;
  357. flex-direction: column;
  358. .content{
  359. .popup-title{
  360. font-size: 32rpx;
  361. font-weight: bold;
  362. color: #222222;
  363. text-align: center;
  364. margin-top: 40rpx;
  365. }
  366. .popup-desc{
  367. font-size: 28rpx;
  368. color: #555555;
  369. text-align: center;
  370. margin-top: 20rpx;
  371. margin-bottom: 18rpx;
  372. }
  373. .popup-images{
  374. display: flex;
  375. flex-wrap: wrap;
  376. padding: 22rpx;
  377. margin-bottom: 18rpx;
  378. .popup-image-item{
  379. width: 198rpx;
  380. height: 198rpx;
  381. margin: 8rpx;
  382. background: #F5F5F5;
  383. border-radius: 10rpx;
  384. position: relative;
  385. image{
  386. width: 100%;
  387. height: 100%;
  388. }
  389. .remove-image{
  390. position: absolute;
  391. right: -8rpx;
  392. top: -16rpx;
  393. color: #e74c3c;
  394. font-size: 40rpx;
  395. padding: 8rpx;
  396. }
  397. }
  398. .popup-image-item-after::after{
  399. content: '+';
  400. position: absolute;
  401. left: 30%;
  402. top: 14%;
  403. font-size: 100rpx;
  404. color: #777777;
  405. }
  406. }
  407. .popup-input{
  408. padding: 0 60rpx;
  409. box-sizing: border-box;
  410. height: 90rpx;
  411. font-size: 28rpx;
  412. color: #555555;
  413. input{
  414. text-align: right;
  415. }
  416. }
  417. }
  418. .foot-btn{
  419. height: 90rpx;
  420. width: 100%;
  421. border-top: 1rpx solid #E5E5E5;
  422. display: flex;
  423. box-sizing: border-box;
  424. .popup-btn{
  425. width: 50%;
  426. height: 100%;
  427. border: none;
  428. border-radius: initial;
  429. &:last-child{
  430. border-left: 1rpx solid #E5E5E5;
  431. color: #1833F2;
  432. }
  433. }
  434. }
  435. }
  436. </style>