自主产品,供应链食堂系统。将两个端拆开了。
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.0 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">
  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 lf-m-r-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. label: '单位',
  68. key: 'unit'
  69. },{
  70. label: '分类',
  71. key: 'category'
  72. },{
  73. key: 'brand',
  74. label: '品牌'
  75. },{
  76. key: 'quality_level',
  77. label: '品级'
  78. },{
  79. label: '编号',
  80. key: 'm_sn'
  81. },{
  82. label: '供应商',
  83. key: 'supplier_name'
  84. },{
  85. label: '批次',
  86. key: 'purchase_id'
  87. },{
  88. key: 'delivery_number',
  89. label: '出库数量'
  90. }],
  91. contents: [],
  92. o_sn: '',
  93. order: {},
  94. type: 4,
  95. show_count: 0
  96. }
  97. },
  98. onLoad(options){
  99. this.o_sn = options.id || '';
  100. this.getData();
  101. },
  102. onShow(){
  103. this.show_count++;
  104. if(this.show_count > 1){
  105. this.getData();
  106. }
  107. },
  108. methods: {
  109. call(phone) {
  110. uni.makePhoneCall({
  111. phoneNumber: phone //仅为示例
  112. });
  113. },
  114. getData(){
  115. this.$http(this.API.API_CANTEEN_OUTDETAIL, {
  116. o_sn: this.o_sn
  117. }).then(res => {
  118. this.order = res.data;
  119. this.stepList = this.order.state_log.map((item, index) => {
  120. item.isFinished = false;
  121. if(index == this.order.state_log.length - 1){
  122. let actionState = [
  123. '订单已完成',
  124. '订单已退款',
  125. '订单已撤销',
  126. '已出库'
  127. ];
  128. if(actionState.includes(item.action)){
  129. item.isFinished = true;
  130. }
  131. }
  132. return item;
  133. })
  134. let list = res.data.sheet || [];
  135. let contents = list.map(item => {
  136. console.log(item)
  137. return {
  138. material_name: item.material.m_name,
  139. spec_name: item.spec.name,
  140. brand: item.material.brand,
  141. quality_level: item.material.quality_level,
  142. m_sn: item.material.m_sn,
  143. supplier_name: item.purchase.supplier.supplier_name,
  144. purchase_id: item.purchase_id,
  145. delivery_number: item.out_number,
  146. unit: item?.material?.unit?.unit_name || '',
  147. category: item?.material?.category?.m_cate_name || ''
  148. }
  149. })
  150. this.contents = contents;
  151. console.log(this.contents)
  152. this.type = res.data.state
  153. })
  154. },
  155. // 改变订单状态
  156. orderStateChange(state){
  157. this.$http(this.API.API_CANTEEN_WAREHOUSEUPDATE, {
  158. w_sn: this.o_sn,
  159. state: state
  160. }).then(res => {
  161. console.log("res", res);
  162. this.$msg('操作成功');
  163. this.getData();
  164. })
  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>