cm-goods-popup.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <template name="coupon">
  2. <view class="coupon-template">
  3. <!-- 选择商品 -->
  4. <tui-bottom-popup :radius="true" :show="show" @close="hidePopup">
  5. <view class="tui-popup-box clearfix">
  6. <view class="title">选择商品</view>
  7. <view class="title-search">
  8. <view class="search-from name">
  9. <text class="iconfont icon-iconfonticonfontsousuo1"></text>
  10. <input
  11. class="input"
  12. type="text"
  13. confirm-type="search"
  14. v-model="listQuery.name"
  15. @input="onShowClose"
  16. @confirm="initclubList()"
  17. placeholder="搜索商品名称"
  18. maxlength="16"
  19. />
  20. <text class="iconfont icon-shanchu1" v-if="isShowClose" @click="delInputText()"></text>
  21. </view>
  22. </view>
  23. <view class="tui-popup-main coupon">
  24. <scroll-view class="tui-popup-scroll" scroll-y="true">
  25. <view
  26. v-for="(pros, index) in dataList"
  27. :key="index"
  28. class="list"
  29. @click.stop="checkedCoupon(index)"
  30. >
  31. <view class="list-cell-le">
  32. <image
  33. class="logo"
  34. :src="pros.images"
  35. mode=""
  36. ></image>
  37. </view>
  38. <view class="list-cell-ri">
  39. <view class="list-text">{{ pros.name }}</view>
  40. <view class="list-text small"> <text class="none">供应商:</text>{{ pros.shopName }}</view>
  41. <view class="list-text red">¥{{ pros.price }}</view>
  42. </view>
  43. <view class="list-cell-btn">
  44. <view
  45. class="checkbox iconfont"
  46. :class="[pros.ischecked ? 'icon-yixuanze' : 'icon-weixuanze']"
  47. >
  48. </view>
  49. </view>
  50. </view>
  51. </scroll-view>
  52. </view>
  53. <view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  54. <view class="tui-flex-1"> <view class="tui-button" @click="hidePopup">确定</view> </view>
  55. </view>
  56. </view>
  57. </tui-bottom-popup>
  58. </view>
  59. </template>
  60. <script>
  61. export default {
  62. name: 'coupon',
  63. props: {
  64. show: {
  65. type: Boolean,
  66. default: false
  67. }
  68. },
  69. data() {
  70. return {
  71. isIphoneX: this.$store.state.isIphoneX,
  72. checkedIndex: 0,
  73. isShowClose: false,
  74. listQuery: {
  75. userIdentity: '',
  76. name: '',
  77. pageNum: 1,
  78. pageSize: 200,
  79. spId: this.serviceProviderId,
  80. status: 66
  81. },
  82. dataList: [
  83. {
  84. images:'https://img.caimei365.com/group1/M00/04/1D/rB-lGGK-kTWASmn_AAEbbtyDzZs488.jpg',
  85. name:'ICE冷冻溶脂仪 意大利进口 减脂黑科技ICE冷冻溶脂仪 意大利进口 减脂黑科技',
  86. shopName:'广州市昊运生物科技有限公司',
  87. price:100000,
  88. ischecked:false
  89. },
  90. {
  91. images:'https://img.caimei365.com/group1/M00/04/1D/rB-lGGK-kTWASmn_AAEbbtyDzZs488.jpg',
  92. name:'ICE冷冻溶脂仪 意大利进口 减脂黑科技ICE冷冻溶脂仪 意大利进口 减脂黑科技',
  93. shopName:'广州市昊运生物科技有限公司',
  94. price:100000,
  95. ischecked:false
  96. },
  97. {
  98. images:'https://img.caimei365.com/group1/M00/04/1D/rB-lGGK-kTWASmn_AAEbbtyDzZs488.jpg',
  99. name:'ICE冷冻溶脂仪 意大利进口 减脂黑科技ICE冷冻溶脂仪 意大利进口 减脂黑科技',
  100. shopName:'广州市昊运生物科技有限公司',
  101. price:100000,
  102. ischecked:false
  103. },
  104. {
  105. images:'https://img.caimei365.com/group1/M00/04/1D/rB-lGGK-kTWASmn_AAEbbtyDzZs488.jpg',
  106. name:'ICE冷冻溶脂仪 意大利进口 减脂黑科技ICE冷冻溶脂仪 意大利进口 减脂黑科技',
  107. shopName:'广州市昊运生物科技有限公司',
  108. price:100000,
  109. ischecked:false
  110. },
  111. ]
  112. }
  113. },
  114. created() {
  115. // this.initclubList()
  116. },
  117. methods: {
  118. async initclubList() {
  119. const userInfo = await this.$api.getStorage()
  120. this.listQuery.spId = userInfo.serviceProviderId
  121. this.SellerService.GetSellerClubList(this.listQuery)
  122. .then(response => {
  123. let data = response.data
  124. if (data.list && data.list.length > 0) {
  125. this.dataList = data.list.map((el,index)=>{
  126. el.ischecked = false
  127. return el
  128. })
  129. }
  130. })
  131. .catch(error => {
  132. this.$util.msg(error.msg, 2000)
  133. })
  134. },
  135. checkedCoupon(idx) {
  136. // 选择商品
  137. this.checkedIndex = idx
  138. this.dataList.forEach((el, index) => {
  139. if (this.checkedIndex == index) {
  140. el.ischecked = !el.ischecked
  141. } else {
  142. el.ischecked = false
  143. }
  144. })
  145. },
  146. onShowClose() {
  147. //输入框失去焦点时触发
  148. if (this.listQuery.name != '') {
  149. this.isShowClose = true
  150. } else {
  151. this.isShowClose = false
  152. }
  153. },
  154. delInputText() {
  155. //清除输入框内容
  156. this.listQuery.name = ''
  157. this.isShowClose = false
  158. },
  159. hidePopup() {
  160. let goods = null
  161. let checkedData = false
  162. this.dataList.forEach((el, index) => {
  163. if (el.ischecked) {
  164. goods = el
  165. checkedData = true
  166. }
  167. })
  168. if (checkedData) {
  169. this.$emit('handleChoiceaGoods', goods)
  170. }
  171. this.$parent.isGoodspopup = false
  172. }
  173. }
  174. }
  175. </script>
  176. <style lang="scss">
  177. .coupon-template {
  178. width: 100%;
  179. height: auto;
  180. background: #ffffff;
  181. float: left;
  182. margin-top: 24rpx;
  183. .coupon-title {
  184. width: 702rpx;
  185. padding: 0 24rpx;
  186. height: 88rpx;
  187. line-height: 88rpx;
  188. position: relative;
  189. .text {
  190. font-size: $font-size-28;
  191. color: $text-color;
  192. }
  193. .text-coupon {
  194. display: inline-block;
  195. float: right;
  196. padding-right: 30rpx;
  197. line-height: 88rpx;
  198. font-size: 28rpx;
  199. color: #f94b4b;
  200. }
  201. .iconfont {
  202. width: 50rpx;
  203. height: 88rpx;
  204. line-height: 88rpx;
  205. color: #999999;
  206. display: block;
  207. position: absolute;
  208. right: 0;
  209. top: 0;
  210. }
  211. }
  212. }
  213. .tui-popup-box {
  214. position: relative;
  215. box-sizing: border-box;
  216. min-height: 220rpx;
  217. padding: 24rpx 32rpx 0 32rpx;
  218. .title {
  219. font-size: $font-size-32;
  220. color: $text-color;
  221. line-height: 68rpx;
  222. text-align: center;
  223. float: left;
  224. width: 100%;
  225. height: 68rpx;
  226. box-sizing: border-box;
  227. padding: 0 24rpx;
  228. }
  229. .title-search {
  230. width: 100%;
  231. height: 66rpx;
  232. background: #ffffff;
  233. box-sizing: border-box;
  234. float: left;
  235. .search-from {
  236. width: 100%;
  237. height: 100%;
  238. background: #f7f7f7;
  239. border-radius: 32rpx;
  240. float: left;
  241. position: relative;
  242. .input {
  243. width: 500rpx;
  244. height: 64rpx;
  245. float: left;
  246. line-height: 64rpx;
  247. color: $text-color;
  248. font-size: $font-size-24;
  249. }
  250. .icon-iconfonticonfontsousuo1 {
  251. width: 64rpx;
  252. height: 64rpx;
  253. line-height: 64rpx;
  254. text-align: center;
  255. display: block;
  256. font-size: $font-size-38;
  257. float: left;
  258. color: #999999;
  259. }
  260. .icon-shanchu1 {
  261. font-size: $font-size-32;
  262. color: #999999;
  263. position: absolute;
  264. width: 64rpx;
  265. height: 64rpx;
  266. line-height: 64rpx;
  267. text-align: center;
  268. top: 0;
  269. right: 0;
  270. z-index: 10;
  271. }
  272. }
  273. }
  274. .tui-popup-main {
  275. width: 100%;
  276. float: left;
  277. padding-top: 10rpx;
  278. .tui-popup-scroll {
  279. width: 100%;
  280. height: 800rpx;
  281. .list {
  282. width: 100%;
  283. height: 176rpx;
  284. box-sizing: border-box;
  285. padding: 24rpx 0;
  286. background-size: cover;
  287. .list-cell-le {
  288. width: 128rpx;
  289. height: 100%;
  290. box-sizing: border-box;
  291. float: left;
  292. border: 1px dashed #e1e1e1;
  293. .logo {
  294. width: 125rpx;
  295. height: 125rpx;
  296. border-radius: 8rpx;
  297. }
  298. }
  299. .list-cell-ri {
  300. width: 470rpx;
  301. height: 100%;
  302. box-sizing: border-box;
  303. float: left;
  304. margin-left: 24rpx;
  305. .list-text{
  306. width: 100%;
  307. height: 42rpx;
  308. float: left;
  309. line-height: 42rpx;
  310. text-align: left;
  311. font-size: $font-size-26;
  312. color: #333333;
  313. text-overflow: ellipsis;
  314. overflow: hidden;
  315. display: -webkit-box;
  316. -webkit-line-clamp: 1;
  317. line-clamp: 1;
  318. -webkit-box-orient: vertical;
  319. &.small{
  320. font-size: 24rpx;
  321. .none{
  322. color: #999;
  323. }
  324. }
  325. &.red{
  326. color: #F94B4B;
  327. }
  328. }
  329. }
  330. .list-cell-btn {
  331. width: 40rpx;
  332. height: 100%;
  333. float: right;
  334. .checkbox {
  335. width: 40rpx;
  336. line-height: 128rpx;
  337. float: right;
  338. box-sizing: border-box;
  339. text-align: center;
  340. text-decoration: none;
  341. -webkit-tap-highlight-color: transparent;
  342. overflow: hidden;
  343. font-size: $font-size-34;
  344. &.icon-weixuanze {
  345. color: #b2b2b2;
  346. }
  347. &.icon-yixuanze {
  348. color: #e15616;
  349. }
  350. }
  351. }
  352. }
  353. }
  354. .tui-popup-coupon {
  355. width: 100%;
  356. height: 500rpx;
  357. box-sizing: border-box;
  358. padding: 30rpx 20rpx;
  359. .tui-popup-h1 {
  360. width: 100%;
  361. height: 66rpx;
  362. display: flex;
  363. align-items: center;
  364. .tui-popup-text {
  365. flex: 1;
  366. height: 66rpx;
  367. line-height: 66rpx;
  368. font-size: $font-size-30;
  369. color: #333333;
  370. &.red {
  371. color: #f94b4b;
  372. }
  373. &.bold {
  374. font-weight: bold;
  375. }
  376. &.left {
  377. text-align: left;
  378. }
  379. &.right {
  380. text-align: right;
  381. }
  382. }
  383. }
  384. }
  385. }
  386. .tui-popup-btn {
  387. width: 100%;
  388. height: auto;
  389. float: left;
  390. margin-top: 24rpx;
  391. .tui-button {
  392. width: 100%;
  393. height: 88rpx;
  394. background: $btn-confirm;
  395. line-height: 88rpx;
  396. text-align: center;
  397. color: #ffffff;
  398. font-size: $font-size-28;
  399. border-radius: 44rpx;
  400. }
  401. }
  402. }
  403. </style>