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

241 lines
5.9 KiB

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