自主项目,食堂系统,前端uniapp
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.

222 lines
5.7 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"></view>
  25. </view>
  26. <view class="lf-row-between list">
  27. <view>司机</view>
  28. <view class="lf-font-bold"></view>
  29. </view>
  30. <view class="lf-row-between list">
  31. <view>联系电话</view>
  32. <view class="lf-font-bold"></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>
  41. <self-line></self-line>
  42. <view class="lf-m-t-30 lf-m-l-32">
  43. <view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">物资明细</view>
  44. <wyb-table :first-line-fixed="true" contentBgColor="#ecfaf5" :headers="headers" :contents="contents" width="max-content" height="350rpx"></wyb-table>
  45. </view>
  46. <view style="height: 100rpx;"></view>
  47. <!-- 操作按钮 -->
  48. <view class="fixed-bottom" v-if="type != 3">
  49. <view v-if="type == 1" class="lf-row-flex-end">
  50. <button class="btn btn1">编辑</button>
  51. <button class="btn btn2">立即发单</button>
  52. </view>
  53. <view v-else-if="type == 2" class="lf-row-flex-end">
  54. <button class="btn btn2" style="background-color: #FF0000;">撤销订单</button>
  55. </view>
  56. <view v-else-if="type == 4" class="lf-row-flex-end">
  57. <button class="btn btn1">退单</button>
  58. <button class="btn btn2" @click="$url('/pages/canteen/purchase/receipt?p_sn='+ order.p_sn)">确认收货</button>
  59. </view>
  60. <view v-else-if="type == 5" class="lf-row-between">
  61. <button class="btn btn1">复用采购单</button>
  62. <view class="lf-font-32" style="color: #11D189;">已完成</view>
  63. </view>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. import lfYsteps from '@/components/lf-ysteps/lf-ysteps';
  69. import wybTable from '@/components/wyb-table/wyb-table';
  70. export default {
  71. components: { lfYsteps, wybTable },
  72. data(){
  73. return {
  74. headers: [{
  75. key: 'name',
  76. label: '菜名'
  77. },{
  78. key: 'spec',
  79. label: '规格'
  80. },{
  81. key: 'pre_tax_price',
  82. label: '税前价格'
  83. },{
  84. key: 'after_tax_price',
  85. label: '税后价格'
  86. }],
  87. contents: [],
  88. order: {},
  89. p_sn: '',
  90. type: 4
  91. }
  92. },
  93. onLoad(options){
  94. this.p_sn = options.p_sn || '';
  95. // TODO 显示车辆等信息,显示table信息
  96. this.getData();
  97. },
  98. methods: {
  99. getData(){
  100. this.$http(this.API.API_CANTEEN_PURCHASEDETAIL, {
  101. p_sn: this.p_sn
  102. // p_sn: '802316269455228606'
  103. }).then(res => {
  104. console.log("xxx",res)
  105. this.order = res.data.order;
  106. let list = res.data.order.sheet || [];
  107. let contents = list.map(item => {
  108. return {
  109. name: item.material.m_name,
  110. spec: item.spec.name,
  111. pre_tax_price: {edit: true, value: item.tax_standard_price},
  112. after_tax_price: {edit: true, value: item.non_tax_standard_price},
  113. spec_id: item.spec.id,
  114. material_id: item.material.id
  115. }
  116. })
  117. this.contents = contents;
  118. })
  119. },
  120. // 预览图片
  121. lookImage(index){
  122. this.$u.throttle(() => {
  123. let images = this.order.voucher.map(item => item.voucher_pic);
  124. uni.previewImage({
  125. urls: images,
  126. current: index
  127. })
  128. }, 200);
  129. },
  130. // 改变订单状态 TODO
  131. orderStateChange(state){
  132. this.$http(this.API.API_CANTEEN_PURCHASEUPDATE, {
  133. p_sn: this.p_sn,
  134. state: state
  135. }).then(res => {
  136. console.log("orderStateChange", res);
  137. this.$msg('操作成功');
  138. })
  139. }
  140. }
  141. }
  142. </script>
  143. <style lang="scss" scoped="scoped">
  144. .head{
  145. padding: 0 32rpx;
  146. width: 750rpx;
  147. box-sizing: border-box;
  148. height: auto;
  149. .list{
  150. padding: 30rpx 0;
  151. border-bottom: 1rpx solid #e5e5e5;
  152. font-size: 28rpx;
  153. color: #555555;
  154. &:last-child{
  155. border-bottom: none;
  156. }
  157. .image{
  158. width: 140rpx;
  159. height: 140rpx;
  160. border-radius: 10rpx;
  161. background-color: #EEEEEE;
  162. }
  163. .info{
  164. display: flex;
  165. flex-direction: column;
  166. justify-content: space-around;
  167. width: 530rpx;
  168. height: 140rpx;
  169. }
  170. }
  171. }
  172. .fixed-bottom{
  173. position: fixed;
  174. bottom: 0rpx;
  175. left: 0rpx;
  176. z-index: 99;
  177. width: 750rpx;
  178. height: 98rpx;
  179. display: flex;
  180. // justify-content: flex-end;
  181. align-items: center;
  182. border-top: 1rpx solid #E5E5E5;
  183. background-color: #FFFFFF;
  184. box-sizing: border-box;
  185. padding: 0 32rpx;
  186. .btn{
  187. width: 212rpx;
  188. height: 82rpx;
  189. border-radius: 41rpx;
  190. margin: 0;
  191. padding: 0;
  192. font-size: 32rpx;
  193. display: flex;
  194. justify-content: center;
  195. align-items: center;
  196. }
  197. .btn1{
  198. border: 2rpx solid #555555;
  199. opacity: .5;
  200. }
  201. .btn2{
  202. background: #11D189;
  203. color: #FFFFFF;
  204. margin-left: 20rpx;
  205. }
  206. }
  207. .fixed-bottom>view{
  208. width: 100%;
  209. }
  210. .ms-img{
  211. width: 160rpx;
  212. height: 160rpx;
  213. margin-right: 15rpx;
  214. margin-top: 15rpx;
  215. background-color: #EEEEEE;
  216. &:nth-of-type(4n){
  217. margin-right: 0rpx;
  218. }
  219. }
  220. </style>