select-goods-pop.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <u-popup v-model="show" mode="bottom" height="750rpx">
  3. <view class="list">
  4. <view class="item" v-for="(goods, index) in goodsList" :key="index">
  5. <view class="left">
  6. <u-checkbox shape="circle" active-color="#22ac38" icon-size="16" v-model="goods.checked" @change="checkGoods"></u-checkbox>
  7. </view>
  8. <view class="right" @click="goodsList[index].checked = !goodsList[index].checked">
  9. <orderDetailGoodsCard :data="goods"></orderDetailGoodsCard>
  10. </view>
  11. </view>
  12. </view>
  13. <!-- 底部按钮 -->
  14. <view class="btn">
  15. <view class="inner">
  16. <view class="check">
  17. <u-checkbox shape="circle" active-color="#22ac38" icon-size="16" v-model="checkAllStauts" @change="checkAllGoods"></u-checkbox>
  18. <text>全选</text>
  19. </view>
  20. <view class="right">
  21. <!-- ({{ goodsList.filter(item => item.checked).length }}) -->
  22. <u-button type="primary" @click="confirmSel">确认选择</u-button>
  23. </view>
  24. </view>
  25. </view>
  26. </u-popup>
  27. </template>
  28. <script>
  29. var _self;
  30. import orderDetailGoodsCard from '@/pages-mall/components/order/orderdetail-goods-card.vue';
  31. export default {
  32. components: {
  33. orderDetailGoodsCard
  34. },
  35. data() {
  36. return {
  37. show:false,
  38. orderInfo:{},
  39. goodsList:[],
  40. checkAllStauts: false,
  41. };
  42. },
  43. computed: {
  44. checkAll() {
  45. // this.totalPrice=0;
  46. // this.goodsList.map(item => (item.checked ? (this.totalPrice += Number(item.amount) * item.nums) : 0));
  47. if (this.goodsList.filter(item => item.checked).length == this.goodsList.length) {
  48. this.checkAllStauts = true;
  49. } else {
  50. this.checkAllStauts = false;
  51. }
  52. }
  53. },
  54. onLoad() {
  55. _self = this;
  56. },
  57. methods: {
  58. showPop(data){
  59. console.log('data>>>',data);
  60. this.show = true;
  61. this.goodsList=[];
  62. data.order_goods_info.forEach(e=>{
  63. console.log(e);
  64. if(e.sub_status=='10'){
  65. e.checked = false;
  66. this.goodsList.push(e);
  67. }
  68. });
  69. console.log(this.goodsList);
  70. this.$forceUpdate();
  71. },
  72. // 确认选择
  73. // :disabled="goodsList.filter(item => item.checked).length<=0"
  74. confirmSel(){
  75. let gs = [];
  76. this.goodsList.forEach(item => {
  77. if(item.checked){
  78. gs.push(item);
  79. }
  80. });
  81. this.$emit('done',gs);
  82. this.show = false;
  83. },
  84. // 全选?
  85. checkAllGoods() {
  86. if (this.checkAllStauts) {
  87. this.goodsList.forEach(item => (item.checked = false));
  88. } else {
  89. this.goodsList.forEach(item => (item.checked = true));
  90. }
  91. },
  92. // 单选
  93. checkGoods(e){
  94. this.$forceUpdate();
  95. },
  96. }
  97. };
  98. </script>
  99. <style lang="scss" scoped>
  100. .page {
  101. background: $app-theme-bg-gray-color;
  102. padding: 24rpx;
  103. }
  104. .list {
  105. padding-bottom: 120rpx;
  106. .item {
  107. display: flex;
  108. align-items: center;
  109. background-color: $app-theme-bg-color;
  110. padding: 30rpx 24rpx 30rpx 24rpx;
  111. border-bottom: 1rpx solid $app-theme-border-color;
  112. position: relative;
  113. .left {
  114. display: flex;
  115. align-items: center;
  116. width: 46rpx;
  117. }
  118. .right {
  119. width: calc(100% - 46rpx);
  120. display: flex;
  121. align-items: center;
  122. .img {
  123. width: 160rpx;
  124. height: 160rpx;
  125. margin-right: 20rpx;
  126. image {
  127. width: 100%;
  128. height: 100%;
  129. }
  130. }
  131. .info {
  132. width: 418rpx;
  133. .title {
  134. font-size: 28rpx;
  135. font-family: PingFang-SC-Regular, PingFang-SC;
  136. font-weight: 400;
  137. color: $app-theme-text-black-color;
  138. padding-bottom: 16rpx;
  139. }
  140. .sku {
  141. font-size: 22rpx;
  142. font-family: PingFang-SC-Regular, PingFang-SC;
  143. font-weight: 400;
  144. background: $app-theme-bg-gray-color;
  145. border-radius: 2px;
  146. color: $app-theme-card-gray-deep-color;
  147. padding: 4rpx 16rpx;
  148. }
  149. .operate {
  150. padding-top: 30rpx;
  151. display: flex;
  152. align-items: center;
  153. justify-content: space-between;
  154. .price {
  155. text:nth-child(1) {
  156. font-size: 24rpx;
  157. font-family: PingFangSC-Medium, PingFang SC;
  158. font-weight: 500;
  159. color: $app-theme-text-money-color;
  160. }
  161. text:nth-child(2) {
  162. font-size: 36rpx;
  163. font-family: PingFangSC-Regular, PingFang SC;
  164. font-weight: 400;
  165. color: $app-theme-text-money-color;
  166. }
  167. }
  168. .num {
  169. }
  170. }
  171. }
  172. }
  173. }
  174. }
  175. .btn {
  176. position: fixed;
  177. bottom: 0;
  178. left: 0;
  179. width: 100%;
  180. background-color: $app-theme-bg-color;
  181. min-height: 100rpx;
  182. .inner {
  183. display: flex;
  184. justify-content: space-between;
  185. align-items: center;
  186. padding-bottom: constant(safe-area-inset-bottom);
  187. padding-bottom: env(safe-area-inset-bottom);
  188. .check {
  189. padding-left: 30rpx;
  190. display: flex;
  191. align-items: center;
  192. text {
  193. font-size: 28rpx;
  194. font-weight: 400;
  195. color: $app-theme-text-black-color;
  196. }
  197. }
  198. .right {
  199. display: flex;
  200. align-items: center;
  201. .price {
  202. margin-right: 54rpx;
  203. text:nth-child(1) {
  204. font-size: 28rpx;
  205. font-weight: 400;
  206. color: $app-theme-text-black-color;
  207. }
  208. text:nth-child(2) {
  209. font-size: 24rpx;
  210. font-weight: 500;
  211. color: $app-theme-text-money-color;
  212. }
  213. text:nth-child(3) {
  214. font-size: 36rpx;
  215. font-weight: 400;
  216. color: $app-theme-text-money-color;
  217. }
  218. }
  219. /deep/button {
  220. height: 100%;
  221. line-height: 100rpx;
  222. border-radius: 0 !important;
  223. }
  224. }
  225. }
  226. }
  227. </style>