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

236 lines
5.8 KiB

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