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

300 lines
7.7 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <template>
  2. <view class="content">
  3. <view class="card" v-for="(item, index) in list" :key="index">
  4. <view class="lf-row-between">
  5. <view class="lf-color-black lf-font-bold" v-if="item.material.m_name">{{ item.material.m_name }}</view>
  6. <!-- 修改功能先隐藏 -->
  7. <!-- <view style="color: #11D189;" @click="showEdit">修改</view> -->
  8. </view>
  9. <view class="lf-row-between lf-m-t-30">
  10. <view>订购数</view>
  11. <view class="lf-color-black">{{ item.purchase_number }}</view>
  12. </view>
  13. <view class="lf-row-between lf-m-t-30">
  14. <view>实到数</view>
  15. <view class="lf-flex">
  16. <input class="input" placeholder="0" type="number" v-model="item.reachNum" @blur="inputBlur(index, 'real_reach_number', $event)" />
  17. <text class="lf-color-black"></text>
  18. </view>
  19. </view>
  20. <view class="lf-row-between lf-m-t-30">
  21. <view>实收数</view>
  22. <view class="lf-flex">
  23. <input class="input" placeholder="0" type="number" v-model="item.receiveNum" @blur="inputBlur(index, 'real_receive_number', $event)" />
  24. <text class="lf-color-black"></text>
  25. </view>
  26. </view>
  27. </view>
  28. <view style="height: 120rpx;"></view>
  29. <view class="fixed-bottom">
  30. <button class="btn" @click="comfirm">确认收货</button>
  31. </view>
  32. <!-- 弹出层-确认收货修改 TODO每个都应该是动态 -->
  33. <u-popup v-model="is_show_edit" mode="bottom" border-radius="20">
  34. <view class="popup-box">
  35. <view class="popup-content">
  36. <view>
  37. <view class="popup-item" hover-class="lf-opacity" :style="currentObj(1)?'border-bottom:none':''" @click="switchItem(1)">
  38. <text class="lf-font-bold">选择供应商</text>
  39. <u-icon name="arrow-up" color="#777777" v-if="currentObj(1)"></u-icon>
  40. <u-icon name="arrow-down" color="#777777" v-else></u-icon>
  41. </view>
  42. <scroll-view :scroll-y="true" class="scroll-box" :style="currentObj(1)?'max-height:360rpx':'max-height:0rpx'">
  43. <view class="lf-row-between scroll-item" v-for="(item, index) in supplier_list" :key="index" @click="checkItem(index, 'supplier_list')">
  44. <view>{{ item.name }}</view>
  45. <u-icon name="checkmark-circle" color="#11D189" v-if="item.checked"></u-icon>
  46. </view>
  47. </scroll-view>
  48. </view>
  49. <view>
  50. <view class="popup-item" hover-class="lf-opacity" :style="currentObj(2)?'border-bottom:none':''" @click="switchItem(2)">
  51. <text class="lf-font-bold">选择物资</text>
  52. <u-icon name="arrow-up" color="#777777" v-if="currentObj(2)"></u-icon>
  53. <u-icon name="arrow-down" color="#777777" v-else></u-icon>
  54. </view>
  55. <scroll-view :scroll-y="true" class="scroll-box" :style="currentObj(2)?'max-height:360rpx':'max-height:0rpx'">
  56. <view class="lf-row-between scroll-item" v-for="(item, index) in material_list" :key="index" @click="checkItem(index, 'material_list')">
  57. <view>{{ item.name }}</view>
  58. <u-icon name="checkmark-circle" color="#11D189" v-if="item.checked"></u-icon>
  59. </view>
  60. </scroll-view>
  61. </view>
  62. </view>
  63. <u-button class="popup-btn" @click="comfirmEdit">确认修改</u-button>
  64. </view>
  65. </u-popup>
  66. </view>
  67. </template>
  68. <script>
  69. export default {
  70. data(){
  71. return {
  72. list: [{
  73. title: '大白菜 / 长叶子 / 斤',
  74. orderNum: '300斤',
  75. realNum: '',
  76. receiptsNum: ''
  77. },{
  78. title: '拌凉菜 / 好好次 / 斤',
  79. orderNum: '100斤',
  80. realNum: '',
  81. receiptsNum: ''
  82. },{
  83. title: '你是真的菜 / 菜鸡 / 斤',
  84. orderNum: '1000吨',
  85. realNum: '',
  86. receiptsNum: ''
  87. }],
  88. is_show_edit: false,
  89. current_show: {
  90. type: 1,
  91. open: false
  92. },
  93. supplier_list: [{
  94. name: '南开大学',
  95. checked: false
  96. },{
  97. name: '华侨大学',
  98. checked: false
  99. }],
  100. material_list: [{
  101. name: '哈哈哈哈',
  102. checked: false
  103. },{
  104. name: '嘿嘿嘿',
  105. checked: false
  106. }],
  107. p_sn: '',
  108. contents: [],
  109. order: {},
  110. type: 4,
  111. reachNum: 0,
  112. receiveNum: 0
  113. }
  114. },
  115. computed: {
  116. currentObj(){
  117. let current_show = this.current_show;
  118. return function(num){
  119. return current_show.type == num && current_show.open
  120. }
  121. }
  122. },
  123. onLoad(options){
  124. this.p_sn = options.p_sn || '';
  125. this.getData();
  126. },
  127. methods: {
  128. getData(){
  129. this.$http(this.API.API_CANTEEN_PURCHASEDETAIL, {
  130. p_sn: this.p_sn
  131. // p_sn: '802316269455228606'
  132. }).then(res => {
  133. console.log("xxx",res)
  134. this.order = res.data.order;
  135. this.list = res.data.order.items || [];
  136. this.list.forEach(item => {
  137. item.reachNum = item.purchase_number
  138. item.receiveNum = item.purchase_number
  139. })
  140. })
  141. },
  142. inputBlur(current, key, event){
  143. console.log("inputBlur", current, key, event);
  144. this.list[current][key] = event.detail.value;
  145. },
  146. comfirm(){
  147. // 使用延迟器,以防input还没有赋值成功
  148. let real_count_item = []
  149. this.list.forEach(item => {
  150. real_count_item.push({
  151. id:item.id,
  152. real_receive_number: item.receiveNum,
  153. real_reach_number: item.reachNum
  154. })
  155. })
  156. this.$http(this.API.API_CONFIRM, {
  157. p_sn: this.p_sn,
  158. state: '已入库',
  159. real_count_item
  160. }).then(res => {
  161. this.$msg('确认收货成功').then(()=>{this.$toBack()});
  162. })
  163. },
  164. switchItem(current){
  165. let current_show = this.current_show;
  166. if(current_show.type != current){
  167. current_show.open = false;
  168. }
  169. current_show.type = current;
  170. current_show.open = !current_show.open;
  171. this.current_show = current_show;
  172. },
  173. checkItem(index, name){
  174. this[name].forEach(item => item.checked = false);
  175. this[name][index].checked = true;
  176. },
  177. // 确认修改
  178. comfirmEdit(){
  179. this.$msg('修改成功!');
  180. this.is_show_edit = false;
  181. },
  182. // 显示修改弹出层
  183. showEdit(){
  184. this.current_show = {
  185. type: 1,
  186. open: false
  187. };
  188. this.is_show_edit = true;
  189. }
  190. }
  191. }
  192. </script>
  193. <style>
  194. page{
  195. background-color: #F6F6F6;
  196. overflow-x: hidden;
  197. }
  198. </style>
  199. <style lang="scss" scoped="scoped">
  200. .content{
  201. display: flex;
  202. align-items: center;
  203. flex-wrap: wrap;
  204. flex-direction: column;
  205. }
  206. .card{
  207. width: 686rpx;
  208. height: auto;
  209. background-color: #FFFFFF;
  210. border-radius: 20rpx;
  211. margin-top: 30rpx;
  212. font-size: 28rpx;
  213. box-sizing: border-box;
  214. padding: 30rpx;
  215. color: #777777;
  216. .input{
  217. width: 88rpx;
  218. border-bottom: 1rpx solid #e5e5e5;
  219. margin-right: 14rpx;
  220. text-align: center;
  221. color: #222222;
  222. }
  223. }
  224. .fixed-bottom{
  225. position: fixed;
  226. bottom: 0rpx;
  227. left: 0rpx;
  228. z-index: 99;
  229. width: 750rpx;
  230. height: 98rpx;
  231. display: flex;
  232. justify-content: flex-end;
  233. align-items: center;
  234. border-top: 1rpx solid #E5E5E5;
  235. background-color: #FFFFFF;
  236. box-sizing: border-box;
  237. padding: 0 32rpx;
  238. .btn{
  239. width: 212rpx;
  240. background-color: #11D189;
  241. font-size: 32rpx;
  242. line-height: 82rpx;
  243. margin: 0;
  244. height: 82rpx;
  245. border-radius: 40rpx;
  246. color: #FFFFFF;
  247. }
  248. }
  249. /deep/.placeholder-class{
  250. color: #777777;
  251. }
  252. // 去掉u-button 外边框线
  253. /deep/.u-hairline-border::after{
  254. border: none;
  255. }
  256. .popup-box{
  257. width: 100%;
  258. min-height: 484rpx;
  259. max-height: 64vh;
  260. padding: 10rpx 32rpx;
  261. display: flex;
  262. flex-direction: column;
  263. justify-content: space-between;
  264. .popup-content{
  265. min-height: 332rpx;
  266. // max-height: 54vh;
  267. margin-bottom: 40rpx;
  268. .popup-item{
  269. padding: 30rpx 0;
  270. box-sizing: border-box;
  271. border-bottom: 1rpx solid #E5E5E5;
  272. display: flex;
  273. justify-content: space-between;
  274. font-size: 28rpx;
  275. color: #222222;
  276. }
  277. .scroll-box{
  278. transition: all .5s;
  279. .scroll-item{
  280. padding: 30rpx 0;
  281. }
  282. }
  283. }
  284. .popup-btn{
  285. width: 100%;
  286. height: 82rpx;
  287. background: #11D189;
  288. border-radius: 10rpx;
  289. font-size: 32rpx;
  290. color: #FFFFFF;
  291. margin-bottom: 30rpx;
  292. }
  293. }
  294. </style>