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

449 lines
12 KiB

  1. <template>
  2. <view>
  3. <view class="head">
  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" v-if="order.canteen">
  8. <image :src="order.canteen.logo" class="image"></image>
  9. <view class="info">
  10. <view class="lf-font-32 lf-color-black lf-font-bold">{{ order.canteen.canteen_name }}</view>
  11. <view class="lf-font-24 lf-color-555">{{ order.canteen.address }}</view>
  12. </view>
  13. </view>
  14. </view>
  15. <self-line></self-line>
  16. <view class="lf-border-box lf-bg-white">
  17. <lf-stepbar :list="stepList"></lf-stepbar>
  18. </view>
  19. <self-line></self-line>
  20. <view class="lf-m-t-30 lf-m-l-32">
  21. <view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">物资明细</view>
  22. <wyb-table v-if="contents.length" :first-line-fixed="true" contentBgColor="#eef6fe" :headers="headers" :contents="contents" width="max-content" height="350rpx"></wyb-table>
  23. </view>
  24. <view style="height: 100rpx;"></view>
  25. <!-- 操作按钮 -->
  26. <view class="fixed-bottom">
  27. <view v-if="type == '待接单'" class="lf-row-flex-end">
  28. <button class="btn btn2" style="background-color: #1833F2;" @click="orderTaking">立即接单</button>
  29. </view>
  30. <view v-else-if="type == '备货中'" class="lf-row-flex-end">
  31. <button class="btn btn1" @click="is_show_voucher = true">上传凭证</button>
  32. <button class="btn btn2" @click="is_show_receiving = true">确认发货</button>
  33. </view>
  34. <view v-else-if="type == '已发货'" class="lf-row-between">
  35. <button class="btn btn1" @click="is_show_voucher = true">上传凭证</button>
  36. <view class="lf-font-32" style="color: #11D189;">{{ type }}</view>
  37. </view>
  38. <view v-else class="lf-row-flex-end">
  39. <view class="lf-font-32">{{ type }}</view>
  40. </view>
  41. </view>
  42. <!-- 弹出层-上传凭证 -->
  43. <u-popup v-model="is_show_voucher" mode="center" border-radius="20">
  44. <view class="popup-box">
  45. <view class="content">
  46. <view class="popup-title">上传凭证信息</view>
  47. <view class="popup-desc">请在此处上传检验检疫凭证售卖资质等证书</view>
  48. <view class="popup-images">
  49. <view class="popup-image-item" v-for="(item, index) in voucher_list" :key="index" @click="lookImage(index)">
  50. <image :src="item" mode="aspectFill"></image>
  51. <view class="remove-image" @click.stop="removeInage(index)">
  52. <u-icon name="close-circle"></u-icon>
  53. </view>
  54. </view>
  55. <view class="popup-image-item popup-image-item-after" @click="uploadImage" v-if="voucher_list.length < 6"></view>
  56. </view>
  57. </view>
  58. <view class="foot-btn">
  59. <u-button class="popup-btn" @click="is_show_voucher = false">取消</u-button>
  60. <u-button class="popup-btn" @click="submitImage">确定</u-button>
  61. </view>
  62. </view>
  63. </u-popup>
  64. <!-- 弹出层-确认收货 -->
  65. <u-popup v-model="is_show_receiving" mode="center" border-radius="20">
  66. <view class="popup-box">
  67. <view class="content">
  68. <view class="popup-title">发货提醒</view>
  69. <view class="popup-desc">请填写车辆信息司机信息</view>
  70. <view class="lf-row-between popup-input">
  71. <view>车牌号</view>
  72. <input placeholder="请输入车牌号" v-model="l_p_num" />
  73. </view>
  74. <view class="lf-row-between popup-input">
  75. <view>司机姓名</view>
  76. <input placeholder="请输入司机姓名" v-model="driver_name" />
  77. </view>
  78. <view class="lf-row-between popup-input lf-m-b-30">
  79. <view>司机电话</view>
  80. <input placeholder="请输入司机电话" maxlength="11" v-model="driver_phone" />
  81. </view>
  82. </view>
  83. <view class="foot-btn">
  84. <u-button class="popup-btn" @click="is_show_receiving = false">取消</u-button>
  85. <u-button class="popup-btn" @click="confirmDeliver">确定</u-button>
  86. </view>
  87. </view>
  88. </u-popup>
  89. </view>
  90. </template>
  91. <script>
  92. import { uploadFile } from '@/common/uploadFile.js'
  93. import lfYsteps from '@/components/lf-ysteps/lf-ysteps';
  94. import wybTable from '@/components/wyb-table/wyb-table';
  95. export default {
  96. components: { lfYsteps, wybTable },
  97. data(){
  98. return {
  99. stepList: [],
  100. headers: [{
  101. key: 'm_name',
  102. label: '物资名称'
  103. },{
  104. key: 'spec',
  105. label: '规格'
  106. },{
  107. key: 'brand',
  108. label: '品牌'
  109. },{
  110. key: 'quality_level',
  111. label: '品级'
  112. },{
  113. label: '编号',
  114. key: 'm_sn'
  115. },{
  116. key: 'tax_price',
  117. label: '含税价'
  118. },{
  119. key: 'non_tax_price',
  120. label: '不含税价'
  121. },{
  122. key: 'purchase_limit',
  123. label: '起购数'
  124. },{
  125. key: 'purchase_number',
  126. label: '采购数量'
  127. }],
  128. contents: [],
  129. is_show_voucher: false, // 是否显示凭证上传弹出层
  130. is_show_receiving: false,
  131. voucher_list: [], // 已上传的凭证列表
  132. voucher_count: 6, // 最多可以上传多少张凭证
  133. type: '', // 订单状态
  134. p_sn: '',
  135. order: {},
  136. l_p_num: '',
  137. driver_name: '',
  138. driver_phone: ''
  139. }
  140. },
  141. onLoad(options){
  142. this.p_sn = options.p_sn;
  143. this.getData();
  144. },
  145. methods: {
  146. getData(){
  147. this.$http(this.API.API_SUPPLIER_PURCHASEDETAIL, {
  148. p_sn: this.p_sn
  149. }).then(res => {
  150. console.log("getData", res);
  151. let order = res.data.order || {};
  152. this.type = order.state;
  153. this.order = order;
  154. this.stepList = order.state_log.map((item, index) => {
  155. item.isFinished = false;
  156. if(index == order.state_log.length - 1){
  157. if(item.action == '订单已完成' || item.action == '订单已退款'){
  158. item.isFinished = true;
  159. }
  160. }
  161. return item;
  162. })
  163. let list = order.items || [];
  164. let contents = list.map(item => {
  165. let obj = {
  166. m_name: item.material?.m_name || '',
  167. material_id: item.material?.id,
  168. spec: item.spec?.name || '',
  169. spec_id: item.spec?.id,
  170. brand: item?.material?.brand || '',
  171. quality_level: item?.material?.quality_level || '',
  172. m_sn: item?.material?.m_sn || '',
  173. tax_price: item.tax_price,
  174. non_tax_price: item.non_tax_price,
  175. purchase_limit: item?.p_order_item?.purchase_limit || '',
  176. purchase_number: item.purchase_number
  177. }
  178. return obj;
  179. });
  180. this.contents = contents;
  181. });
  182. },
  183. // 上传凭证图片
  184. uploadImage(){
  185. let current_count = this.voucher_count - this.voucher_list.length;
  186. if(current_count == 0) return;
  187. uni.chooseImage({
  188. count: current_count,
  189. complete: result => {
  190. this.voucher_list.push(...result.tempFilePaths);
  191. }
  192. })
  193. },
  194. // 预览图片
  195. lookImage(current){
  196. if(this.voucher_list.length <= 0) return;
  197. this.$u.throttle(() => {
  198. uni.previewImage({
  199. urls: this.voucher_list,
  200. current: current
  201. })
  202. }, 500);
  203. },
  204. // 移除图片
  205. removeInage(current){
  206. this.voucher_list.splice(current, 1);
  207. },
  208. // 用户点击确定,将图片上传至oss,并将url发送给后端
  209. submitImage(){
  210. let that = this;
  211. let voucher_list = that.voucher_list;
  212. if(voucher_list.length <= 0){
  213. return that.$msg('您未上传图片哦');
  214. };
  215. that.is_show_voucher = false;
  216. uni.showLoading({
  217. title: '正在上传中...'
  218. })
  219. let http_list = [];
  220. voucher_list.map(item => {
  221. let itemP = new Promise((resolve, reject) => {
  222. uploadFile(item, (res) => {
  223. resolve(res);
  224. }, (err) => {
  225. reject(err);
  226. }, this);
  227. })
  228. http_list.push(itemP);
  229. })
  230. Promise.all(http_list).then(res => {
  231. console.log("上传完毕", res);
  232. let images = res.map(item => item.path);
  233. that.$http(that.API.API_SUPPLIER_PURCHASESAVEVOUCHER, {
  234. p_sn: that.p_sn,
  235. images: images,
  236. }).then(result => {
  237. uni.hideLoading();
  238. that.voucher_list = [];
  239. that.$msg('凭证已上传成功!')
  240. }).catch(err => uni.hideLoading());
  241. }).catch(err => {
  242. uni.hideLoading();
  243. uni.showModal({
  244. title: '',
  245. content: JSON.stringify(err),
  246. showCancel: false,
  247. confirmColor: '#1833F2'
  248. })
  249. })
  250. },
  251. // 立即接单
  252. orderTaking(){
  253. this.$http(this.API.API_SUPPLIER_PURCHASEORDERACCEPT, {
  254. p_sn: this.p_sn
  255. }).then(res => {
  256. this.$msg('接单成功');
  257. this.getData();
  258. });
  259. },
  260. // 确认发货
  261. confirmDeliver(){
  262. let l_p_num = this.l_p_num;
  263. let driver_name = this.driver_name;
  264. let driver_phone = this.driver_phone;
  265. if(!l_p_num){
  266. return this.$msg('请输入车牌号')
  267. }else if(!driver_name){
  268. return this.$msg('请输入司机姓名')
  269. }else if(!driver_phone){
  270. return this.$msg('请输入司机电话')
  271. }
  272. this.is_show_receiving = false;
  273. this.$http(this.API.API_SUPPLIER_PURCHASEORDERSENDOUT, {
  274. p_sn: this.p_sn,
  275. deliver_phone: driver_phone,
  276. deliver_man: driver_name,
  277. car_license: l_p_num
  278. }).then(res => {
  279. this.$msg('确认收货成功');
  280. this.getData();
  281. });
  282. }
  283. }
  284. }
  285. </script>
  286. <style lang="scss" scoped="scoped">
  287. .head{
  288. padding: 0 32rpx;
  289. width: 750rpx;
  290. box-sizing: border-box;
  291. height: auto;
  292. .list{
  293. padding: 30rpx 0;
  294. border-bottom: 1rpx solid #e5e5e5;
  295. font-size: 28rpx;
  296. color: #555555;
  297. &:last-child{
  298. border-bottom: none;
  299. }
  300. .image{
  301. width: 140rpx;
  302. height: 140rpx;
  303. border-radius: 10rpx;
  304. }
  305. .info{
  306. display: flex;
  307. flex-direction: column;
  308. justify-content: space-around;
  309. width: 530rpx;
  310. height: 140rpx;
  311. }
  312. }
  313. }
  314. .fixed-bottom{
  315. position: fixed;
  316. bottom: 0rpx;
  317. left: 0rpx;
  318. z-index: 99;
  319. width: 750rpx;
  320. height: 98rpx;
  321. display: flex;
  322. // justify-content: flex-end;
  323. align-items: center;
  324. border-top: 1rpx solid #E5E5E5;
  325. background-color: #FFFFFF;
  326. box-sizing: border-box;
  327. padding: 0 32rpx;
  328. .btn{
  329. width: 212rpx;
  330. height: 82rpx;
  331. border-radius: 41rpx;
  332. margin: 0;
  333. padding: 0;
  334. font-size: 32rpx;
  335. display: flex;
  336. justify-content: center;
  337. align-items: center;
  338. }
  339. .btn1{
  340. border: 2rpx solid #555555;
  341. opacity: .5;
  342. }
  343. .btn2{
  344. background: #1833F2;
  345. color: #FFFFFF;
  346. margin-left: 20rpx;
  347. }
  348. }
  349. .fixed-bottom>view{
  350. width: 100%;
  351. }
  352. .popup-box{
  353. width: 686rpx;
  354. // height: 727rpx;
  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. // 去掉u-button 外边框线
  438. /deep/.u-hairline-border::after{
  439. border: none;
  440. }
  441. </style>