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

228 lines
5.5 KiB

  1. <template>
  2. <view v-if="$isRight(order)">
  3. <view class="head">
  4. <view class="lf-row-between lf-color-gray list">
  5. <view>采购单 {{order.sheet[0].purchase.p_sn}}</view>
  6. </view>
  7. <view class="list">
  8. <lf-stepbar :list="stepList" themeColor="#11D189"></lf-stepbar>
  9. </view>
  10. </view>
  11. <self-line></self-line>
  12. <view class="head">
  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. key: 'brand',
  60. label: '品牌'
  61. },{
  62. key: 'quality_level',
  63. label: '品级'
  64. },{
  65. label: '编号',
  66. key: 'm_sn'
  67. },{
  68. label: '供应商',
  69. key: 'supplier_name'
  70. },{
  71. label: '批次',
  72. key: 'purchase_id'
  73. },{
  74. key: 'delivery_number',
  75. label: '出库数量'
  76. }],
  77. contents: [],
  78. o_sn: '',
  79. order: {},
  80. type: 4,
  81. show_count: 0
  82. }
  83. },
  84. onLoad(options){
  85. this.o_sn = options.id || '';
  86. this.getData();
  87. },
  88. onShow(){
  89. this.show_count++;
  90. if(this.show_count > 1){
  91. this.getData();
  92. }
  93. },
  94. methods: {
  95. call(phone) {
  96. uni.makePhoneCall({
  97. phoneNumber: phone //仅为示例
  98. });
  99. },
  100. getData(){
  101. this.$http(this.API.API_CANTEEN_OUTDETAIL, {
  102. o_sn: this.o_sn
  103. }).then(res => {
  104. this.order = res.data;
  105. this.stepList = this.order.state_log.map((item, index) => {
  106. item.isFinished = false;
  107. if(index == this.order.state_log.length - 1){
  108. let actionState = [
  109. '订单已完成',
  110. '订单已退款',
  111. '订单已撤销'
  112. ];
  113. if(actionState.includes(item.action)){
  114. item.isFinished = true;
  115. }
  116. }
  117. return item;
  118. })
  119. let list = res.data.sheet || [];
  120. let contents = list.map(item => {
  121. console.log(item)
  122. return {
  123. material_name: item.material.m_name,
  124. spec_name: item.spec.name,
  125. brand: item.material.brand,
  126. quality_level: item.material.quality_level,
  127. m_sn: item.material.m_sn,
  128. supplier_name: item.purchase.supplier.supplier_name,
  129. purchase_id: item.purchase_id,
  130. delivery_number: item.out_number
  131. }
  132. })
  133. this.contents = contents;
  134. console.log(this.contents)
  135. this.type = res.data.state
  136. })
  137. },
  138. // 改变订单状态
  139. orderStateChange(state){
  140. this.$http(this.API.API_CANTEEN_WAREHOUSEUPDATE, {
  141. w_sn: this.o_sn,
  142. state: state
  143. }).then(res => {
  144. console.log("res", res);
  145. this.$msg('操作成功');
  146. this.getData();
  147. })
  148. }
  149. }
  150. }
  151. </script>
  152. <style lang="scss" scoped="scoped">
  153. .head{
  154. padding: 0 32rpx;
  155. width: 750rpx;
  156. box-sizing: border-box;
  157. height: auto;
  158. .list{
  159. padding: 30rpx 0;
  160. border-bottom: 1rpx solid #e5e5e5;
  161. font-size: 28rpx;
  162. color: #555555;
  163. &:last-child{
  164. border-bottom: none;
  165. }
  166. .image{
  167. width: 140rpx;
  168. height: 140rpx;
  169. border-radius: 10rpx;
  170. }
  171. .info{
  172. display: flex;
  173. flex-direction: column;
  174. justify-content: space-around;
  175. width: 530rpx;
  176. height: 140rpx;
  177. }
  178. }
  179. }
  180. .fixed-bottom{
  181. position: fixed;
  182. bottom: 0rpx;
  183. left: 0rpx;
  184. z-index: 99;
  185. width: 750rpx;
  186. height: 98rpx;
  187. display: flex;
  188. justify-content: flex-end;
  189. align-items: center;
  190. border-top: 1rpx solid #E5E5E5;
  191. background-color: #FFFFFF;
  192. box-sizing: border-box;
  193. padding: 0 32rpx;
  194. .btn{
  195. width: 212rpx;
  196. height: 82rpx;
  197. border-radius: 41rpx;
  198. margin: 0;
  199. padding: 0;
  200. font-size: 32rpx;
  201. display: flex;
  202. justify-content: center;
  203. align-items: center;
  204. }
  205. .btn1{
  206. border: 2rpx solid #555555;
  207. opacity: .5;
  208. }
  209. .btn2{
  210. background: #11D189;
  211. color: #FFFFFF;
  212. margin-left: 20rpx;
  213. }
  214. }
  215. .ms-img{
  216. width: 160rpx;
  217. height: 160rpx;
  218. margin-right: 15rpx;
  219. margin-top: 15rpx;
  220. &:nth-of-type(4n){
  221. margin-right: 0rpx;
  222. }
  223. }
  224. </style>