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

345 lines
9.8 KiB

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 list">
  6. <image :src="order.supplier.logo" class="image"></image>
  7. <view class="info">
  8. <view class="lf-font-32 lf-color-black lf-font-bold">{{ order.supplier.supplier_name }}</view>
  9. <view class="lf-font-24 lf-color-555">{{ order.supplier.address }}</view>
  10. <view class="lf-font-24 lf-color-555" @click="call(order.supplier.ctl_phone)">{{order.supplier.ctl_man}} {{ order.supplier.ctl_phone }}</view>
  11. </view>
  12. </view>
  13. </view>
  14. <self-line></self-line>
  15. <view class="lf-bg-white">
  16. <lf-stepbar :list="order.state_log" themeColor="#11D189" v-if="order.state_log"></lf-stepbar>
  17. </view>
  18. <self-line></self-line>
  19. <view class="head">
  20. <view class="lf-row-between list" v-if="order.car_license">
  21. <view>车辆</view>
  22. <view class="lf-font-bold">{{order.car_license}}</view>
  23. </view>
  24. <view class="lf-row-between list" v-if="order.deliver_man">
  25. <view>司机</view>
  26. <view class="lf-font-bold">{{order.deliver_man}}</view>
  27. </view>
  28. <view class="lf-row-between list" @click="call(order.deliver_phone)" v-if="order.deliver_phone">
  29. <view>联系电话</view>
  30. <view class="lf-font-bold" style="color: rgb(17, 209, 137);">{{order.deliver_phone}}</view>
  31. </view>
  32. <view class="lf-row-between list">
  33. <view>采购单</view>
  34. <view class="lf-font-bold">{{ order.p_sn }}</view>
  35. </view>
  36. <view class="lf-row-between list">
  37. <view>批次号</view>
  38. <view class="lf-font-bold">{{ order.batch_sn }}</view>
  39. </view>
  40. <view class="lf-row-between list">
  41. <view>预计收货时间</view>
  42. <view class="lf-font-bold">{{order.deadline_text}}</view>
  43. </view>
  44. <view class="list" v-if="supplier_voucher.length">
  45. <view>证明材料-供应端</view>
  46. <view class="lf-flex-wrap lf-m-t-10">
  47. <image :src="item" @click="lookImage(index, 'supplier_voucher')" class="ms-img" v-for="(item, index) in supplier_voucher" :key="index"></image>
  48. </view>
  49. </view>
  50. <view class="list" v-if="canteen_voucher.length">
  51. <view>证明材料-食堂端</view>
  52. <view class="lf-flex-wrap lf-m-t-10">
  53. <image :src="item" @click="lookImage(index, 'canteen_voucher')" class="ms-img" v-for="(item, index) in canteen_voucher" :key="index"></image>
  54. </view>
  55. </view>
  56. </view>
  57. <self-line></self-line>
  58. <view class="lf-m-t-30 lf-m-l-32 lf-m-r-32">
  59. <view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">物资明细</view>
  60. <wyb-table :first-line-fixed="true" contentBgColor="#ecfaf5" :headers="headers" :contents="contents" width="max-content" height="80vh"></wyb-table>
  61. </view>
  62. <view style="height: 140rpx;"></view>
  63. <!-- 操作按钮 -->
  64. <view class="fixed-bottom" v-if="type && type != '备货中'">
  65. <view v-if="type == '待发单'" class="lf-row-flex-end">
  66. <button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=1')">编辑</button>
  67. <button class="btn btn2" @click="orderStateChange('待接单')">立即发单</button>
  68. </view>
  69. <view v-else-if="type == '待接单'" class="lf-row-flex-end">
  70. <button class="btn btn2" style="background-color: #FF0000;" @click="orderStateChange('已撤销')">撤销订单</button>
  71. </view>
  72. <view v-else-if="type == '已发货'" class="lf-row-flex-end">
  73. <button class="btn btn1" @click="orderStateChange('已退单')">退单</button>
  74. <button class="btn btn2" @click="$url('/pages/purchase/receipt?p_sn='+ order.p_sn)">清点物资</button>
  75. </view>
  76. <view v-else-if="type == '已收货' || type == '已入库'" class="lf-row-between">
  77. <button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=2')">复用采购单</button>
  78. <view class="lf-font-32" style="color: #11D189;">{{order.state}}</view>
  79. </view>
  80. <view v-else-if="type == '已撤销'" class="lf-row-between">
  81. <button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=2')">复用采购单</button>
  82. <view class="lf-font-32" style="color: #ff0000;">{{ type }}</view>
  83. </view>
  84. <view v-else class="lf-row-flex-end">
  85. <view class="lf-font-32">{{ type }}</view>
  86. </view>
  87. </view>
  88. </block>
  89. </view>
  90. </template>
  91. <script>
  92. import wybTable from '@/components/wyb-table/wyb-table';
  93. export default {
  94. components: { wybTable },
  95. data(){
  96. return {
  97. headers: [{
  98. key: 'name',
  99. label: '物资名称'
  100. },{
  101. key: 'spec',
  102. label: '规格'
  103. },{
  104. label: '单位',
  105. key: 'unit'
  106. },{
  107. label: '分类',
  108. key: 'category'
  109. },{
  110. key: 'brand',
  111. label: '品牌'
  112. },{
  113. key: 'quality_level',
  114. label: '品级'
  115. },{
  116. label: '编号',
  117. key: 'm_sn'
  118. },{
  119. label: '供应商',
  120. key: 'supplier_name'
  121. },{
  122. key: 'pre_tax_price',
  123. label: '税前价格'
  124. },{
  125. key: 'total_tax_amount',
  126. label: '含税合计'
  127. },{
  128. key: 'after_tax_price',
  129. label: '税后价格'
  130. },{
  131. key: 'total_non_tax_amount',
  132. label: '不含税合计'
  133. },{
  134. key: 'purchase_limit',
  135. label: '起购数'
  136. },{
  137. key: 'purchase_number',
  138. label: '采购数量'
  139. }],
  140. contents: [],
  141. order: {},
  142. p_sn: '',
  143. type: '',
  144. is_show_voucher: false,
  145. voucher_list: [],
  146. voucher_count: 6,
  147. show_count: 0,
  148. canteen_voucher: [], // 食堂端凭证
  149. supplier_voucher: [] // 供应端凭证
  150. }
  151. },
  152. onLoad(options){
  153. this.p_sn = options.p_sn || '';
  154. this.getData();
  155. },
  156. onShow(){
  157. this.show_count++;
  158. if(this.show_count > 1){
  159. this.getData();
  160. }
  161. },
  162. methods: {
  163. // 拨打电话
  164. call(phone) {
  165. uni.makePhoneCall({
  166. phoneNumber: String(phone)
  167. });
  168. },
  169. getData(){
  170. this.$http(this.API.API_CANTEEN_PURCHASEDETAIL, {
  171. p_sn: this.p_sn
  172. }).then(res => {
  173. let order = res.data.order;
  174. order.state_log.forEach((item, index) => {
  175. item.isFinished = false;
  176. if(index == order.state_log.length - 1){
  177. let actionState = [
  178. '订单已完成',
  179. '订单已退款',
  180. '订单已撤销',
  181. '订单已确认,物资入库'
  182. ];
  183. if(actionState.includes(item.action)){
  184. item.isFinished = true;
  185. }
  186. }
  187. })
  188. let supplier_voucher = [];
  189. let canteen_voucher = [];
  190. order.voucher.map(item => {
  191. if(item.client_type == '供应商'){
  192. supplier_voucher.push(item.voucher_pic);
  193. }else if(item.client_type == '食堂'){
  194. canteen_voucher.push(item.voucher_pic);
  195. }
  196. })
  197. this.supplier_voucher = supplier_voucher;
  198. this.canteen_voucher = canteen_voucher;
  199. this.order = order;
  200. let list = order.items || [];
  201. let contents = list.map(item => {
  202. return {
  203. name: item?.material?.m_name,
  204. spec: item?.spec?.name,
  205. brand: item?.material?.brand,
  206. quality_level: item?.material?.quality_level,
  207. m_sn: item?.material?.m_sn,
  208. supplier_name: order?.supplier?.supplier_name,
  209. pre_tax_price: item.total_tax_amount,
  210. after_tax_price: item.total_non_tax_amount,
  211. purchase_limit: item?.p_order_item.purchase_limit,
  212. purchase_number: item.purchase_number,
  213. unit: item?.material?.unit?.unit_name || '',
  214. category: item?.material?.category?.m_cate_name || '',
  215. total_tax_amount: item.total_tax_amount,
  216. total_non_tax_amount: item.total_non_tax_amount
  217. }
  218. })
  219. this.contents = contents;
  220. this.type = order.state;
  221. }).catch(err => this.$toBack());
  222. },
  223. // 预览图片
  224. lookImage(index, list){
  225. if(this[list].length <= 0) return;
  226. this.$u.throttle(() => {
  227. uni.previewImage({
  228. urls: this[list],
  229. current: index
  230. })
  231. }, 500);
  232. },
  233. // 改变订单状态
  234. orderStateChange(state){
  235. let that = this;
  236. if(state == '已退单'){
  237. uni.showModal({
  238. title: '温馨提示',
  239. content: '退单前请与供应商协商,以免造成损失!确定继续退单操作吗?',
  240. confirmColor: '#FF0000',
  241. cancelColor: '#11D189',
  242. success: result => {
  243. if(result.confirm){
  244. $change();
  245. }
  246. }
  247. })
  248. }else{
  249. $change();
  250. }
  251. function $change(){
  252. that.$http(that.API.API_CANTEEN_PURCHASEUPDATE, {
  253. p_sn: that.p_sn,
  254. state: state
  255. }).then(res => {
  256. that.$msg('操作成功').then(()=> that.getData());
  257. })
  258. }
  259. }
  260. }
  261. }
  262. </script>
  263. <style lang="scss" scoped="scoped">
  264. .head{
  265. padding: 0 32rpx;
  266. width: 750rpx;
  267. box-sizing: border-box;
  268. height: auto;
  269. .list{
  270. padding: 30rpx 0;
  271. // border-bottom: 1rpx solid #e5e5e5;
  272. font-size: 28rpx;
  273. color: #555555;
  274. &:last-child{
  275. border-bottom: none;
  276. }
  277. .image{
  278. width: 140rpx;
  279. height: 140rpx;
  280. border-radius: 10rpx;
  281. background-color: #EEEEEE;
  282. }
  283. .info{
  284. display: flex;
  285. flex-direction: column;
  286. justify-content: space-around;
  287. width: 530rpx;
  288. height: 140rpx;
  289. }
  290. }
  291. }
  292. .fixed-bottom{
  293. position: fixed;
  294. bottom: 0rpx;
  295. left: 0rpx;
  296. z-index: 99;
  297. width: 750rpx;
  298. height: 98rpx;
  299. display: flex;
  300. // justify-content: flex-end;
  301. align-items: center;
  302. border-top: 1rpx solid #E5E5E5;
  303. background-color: #FFFFFF;
  304. box-sizing: border-box;
  305. padding: 0 32rpx;
  306. .btn{
  307. width: 212rpx;
  308. height: 82rpx;
  309. border-radius: 41rpx;
  310. margin: 0;
  311. padding: 0;
  312. font-size: 32rpx;
  313. display: flex;
  314. justify-content: center;
  315. align-items: center;
  316. }
  317. .btn1{
  318. border: 2rpx solid #555555;
  319. opacity: .5;
  320. }
  321. .btn2{
  322. background: #11D189;
  323. color: #FFFFFF;
  324. margin-left: 20rpx;
  325. }
  326. }
  327. .fixed-bottom>view{
  328. width: 100%;
  329. }
  330. .ms-img{
  331. width: 160rpx;
  332. height: 160rpx;
  333. margin-right: 15rpx;
  334. margin-top: 15rpx;
  335. background-color: #EEEEEE;
  336. &:nth-of-type(4n){
  337. margin-right: 0rpx;
  338. }
  339. }
  340. </style>