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

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