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

245 lines
6.1 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" :class="{'lf-btn-disabled': button_click}" @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. button_click: false
  93. }
  94. },
  95. onLoad(options){
  96. this.o_sn = options.id || '';
  97. this.getData();
  98. },
  99. onShow(){
  100. this.show_count++;
  101. if(this.show_count > 1){
  102. this.getData();
  103. }
  104. },
  105. methods: {
  106. call(phone) {
  107. uni.makePhoneCall({
  108. phoneNumber: phone //仅为示例
  109. });
  110. },
  111. getData(){
  112. this.$http(this.API.API_CANTEEN_OUTDETAIL, {
  113. o_sn: this.o_sn
  114. }).then(res => {
  115. this.order = res.data;
  116. this.stepList = this.order.state_log.map((item, index) => {
  117. item.isFinished = false;
  118. if(index == this.order.state_log.length - 1){
  119. let actionState = [
  120. '订单已完成',
  121. '订单已退款',
  122. '订单已撤销',
  123. '已出库'
  124. ];
  125. if(actionState.includes(item.action)){
  126. item.isFinished = true;
  127. }
  128. }
  129. return item;
  130. })
  131. let list = res.data.sheet || [];
  132. let contents = list.map(item => {
  133. console.log(item)
  134. return {
  135. material_name: item.material.m_name,
  136. spec_name: item.spec.name,
  137. brand: item.material.brand,
  138. quality_level: item.material.quality_level,
  139. m_sn: item.material.m_sn,
  140. supplier_name: item.purchase.supplier.supplier_name,
  141. purchase_id: item.purchase.batch_sn,
  142. delivery_number: item.out_number,
  143. unit: item?.material?.unit?.unit_name || '',
  144. category: item?.material?.category?.m_cate_name || ''
  145. }
  146. })
  147. this.contents = contents;
  148. console.log(this.contents)
  149. this.type = res.data.state
  150. })
  151. },
  152. // 改变订单状态
  153. orderStateChange(state){
  154. if(this.button_click) return;
  155. this.button_click = true;
  156. this.$http(this.API.API_CANTEEN_WAREHOUSEUPDATE, {
  157. w_sn: this.o_sn,
  158. state: state
  159. }).then(res => {
  160. console.log("res", res);
  161. this.$msg('操作成功');
  162. this.button_click = false;
  163. this.getData();
  164. }).catch(err => this.button_click = false);
  165. }
  166. }
  167. }
  168. </script>
  169. <style lang="scss" scoped="scoped">
  170. .head{
  171. padding: 0 32rpx;
  172. width: 750rpx;
  173. box-sizing: border-box;
  174. height: auto;
  175. .list{
  176. padding: 30rpx 0;
  177. // border-bottom: 1rpx solid #e5e5e5;
  178. font-size: 28rpx;
  179. color: #555555;
  180. &:last-child{
  181. border-bottom: none;
  182. }
  183. .image{
  184. width: 140rpx;
  185. height: 140rpx;
  186. border-radius: 10rpx;
  187. }
  188. .info{
  189. display: flex;
  190. flex-direction: column;
  191. justify-content: space-around;
  192. width: 530rpx;
  193. height: 140rpx;
  194. }
  195. }
  196. }
  197. .fixed-bottom{
  198. position: fixed;
  199. bottom: 0rpx;
  200. left: 0rpx;
  201. z-index: 99;
  202. width: 750rpx;
  203. height: 98rpx;
  204. display: flex;
  205. justify-content: flex-end;
  206. align-items: center;
  207. border-top: 1rpx solid #E5E5E5;
  208. background-color: #FFFFFF;
  209. box-sizing: border-box;
  210. padding: 0 32rpx;
  211. .btn{
  212. width: 212rpx;
  213. height: 82rpx;
  214. border-radius: 41rpx;
  215. margin: 0;
  216. padding: 0;
  217. font-size: 32rpx;
  218. display: flex;
  219. justify-content: center;
  220. align-items: center;
  221. }
  222. .btn1{
  223. border: 2rpx solid #555555;
  224. opacity: .5;
  225. }
  226. .btn2{
  227. background: #11D189;
  228. color: #FFFFFF;
  229. margin-left: 20rpx;
  230. }
  231. }
  232. .ms-img{
  233. width: 160rpx;
  234. height: 160rpx;
  235. margin-right: 15rpx;
  236. margin-top: 15rpx;
  237. &:nth-of-type(4n){
  238. margin-right: 0rpx;
  239. }
  240. }
  241. </style>