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

237 lines
5.8 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. 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. ];
  122. if(actionState.includes(item.action)){
  123. item.isFinished = true;
  124. }
  125. }
  126. return item;
  127. })
  128. let list = res.data.sheet || [];
  129. let contents = list.map(item => {
  130. console.log(item)
  131. return {
  132. material_name: item.material.m_name,
  133. spec_name: item.spec.name,
  134. brand: item.material.brand,
  135. quality_level: item.material.quality_level,
  136. m_sn: item.material.m_sn,
  137. supplier_name: item.purchase.supplier.supplier_name,
  138. purchase_id: item.purchase_id,
  139. delivery_number: item.out_number
  140. }
  141. })
  142. this.contents = contents;
  143. console.log(this.contents)
  144. this.type = res.data.state
  145. })
  146. },
  147. // 改变订单状态
  148. orderStateChange(state){
  149. this.$http(this.API.API_CANTEEN_WAREHOUSEUPDATE, {
  150. w_sn: this.o_sn,
  151. state: state
  152. }).then(res => {
  153. console.log("res", res);
  154. this.$msg('操作成功');
  155. this.getData();
  156. })
  157. }
  158. }
  159. }
  160. </script>
  161. <style lang="scss" scoped="scoped">
  162. .head{
  163. padding: 0 32rpx;
  164. width: 750rpx;
  165. box-sizing: border-box;
  166. height: auto;
  167. .list{
  168. padding: 30rpx 0;
  169. // border-bottom: 1rpx solid #e5e5e5;
  170. font-size: 28rpx;
  171. color: #555555;
  172. &:last-child{
  173. border-bottom: none;
  174. }
  175. .image{
  176. width: 140rpx;
  177. height: 140rpx;
  178. border-radius: 10rpx;
  179. }
  180. .info{
  181. display: flex;
  182. flex-direction: column;
  183. justify-content: space-around;
  184. width: 530rpx;
  185. height: 140rpx;
  186. }
  187. }
  188. }
  189. .fixed-bottom{
  190. position: fixed;
  191. bottom: 0rpx;
  192. left: 0rpx;
  193. z-index: 99;
  194. width: 750rpx;
  195. height: 98rpx;
  196. display: flex;
  197. justify-content: flex-end;
  198. align-items: center;
  199. border-top: 1rpx solid #E5E5E5;
  200. background-color: #FFFFFF;
  201. box-sizing: border-box;
  202. padding: 0 32rpx;
  203. .btn{
  204. width: 212rpx;
  205. height: 82rpx;
  206. border-radius: 41rpx;
  207. margin: 0;
  208. padding: 0;
  209. font-size: 32rpx;
  210. display: flex;
  211. justify-content: center;
  212. align-items: center;
  213. }
  214. .btn1{
  215. border: 2rpx solid #555555;
  216. opacity: .5;
  217. }
  218. .btn2{
  219. background: #11D189;
  220. color: #FFFFFF;
  221. margin-left: 20rpx;
  222. }
  223. }
  224. .ms-img{
  225. width: 160rpx;
  226. height: 160rpx;
  227. margin-right: 15rpx;
  228. margin-top: 15rpx;
  229. &:nth-of-type(4n){
  230. margin-right: 0rpx;
  231. }
  232. }
  233. </style>