outsourceOrder.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view>
  3. <u-popup :show="show" :mode='mode' :closeOnClickOverlay='false'>
  4. <view :style="{paddingTop: mode == 'top' ? topHight + 'px' : ''}">
  5. <view class="box_list">
  6. <u-list @scrolltolower="scrolltolower" class="z_list">
  7. <checkbox-group v-for="(item, index) in list" :key="index"
  8. @change="e => selectVal(e, item, index)">
  9. <label class="listBox rx-bs">
  10. <view class="listBox-sel">
  11. <checkbox :value="item.code" color="#fff" :checked="item.checked" />
  12. </view>
  13. <view class="listBox-con">
  14. <view class="listBox-top rx-bc">
  15. <view> {{ item.name }} {{item.checked}} </view>
  16. <view class="code">
  17. {{ item.rootCategoryLevelId == 4 ? item.codeNumber : item.code}}
  18. </view>
  19. </view>
  20. <view class="listBox-bottom rx">
  21. <view class="items">
  22. <text>委外类型</text> {{ item.deliveryMethod == 2 ? '分批到货' : '一次到货'}}
  23. </view>
  24. <view class="items">
  25. <text>委外数量</text>
  26. {{item.deliveryMethod == 2 ? item.purchaseQuantity : item.totalCount}}
  27. </view>
  28. <view class="items" style="width: calc(100% - 2px);" v-if="item.deliveryMethod == 2">
  29. <text>批次号</text>
  30. {{ item.batchNo }}
  31. </view>
  32. <view class="items" style="width: calc(100% - 2px);">
  33. <text>委外到货时间</text>
  34. {{ item.deliveryMethod == 2 ? item.requireDeliveryTime : item.requireDeliveryTime }}
  35. </view>
  36. </view>
  37. </view>
  38. </label>
  39. </checkbox-group>
  40. </u-list>
  41. </view>
  42. <view class="operate_box rx-bc">
  43. <u-button size="small" class="u-reset-button" @click="close">
  44. 取消
  45. </u-button>
  46. <u-button type="success" size="small" class="u-reset-button" @click="handOK">
  47. 确定
  48. </u-button>
  49. </view>
  50. </view>
  51. </u-popup>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. data() {
  57. return {
  58. mode: 'center',
  59. show: false,
  60. topHight: 20 || 20,
  61. list: []
  62. }
  63. },
  64. methods: {
  65. close() {
  66. this.show = false
  67. },
  68. open(list) {
  69. this.list = []
  70. list.forEach(f => {
  71. if (f.timeList.length > 0) {
  72. f.timeList.forEach(o => {
  73. this.list.push({
  74. ...f,
  75. ...o
  76. })
  77. })
  78. } else {
  79. this.list.push(f)
  80. }
  81. })
  82. console.log(this.list)
  83. this.show = true
  84. },
  85. scrolltolower() {},
  86. handOK() {
  87. let _arr = []
  88. this.list.forEach(f => {
  89. if(Object.prototype.hasOwnProperty.call(f, 'checked') && f.checked == true) {
  90. _arr.push({
  91. id: f.id,
  92. code: f.code,
  93. batchNo: f.batchNo
  94. })
  95. }
  96. })
  97. this.$emit('outsourceEmit' ,_arr)
  98. this.show = false
  99. },
  100. selectVal(e, val, index) {
  101. this.list[index].checked = !this.list[index].checked
  102. },
  103. timeTure(timestamp) {
  104. console.log(timestamp,'timestamp');
  105. const date = new Date(Number(timestamp)); // 创建 Date 对象
  106. const year = date.getFullYear();
  107. const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1并补零
  108. const day = String(date.getDate()).padStart(2, '0'); // 补零
  109. const hours = String(date.getHours()).padStart(2, '0'); // 补零
  110. const minutes = String(date.getMinutes()).padStart(2, '0'); // 补零
  111. const seconds = String(date.getSeconds()).padStart(2, '0'); // 补零
  112. // 格式化输出
  113. const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  114. return formattedDate
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss" scoped>
  120. .z_list {
  121. max-height: 860rpx;
  122. }
  123. .box_list {
  124. min-height: 100rpx;
  125. width: 90vw;
  126. /deep/ .baseForm {
  127. padding: 0 20rpx;
  128. }
  129. }
  130. .operate_box {
  131. padding: 10rpx 32rpx;
  132. /deep/ .u-button {
  133. width: 40%;
  134. }
  135. }
  136. .listBox {
  137. margin-top: 8rpx;
  138. padding: 8rpx 24rpx;
  139. background: #f5f5f5;
  140. /deep/ .uni-checkbox-input-checked {
  141. background-color: $theme-color !important;
  142. border-color: $theme-color !important;
  143. }
  144. .listBox-con {
  145. width: 650rpx;
  146. font-weight: 400;
  147. }
  148. .listBox-top {
  149. margin-top: 6rpx;
  150. color: #090A0A;
  151. font-size: 28rpx;
  152. font-style: normal;
  153. font-weight: 800;
  154. }
  155. .listBox-bottom {
  156. color: #090A0A;
  157. font-size: 24rpx;
  158. font-style: normal;
  159. flex-wrap: wrap;
  160. .items {
  161. width: calc(50% - 1px);
  162. border-left: 1rpx solid #E3E5E5;
  163. border-right: 1rpx solid #E3E5E5;
  164. border-bottom: 1rpx solid #E3E5E5;
  165. box-sizing: border-box;
  166. word-break: break-all;
  167. text {
  168. display: inline-block;
  169. background: #F7F9FA;
  170. padding: 8rpx 10rpx;
  171. color: #157A2C;
  172. }
  173. &:nth-child(1),
  174. &:nth-child(2) {
  175. border-top: 1rpx solid #E3E5E5;
  176. margin-top: 8rpx;
  177. }
  178. }
  179. }
  180. }
  181. </style>