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

419 lines
11 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
  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: 'pre_tax_price',
  112. label: '税前价格'
  113. },{
  114. key: 'after_tax_price',
  115. label: '税后价格'
  116. }],
  117. contents: [],
  118. order: {},
  119. p_sn: '',
  120. type: 4,
  121. is_show_voucher: false,
  122. voucher_list: [],
  123. voucher_count: 6
  124. }
  125. },
  126. onLoad(options){
  127. // TODO 1、凭证上传流程变动:当采购单状态为已发货状态时,食堂可以上传凭证图片;
  128. // TODO 2、食堂收货时,实到数、实收数默认填充采购数量;
  129. // todo 上传凭证参考页面:/uniapp-supplychain/supplier/pages/gonghuo/detail
  130. this.p_sn = options.p_sn || '';
  131. // TODO 显示车辆等信息,显示table信息
  132. this.getData();
  133. },
  134. methods: {
  135. // 预览图片
  136. lookPopupImage(current){
  137. if(this.voucher_list.length <= 0) return;
  138. this.$u.throttle(() => {
  139. uni.previewImage({
  140. urls: this.voucher_list,
  141. current: current
  142. })
  143. }, 500);
  144. },
  145. // 移除图片
  146. removeInage(current){
  147. this.voucher_list.splice(current, 1);
  148. },
  149. // 上传凭证图片
  150. uploadImage(){
  151. let current_count = this.voucher_count - this.voucher_list.length;
  152. if(current_count == 0) return;
  153. uni.chooseImage({
  154. count: current_count,
  155. complete: result => {
  156. this.voucher_list.push(...result.tempFilePaths);
  157. console.log(this.voucher_list)
  158. }
  159. })
  160. },
  161. // 用户点击确定,将图片上传至oss,并将url发送给后端
  162. submitImage(){
  163. let that = this;
  164. let voucher_list = that.voucher_list;
  165. if(voucher_list.length <= 0){
  166. return that.$msg('您未上传图片哦');
  167. };
  168. that.is_show_voucher = false;
  169. uni.showLoading({
  170. title: '正在上传中...'
  171. })
  172. let http_list = [];
  173. voucher_list.map(item => {
  174. let itemP = new Promise((resolve, reject) => {
  175. uploadFile(item, (res) => {
  176. resolve(res);
  177. }, (err) => {
  178. reject(err);
  179. }, this);
  180. })
  181. http_list.push(itemP);
  182. })
  183. Promise.all(http_list).then(res => {
  184. console.log("上传完毕", res);
  185. let images = res.map(item => item.path);
  186. console.log(images)
  187. // todo 图片上传url给后端
  188. that.$http(that.API.API_SUPPLIER_PURCHASEUPLOADVOUCHER, {
  189. p_sn: that.p_sn,
  190. images: images,
  191. }).then(result => {
  192. uni.hideLoading();
  193. that.voucher_list = [];
  194. that.$msg('凭证已上传成功!')
  195. }).catch(err => uni.hideLoading());
  196. }).catch(err => {
  197. console.log(err)
  198. uni.hideLoading();
  199. uni.showModal({
  200. title: '',
  201. content: JSON.stringify(err),
  202. showCancel: false,
  203. confirmColor: '#1833F2'
  204. })
  205. })
  206. },
  207. getData(){
  208. this.$http(this.API.API_CANTEEN_PURCHASEDETAIL, {
  209. p_sn: this.p_sn
  210. // p_sn: '802316269455228606'
  211. }).then(res => {
  212. console.log("xxx",res)
  213. this.order = res.data.order;
  214. let list = res.data.order.items || [];
  215. let contents = list.map(item => {
  216. return {
  217. name: item.material.m_name,
  218. spec: item.spec.name,
  219. pre_tax_price: item.total_tax_amount,
  220. after_tax_price: item.total_non_tax_amount,
  221. spec_id: item.spec.id,
  222. material_id: item.material.id
  223. }
  224. })
  225. this.contents = contents;
  226. console.log(this.contents)
  227. this.type = res.data.order.state
  228. })
  229. },
  230. // 预览图片
  231. lookImage(index){
  232. this.$u.throttle(() => {
  233. let images = this.order.voucher.map(item => item.voucher_pic);
  234. uni.previewImage({
  235. urls: images,
  236. current: index
  237. })
  238. }, 200);
  239. },
  240. // 改变订单状态 TODO
  241. orderStateChange(state){
  242. this.$http(this.API.API_CANTEEN_PURCHASEUPDATE, {
  243. p_sn: this.p_sn,
  244. state: state
  245. }).then(res => {
  246. console.log("orderStateChange", res);
  247. this.$msg('操作成功').then(()=>{this.$toBack()});
  248. })
  249. }
  250. }
  251. }
  252. </script>
  253. <style lang="scss" scoped="scoped">
  254. .head{
  255. padding: 0 32rpx;
  256. width: 750rpx;
  257. box-sizing: border-box;
  258. height: auto;
  259. .list{
  260. padding: 30rpx 0;
  261. border-bottom: 1rpx solid #e5e5e5;
  262. font-size: 28rpx;
  263. color: #555555;
  264. &:last-child{
  265. border-bottom: none;
  266. }
  267. .image{
  268. width: 140rpx;
  269. height: 140rpx;
  270. border-radius: 10rpx;
  271. background-color: #EEEEEE;
  272. }
  273. .info{
  274. display: flex;
  275. flex-direction: column;
  276. justify-content: space-around;
  277. width: 530rpx;
  278. height: 140rpx;
  279. }
  280. }
  281. }
  282. .fixed-bottom{
  283. position: fixed;
  284. bottom: 0rpx;
  285. left: 0rpx;
  286. z-index: 99;
  287. width: 750rpx;
  288. height: 98rpx;
  289. display: flex;
  290. // justify-content: flex-end;
  291. align-items: center;
  292. border-top: 1rpx solid #E5E5E5;
  293. background-color: #FFFFFF;
  294. box-sizing: border-box;
  295. padding: 0 32rpx;
  296. .btn{
  297. width: 212rpx;
  298. height: 82rpx;
  299. border-radius: 41rpx;
  300. margin: 0;
  301. padding: 0;
  302. font-size: 32rpx;
  303. display: flex;
  304. justify-content: center;
  305. align-items: center;
  306. }
  307. .btn1{
  308. border: 2rpx solid #555555;
  309. opacity: .5;
  310. }
  311. .btn2{
  312. background: #11D189;
  313. color: #FFFFFF;
  314. margin-left: 20rpx;
  315. }
  316. }
  317. .fixed-bottom>view{
  318. width: 100%;
  319. }
  320. .ms-img{
  321. width: 160rpx;
  322. height: 160rpx;
  323. margin-right: 15rpx;
  324. margin-top: 15rpx;
  325. background-color: #EEEEEE;
  326. &:nth-of-type(4n){
  327. margin-right: 0rpx;
  328. }
  329. }
  330. .popup-box{
  331. width: 686rpx;
  332. height: max-content;
  333. display: flex;
  334. justify-content: space-between;
  335. flex-direction: column;
  336. .content{
  337. .popup-title{
  338. font-size: 32rpx;
  339. font-weight: bold;
  340. color: #222222;
  341. text-align: center;
  342. margin-top: 40rpx;
  343. }
  344. .popup-desc{
  345. font-size: 28rpx;
  346. color: #555555;
  347. text-align: center;
  348. margin-top: 20rpx;
  349. margin-bottom: 18rpx;
  350. }
  351. .popup-images{
  352. display: flex;
  353. flex-wrap: wrap;
  354. padding: 22rpx;
  355. margin-bottom: 18rpx;
  356. .popup-image-item{
  357. width: 198rpx;
  358. height: 198rpx;
  359. margin: 8rpx;
  360. background: #F5F5F5;
  361. border-radius: 10rpx;
  362. position: relative;
  363. image{
  364. width: 100%;
  365. height: 100%;
  366. }
  367. .remove-image{
  368. position: absolute;
  369. right: -8rpx;
  370. top: -16rpx;
  371. color: #e74c3c;
  372. font-size: 40rpx;
  373. padding: 8rpx;
  374. }
  375. }
  376. .popup-image-item-after::after{
  377. content: '+';
  378. position: absolute;
  379. left: 30%;
  380. top: 14%;
  381. font-size: 100rpx;
  382. color: #777777;
  383. }
  384. }
  385. .popup-input{
  386. padding: 0 60rpx;
  387. box-sizing: border-box;
  388. height: 90rpx;
  389. font-size: 28rpx;
  390. color: #555555;
  391. input{
  392. text-align: right;
  393. }
  394. }
  395. }
  396. .foot-btn{
  397. height: 90rpx;
  398. width: 100%;
  399. border-top: 1rpx solid #E5E5E5;
  400. display: flex;
  401. box-sizing: border-box;
  402. .popup-btn{
  403. width: 50%;
  404. height: 100%;
  405. border: none;
  406. border-radius: initial;
  407. &:last-child{
  408. border-left: 1rpx solid #E5E5E5;
  409. color: #1833F2;
  410. }
  411. }
  412. }
  413. }
  414. </style>