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

240 lines
5.8 KiB

  1. <template>
  2. <view v-if="$isRight(order)">
  3. <view class="head lf-plr-32">
  4. <view class="lf-row-between lf-color-gray list" style="border-bottom: 1rpx solid #e5e5e5;">
  5. <view>采购单 {{order.sheet[0].purchase.p_sn}}</view>
  6. </view>
  7. </view>
  8. <view class="list">
  9. <lf-stepbar :list="stepList" themeColor="#11D189"></lf-stepbar>
  10. </view>
  11. <self-line></self-line>
  12. <view class="head lf-plr-32">
  13. <view class="lf-row-between list">
  14. <view>申请人</view>
  15. <view class="lf-font-bold">{{order.sheet[0].purchase.contact_name}}</view>
  16. </view>
  17. <view class="lf-row-between list" @click="call(order.sheet[0].purchase.contact_phone)">
  18. <view>联系电话</view>
  19. <view class="lf-font-bold" style="color: rgb(17, 209, 137);">{{order.sheet[0].purchase.contact_phone}}</view>
  20. </view>
  21. </view>
  22. <self-line></self-line>
  23. <view class="lf-m-t-30 lf-m-l-32">
  24. <view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">物资明细</view>
  25. <wyb-table :first-line-fixed="true" contentBgColor="#ecfaf5" :headers="headers" :contents="contents" width="100%" height="80vh"></wyb-table>
  26. </view>
  27. <view style="height: 140rpx;"></view>
  28. <!-- 操作按钮 -->
  29. <view class="fixed-bottom">
  30. <view v-if="type == '待确认'" class="lf-row-flex-end" style="justify-content: space-between;width: 100%;">
  31. <button class="btn btn1" @click="$url('/pages/delivery/apply?o_sn='+ o_sn+'&enter_type=1')">编辑</button>
  32. <button class="btn btn2" @click="orderStateChange('已确认')">立即申请</button>
  33. </view>
  34. <view v-else-if="type == '已出库'" class="lf-row-between" style="justify-content: space-between;width: 100%;">
  35. <button class="btn btn1" @click="$url('/pages/delivery/apply?o_sn='+ o_sn+'&enter_type=2')">复用出库单</button>
  36. <view class="lf-font-32" style="color: #11D189;">已出库</view>
  37. </view>
  38. <view v-else class="lf-row-between">
  39. <view></view>
  40. <view class="lf-font-32" style="color: #1833F2;">{{type}}</view>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import wybTable from '@/components/wyb-table/wyb-table';
  47. export default {
  48. components: { wybTable },
  49. data(){
  50. return {
  51. stepList: [],
  52. headers: [{
  53. label: '物资名称',
  54. key: 'material_name'
  55. },{
  56. label: '规格',
  57. key: 'spec_name'
  58. },{
  59. label: '单位',
  60. key: 'unit'
  61. },{
  62. label: '分类',
  63. key: 'category'
  64. },{
  65. key: 'brand',
  66. label: '品牌'
  67. },{
  68. key: 'quality_level',
  69. label: '品级'
  70. },{
  71. label: '编号',
  72. key: 'm_sn'
  73. },{
  74. label: '供应商',
  75. key: 'supplier_name'
  76. },{
  77. label: '批次',
  78. key: 'purchase_id'
  79. },{
  80. key: 'delivery_number',
  81. label: '出库数量'
  82. }],
  83. contents: [],
  84. o_sn: '',
  85. order: {},
  86. type: 4,
  87. show_count: 0
  88. }
  89. },
  90. onLoad(options){
  91. this.o_sn = options.id || '';
  92. this.getData();
  93. },
  94. onShow(){
  95. this.show_count++;
  96. if(this.show_count > 1){
  97. this.getData();
  98. }
  99. },
  100. methods: {
  101. call(phone) {
  102. uni.makePhoneCall({
  103. phoneNumber: phone //仅为示例
  104. });
  105. },
  106. getData(){
  107. this.$http(this.API.API_CANTEEN_OUTDETAIL, {
  108. o_sn: this.o_sn
  109. }).then(res => {
  110. this.order = res.data;
  111. this.stepList = this.order.state_log.map((item, index) => {
  112. item.isFinished = false;
  113. if(index == this.order.state_log.length - 1){
  114. let actionState = [
  115. '订单已完成',
  116. '订单已退款',
  117. '订单已撤销'
  118. ];
  119. if(actionState.includes(item.action)){
  120. item.isFinished = true;
  121. }
  122. }
  123. return item;
  124. })
  125. let list = res.data.sheet || [];
  126. let contents = list.map(item => {
  127. console.log(item)
  128. return {
  129. material_name: item.material.m_name,
  130. spec_name: item.spec.name,
  131. brand: item.material.brand,
  132. quality_level: item.material.quality_level,
  133. m_sn: item.material.m_sn,
  134. supplier_name: item.purchase.supplier.supplier_name,
  135. purchase_id: item.purchase_id,
  136. delivery_number: item.out_number,
  137. unit: item?.material?.unit?.unit_name || '',
  138. category: item?.material?.category?.m_cate_name || ''
  139. }
  140. })
  141. this.contents = contents;
  142. console.log(this.contents)
  143. this.type = res.data.state
  144. })
  145. },
  146. // 改变订单状态
  147. orderStateChange(state){
  148. this.$http(this.API.API_CANTEEN_WAREHOUSEUPDATE, {
  149. w_sn: this.o_sn,
  150. state: state
  151. }).then(res => {
  152. console.log("res", res);
  153. this.$msg('操作成功');
  154. this.getData();
  155. })
  156. }
  157. }
  158. }
  159. </script>
  160. <style lang="scss" scoped="scoped">
  161. .lf-plr-32{
  162. padding-left: 32rpx !important;
  163. padding-right: 32rpx !important;
  164. }
  165. .head{
  166. // padding: 0 32rpx;
  167. width: 750rpx;
  168. box-sizing: border-box;
  169. height: auto;
  170. .list{
  171. padding: 30rpx 0;
  172. border-bottom: 1rpx solid #e5e5e5;
  173. font-size: 28rpx;
  174. color: #555555;
  175. &:last-child{
  176. border-bottom: none;
  177. }
  178. .image{
  179. width: 140rpx;
  180. height: 140rpx;
  181. border-radius: 10rpx;
  182. }
  183. .info{
  184. display: flex;
  185. flex-direction: column;
  186. justify-content: space-around;
  187. width: 530rpx;
  188. height: 140rpx;
  189. }
  190. }
  191. }
  192. .fixed-bottom{
  193. position: fixed;
  194. bottom: 0rpx;
  195. left: 0rpx;
  196. z-index: 99;
  197. width: 750rpx;
  198. height: 98rpx;
  199. display: flex;
  200. justify-content: flex-end;
  201. align-items: center;
  202. border-top: 1rpx solid #E5E5E5;
  203. background-color: #FFFFFF;
  204. box-sizing: border-box;
  205. padding: 0 32rpx;
  206. .btn{
  207. width: 212rpx;
  208. height: 82rpx;
  209. border-radius: 41rpx;
  210. margin: 0;
  211. padding: 0;
  212. font-size: 32rpx;
  213. display: flex;
  214. justify-content: center;
  215. align-items: center;
  216. }
  217. .btn1{
  218. border: 2rpx solid #555555;
  219. opacity: .5;
  220. }
  221. .btn2{
  222. background: #11D189;
  223. color: #FFFFFF;
  224. margin-left: 20rpx;
  225. }
  226. }
  227. .ms-img{
  228. width: 160rpx;
  229. height: 160rpx;
  230. margin-right: 15rpx;
  231. margin-top: 15rpx;
  232. &:nth-of-type(4n){
  233. margin-right: 0rpx;
  234. }
  235. }
  236. </style>