vipCardMessage.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <template>
  2. <view class="content">
  3. <no-none v-if='list.length<=0'></no-none>
  4. <block v-else>
  5. <view style="margin-top: 30rpx;" class="item" v-for="(item,index) of list" :key='index'>
  6. <view class="border-b item-title flex-y-center">
  7. <image :src="item.avatar" mode="aspectFill" class="avatar" @click="previewImg(item.avatar)"></image>
  8. <text>{{item.nickname || '未知用户'}} {{item.mobile || ''}}</text>
  9. <switch :checked="item.checked" type="checkbox" @change="onChooseUser($event,index)"
  10. style="margin-left: auto;" />
  11. </view>
  12. <view class="item-bottom flex-y-center">
  13. <view class="flex-grow-1">
  14. <view class="box-pack-between item-bottom-right flex-y-center">
  15. <text><text class="item-bottom-number">所属门店</text>:{{item.store_name}} </text>
  16. </view>
  17. <view class="box-pack-between item-bottom-right">
  18. <text><text class="item-bottom-number">会员等级</text>:{{item.level_name}}</text>
  19. </view>
  20. <view class="box-pack-between item-bottom-right flex-y-center">
  21. <text><text class="item-bottom-number">当前积分</text>:{{item.integral}} </text>
  22. </view>
  23. <view class="box-pack-between item-bottom-right flex-y-center">
  24. <text><text class="item-bottom-number">当前余额</text>:{{item.balance}} </text>
  25. </view>
  26. <view class="box-pack-between item-bottom-right flex-y-center">
  27. <text><text class="item-bottom-number">领卡时间</text>:{{item.addtime}} </text>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </block>
  33. <view style="height: 90px;"></view>
  34. <navigator style="margin-bottom:0" url='./addCoupon' hover-class="none" class="bottom-bar">
  35. <view class="btn" style="background: #fff;border:1px solid #ddd;color:#888" @click="showScreen">筛选</view>
  36. <view class="btn" @click="showAddPop">+新增推送</view>
  37. </navigator>
  38. <uni-popup ref="popup" type="bottom" background-color="#fff" style="z-index:100" :is-mask-click="false"
  39. :mask-click="false">
  40. <view class="screen-pop">
  41. <view class="cell">
  42. <view class="label">手机号码</view>
  43. <view class="desc"><input type="text" v-model="screen.tel" class="input-box" placeholder="请输入" />
  44. </view>
  45. </view>
  46. <view class="cell">
  47. <view class="label">身份</view>
  48. <view class="desc">
  49. <picker :range="levels" range-key="name" @change="onChangeLevel">
  50. <input type="text" :value="screen.level_name" class="input-box" placeholder="请输入" />
  51. </picker>
  52. </view>
  53. </view>
  54. <view class="cell">
  55. <view class="label">时间</view>
  56. <view class="desc flex flex-between flex-y-center">
  57. <picker mode="date" @change="onChangeTime($event,'start_time')">
  58. <input type="text" :value="screen.start_time" placeholder="开始时间" class="input-box"
  59. style="text-align: center;" disabled>
  60. </picker>
  61. <view>—</view>
  62. <picker mode="date" @change="onChangeTime($event,'end_time')">
  63. <input type="text" :value="screen.end_time" placeholder="结束时间" class="input-box"
  64. style="text-align: center;" disabled>
  65. </picker>
  66. </view>
  67. </view>
  68. <view class="btns">
  69. <view class="btn reset-btn" @click="onResetScreen">重置</view>
  70. <view class="btn submit-btn" @click="onSubmitScreen">确定</view>
  71. </view>
  72. <view class="is-iphone-x"></view>
  73. </view>
  74. </uni-popup>
  75. <uni-popup ref="addPopup" type="bottom" background-color="#fff" style="z-index:100" :is-mask-click="false"
  76. :mask-click="false">
  77. <view class="screen-pop">
  78. <view class="cell">
  79. <view class="label">推送文案</view>
  80. <view class="desc"><input type="text" v-model="sendInfo.textarea" class="input-box"
  81. placeholder="请输入" />
  82. </view>
  83. <view class="tips">注意:文案加起来不能超过19个字符。如果有赠送积分,推送文案内要写推送积分数。举例:您好,本次积分活动赠送34积分</view>
  84. </view>
  85. <view class="cell">
  86. <view class="label">赠送积分</view>
  87. <view class="desc"><input type="text" v-model="sendInfo.integral" class="input-box"
  88. placeholder="请输入" />
  89. </view>
  90. <view class="tips">注意注意:假设不赠送积分,则填0</view>
  91. </view>
  92. <view class="btns">
  93. <view class="btn reset-btn" @click="onResetAdd">取消</view>
  94. <view class="btn submit-btn" @click="onSubmitAdd">推送</view>
  95. </view>
  96. <view class="is-iphone-x"></view>
  97. </view>
  98. </uni-popup>
  99. </view>
  100. </template>
  101. <script>
  102. export default {
  103. data() {
  104. return {
  105. list: [],
  106. page: 1,
  107. is_load: false,
  108. levels: [{
  109. id: 55,
  110. name: "普通会员"
  111. }],
  112. screen: {
  113. level: "",
  114. tel: "",
  115. start_time: "",
  116. end_time: ""
  117. },
  118. sendUserIds: "",
  119. sendInfo: {
  120. textarea: "",
  121. integral: ""
  122. }
  123. }
  124. },
  125. onLoad() {
  126. this.getLevels()
  127. },
  128. onShow() {
  129. this.page = 1;
  130. this.list = [];
  131. this.http();
  132. },
  133. onReachBottom(e) {
  134. if (!this.is_load) {
  135. this.page = this.page + 1;
  136. this.http();
  137. }
  138. },
  139. methods: {
  140. onChooseUser(e, index) {
  141. console.log(e, index)
  142. this.list[index].checked = e.detail.value
  143. },
  144. showScreen() {
  145. this.$refs.popup.open('bottom')
  146. },
  147. getLevels() {
  148. this.request({
  149. url: "alipaycoupon/level_index",
  150. data: {
  151. admin_id: uni.getStorageSync("admin_id"),
  152. },
  153. showLoading: true,
  154. }).then(res => {
  155. console.log(res, "res")
  156. if (res.code === "200") {
  157. this.levels = this.levels.concat(res.data)
  158. }
  159. });
  160. },
  161. onChangeLevel(e) {
  162. this.screen.level_name = this.levels[e.detail.value].name
  163. this.screen.level = this.levels[e.detail.value].id
  164. },
  165. onChangeTime(e, name) {
  166. // console.log(e)
  167. this.screen[name] = e.detail.value
  168. },
  169. onResetScreen() {
  170. this.screen = {
  171. level: "",
  172. tel: "",
  173. start_time: "",
  174. end_time: ""
  175. }
  176. this.$refs.popup.close()
  177. this.http()
  178. },
  179. onSubmitScreen() {
  180. this.page = 1
  181. this.list = []
  182. if (this.screen.start_time && this.screen.end_time) {
  183. let start = this.screen.start_time
  184. let end = this.screen.end_time
  185. if (Date.parse(start.replace(/-/g, '/')) > Date.parse(end.replace(/-/g, '/'))) {
  186. this.screen.start_time = end
  187. this.screen.end_time = start
  188. }
  189. }
  190. this.$refs.popup.close()
  191. this.http()
  192. },
  193. showAddPop() {
  194. let arr = this.list.filter(item => {
  195. return item.checked
  196. })
  197. console.log(arr)
  198. if (arr.length > 0) {
  199. this.sendUserIds = arr.map(item => {
  200. return item.id
  201. })
  202. this.$refs.addPopup.open("bottom")
  203. } else {
  204. uni.showToast({
  205. title: "请选择推送对象",
  206. icon: "none"
  207. })
  208. }
  209. },
  210. onResetAdd() {
  211. this.list.map(item => {
  212. item.checked = false
  213. })
  214. this.sendInfo = {
  215. textarea: "",
  216. integral: ""
  217. }
  218. this.$refs.addPopup.close()
  219. },
  220. onSubmitAdd() {
  221. if (this.sendInfo.textarea == '' || this.sendInfo.integral == '') {
  222. uni.showToast({
  223. title: "请完善表单后提交",
  224. icon: "none"
  225. })
  226. return false
  227. }
  228. this.request({
  229. url: 'alipaycoupon/tuisoinglist',
  230. data: {
  231. admin_id: uni.getStorageSync("admin_id"),
  232. textarea: this.sendInfo.textarea,
  233. integral: this.sendInfo.integral,
  234. ids: this.sendUserIds.join(',')
  235. },
  236. }).then(res => {
  237. if (res.code == 200) {
  238. uni.showModal({
  239. content: res.message,
  240. showCancel: false,
  241. success: (r) => {
  242. this.sendInfo = {
  243. textarea: "",
  244. integral: ""
  245. }
  246. this.$refs.addPopup.close()
  247. this.list = []
  248. this.page = 1
  249. this.http()
  250. }
  251. })
  252. } else {
  253. uni.showToast({
  254. title: res.message,
  255. icon: 'none'
  256. })
  257. }
  258. }).catch(res => {
  259. uni.showToast({
  260. title: res.message,
  261. icon: 'none'
  262. })
  263. })
  264. },
  265. previewImg(src) {
  266. if (src) {
  267. uni.previewImage({
  268. urls: [src]
  269. });
  270. }
  271. },
  272. http() {
  273. let url = "alipaycoupon/gzh_list";
  274. this.request({
  275. url,
  276. data: {
  277. admin_id: uni.getStorageSync("admin_id"),
  278. page: this.page,
  279. limit: 10,
  280. level: this.screen.level,
  281. tel: this.screen.tel,
  282. start_time: this.screen.start_time,
  283. end_time: this.screen.end_time,
  284. },
  285. showLoading: true,
  286. }).then(res => {
  287. console.log(res, "res")
  288. if (res.code == 200) {
  289. let arr = res.data
  290. if (arr.length > 0) {
  291. arr.map(item => {
  292. item.checked = false
  293. })
  294. this.list = this.list.concat(arr);
  295. this.is_load = false
  296. } else {
  297. this.is_load = true
  298. }
  299. }
  300. });
  301. },
  302. },
  303. }
  304. </script>
  305. <style lang="scss">
  306. page {
  307. background: #F5F7FA;
  308. }
  309. .page-top {
  310. background: #fff;
  311. position: sticky;
  312. top: 0;
  313. z-index: 99;
  314. padding: 10rpx 0;
  315. box-shadow: 0 5rpx 10rpx #f0f0f0;
  316. }
  317. .item {
  318. width: 690rpx;
  319. background: #ffffff;
  320. margin: 0 auto;
  321. padding: 0rpx 24rpx;
  322. opacity: 1;
  323. border-radius: 8rpx;
  324. box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(213, 213, 213, 0.04);
  325. .item-title {
  326. opacity: 1;
  327. font-size: 28rpx;
  328. font-family: PingFang SC, PingFang SC-Medium;
  329. font-weight: 500;
  330. color: #333333;
  331. padding: 24rpx 0;
  332. .avatar {
  333. display: block;
  334. width: 48rpx;
  335. height: 48rpx;
  336. border-radius: 50%;
  337. margin-right: 16rpx;
  338. }
  339. }
  340. .item-bottom {
  341. font-size: 26rpx;
  342. padding: 20rpx 0 24rpx 0;
  343. color: #666666;
  344. .item-bottom-left {
  345. width: 90rpx;
  346. height: 90rpx;
  347. margin-right: 24rpx;
  348. min-width: 90rpx;
  349. margin-bottom: 16rpx;
  350. }
  351. .item-bottom-right {
  352. margin-bottom: 16rpx;
  353. .item-bottom-number {
  354. color: #99A0AD;
  355. }
  356. }
  357. }
  358. }
  359. .color-ffa {
  360. color: #3387FF;
  361. }
  362. .icongengduo {
  363. color: #999;
  364. font-size: 24rpx;
  365. }
  366. .bottom-bar {
  367. position: fixed;
  368. bottom: 0px;
  369. width: 100%;
  370. z-index: 50;
  371. background: #FFFFFF;
  372. padding: 30rpx 0;
  373. display: flex;
  374. flex-flow: row nowrap;
  375. justify-content: space-around;
  376. align-items: center;
  377. }
  378. .bottom-bar .btn {
  379. width: 300rpx;
  380. height: 98rpx;
  381. opacity: 1;
  382. background: #04BE02;
  383. border-radius: 49rpx;
  384. box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(51, 135, 255, 0.20);
  385. opacity: 1;
  386. font-size: 36rpx;
  387. text-align: center;
  388. line-height: 98rpx;
  389. font-family: PingFang SC, PingFang SC-Medium;
  390. font-weight: 500;
  391. color: #ffffff;
  392. }
  393. .screen-pop {
  394. background: #fff;
  395. padding: 40rpx 0 0;
  396. border-radius: 20rpx 20rpx 0 0;
  397. .cell {
  398. padding: 0 24rpx;
  399. margin-bottom: 40rpx;
  400. .label {
  401. font-size: 30rpx;
  402. color: #555;
  403. width: 160rpx;
  404. }
  405. .desc {
  406. margin-top: 30rpx;
  407. background: #f4f5f6;
  408. border-radius: 8rpx;
  409. height: 88rpx;
  410. .input-box {
  411. padding: 0 16rpx;
  412. height: 88rpx;
  413. font-size: 28rpx;
  414. color: #555;
  415. }
  416. }
  417. }
  418. .btns {
  419. display: flex;
  420. flex-flow: row nowrap;
  421. .btn {
  422. width: 50%;
  423. height: 88rpx;
  424. text-align: center;
  425. line-height: 88rpx;
  426. font-size: 32rpx;
  427. font-weight: 500;
  428. }
  429. .reset-btn {
  430. background-color: #F4F5F7;
  431. color: #04BE02;
  432. }
  433. .submit-btn {
  434. background-color: #04BE02;
  435. color: #fff;
  436. }
  437. }
  438. .tips {
  439. margin-top: 16rpx;
  440. font-size: 24rpx;
  441. color: #f00;
  442. }
  443. }
  444. </style>