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

414 lines
11 KiB

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