introduce-list.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <template>
  2. <view class="user_list">
  3. <view class="search flexB">
  4. <view class="inp flexB">
  5. <text class="iconfont iconsearch"></text>
  6. <input type="text" v-model="searchName" placeholder="介绍人昵称/手机号" maxlength="11" @input="getVal" />
  7. <text class="iconfont iconguanbi1" @click="(searchName = ''), getList()"></text>
  8. </view>
  9. <view class="search_btn" @click="search">查询</view>
  10. </view>
  11. <view class="scroll">
  12. <scroll-view scroll-y="true">
  13. <view class="list">
  14. <view class="list_con flexB" v-for="(item,idx) in userList" :key="item.id"
  15. @click="checked(item,idx)">
  16. <view>
  17. <text style="font-size:32rpx;font-weight: 600;">{{ item.nickname|getName(18) }}</text>
  18. <view style="font-size:28rpx;margin-top:10rpx;">{{ item.phone }}</view>
  19. </view>
  20. <view class="check_box">
  21. <image src="../../../static/imgs/shop/checked.png" v-if="item.isChecked"></image>
  22. <image src="../../../static/imgs/shop/uncheck.png" v-else></image>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="noData" v-if="userList.length == 0">
  27. <image src="/static/imgs/default/no_record.png"></image>
  28. <view>暂无用户信息~</view>
  29. </view>
  30. </scroll-view>
  31. </view>
  32. <view class="pop flexCC" v-if="showPop">
  33. <view class="pop_con">
  34. <view class="hint">
  35. <image src="../../../static/imgs/shop/hint_icon.png" class="hint_icon"></image>
  36. <view class="title">确认信息</view>
  37. </view>
  38. <view class="con">
  39. <view>昵称:{{userInfo.nickname}}</view>
  40. <view style="margin-top:14rpx">手机号:{{userInfo.phone}}</view>
  41. </view>
  42. <view class="btn_box flexB">
  43. <view class="flexC" @click="showPop=false">取消</view>
  44. <view class="flexC" @click="toBind">确认绑定</view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="add_new flexC" @click="skipAdd">+新增介绍人</view>
  49. </view>
  50. </template>
  51. <script>
  52. import {
  53. getAllRecomer,
  54. bindRecomer,
  55. editBindRecomer
  56. } from '@/apis/shop.js';
  57. export default {
  58. data() {
  59. return {
  60. userList: [], //下级经销商列表
  61. searchName: '', //查找内容
  62. curId: '', //当前选择的用户id
  63. user: '', //用户的相关信息
  64. isShare: '',
  65. order_id: '',
  66. order_no: '',
  67. showPop: false,
  68. userInfo: '',
  69. remark: ''
  70. };
  71. },
  72. onLoad(ops) {
  73. this.order_id = ops.order_id
  74. this.order_no = ops.order_no
  75. if (ops.remark) {
  76. this.remark = ops.remark
  77. }
  78. },
  79. onShow() {
  80. this.getList();
  81. },
  82. methods: {
  83. //跳转到添加用户
  84. skipAdd() {
  85. uni.navigateTo({
  86. url: '../introduce/introduce?order_id=' + this.order_id + '&&order_no=' + this.order_no +
  87. '&remark=' + this.remark
  88. });
  89. },
  90. // 绑定介绍人
  91. toBind() {
  92. let http = this.remark ? editBindRecomer : bindRecomer
  93. let data = this.remark ? {
  94. id: this.userInfo.id,
  95. order_id: this.order_id,
  96. remark: this.remark
  97. } : {
  98. id: this.userInfo.id,
  99. order_id: this.order_id,
  100. };
  101. http(data).then(res => {
  102. if (res.code === 200) {
  103. this.showPop = false
  104. uni.showModal({
  105. content: this.remark ? '更换介绍人成功' : '绑定介绍人成功',
  106. showCancel: false,
  107. success: suc => {
  108. uni.reLaunch({
  109. url: '../../../pages/order-info/order-info?order_no=' +
  110. this.order_no
  111. })
  112. }
  113. })
  114. } else {
  115. uni.showModal({
  116. content: res.data,
  117. showCancel: false
  118. })
  119. }
  120. })
  121. },
  122. /*输入框清空时重新加载列表*/
  123. getVal(e) {
  124. if (e.detail.value == '') {
  125. this.getList();
  126. }
  127. },
  128. /*选择某个介绍人*/
  129. checked(item, idx) {
  130. let list = this.userList
  131. for (let i = 0; i < list.length; i++) {
  132. if (i === idx) {
  133. list[i].isChecked = true
  134. } else {
  135. list[i].isChecked = false
  136. }
  137. }
  138. this.userInfo = item
  139. this.showPop = true
  140. },
  141. /*获取介绍人列表*/
  142. getList() {
  143. uni.showLoading({
  144. title: '加载中...'
  145. })
  146. getAllRecomer({
  147. search_name: this.searchName
  148. }).then(res => {
  149. if (res.code == 200) {
  150. let data = res.data
  151. data.map(i => {
  152. this.$set(i, 'isChecked', false)
  153. })
  154. this.userList = data
  155. } else {
  156. uni.showModal({
  157. content: res.data,
  158. showCancel: false
  159. });
  160. }
  161. uni.hideLoading()
  162. }).catch(() => {
  163. uni.hideLoading()
  164. })
  165. },
  166. /*点击查询按钮*/
  167. search() {
  168. if (!this.searchName) {
  169. uni.showModal({
  170. content: '请输入搜索内容',
  171. showCancel: false
  172. });
  173. return false;
  174. }
  175. this.getList();
  176. },
  177. }
  178. };
  179. </script>
  180. <style lang="scss">
  181. .user_list {
  182. width: 100vw;
  183. min-height: 100%;
  184. background-color: #f9f9fb;
  185. position: relative;
  186. .search {
  187. width: 100%;
  188. height: 10vh;
  189. background-color: #fff;
  190. padding: 0 30rpx;
  191. box-sizing: border-box;
  192. .inp {
  193. height: 80rpx;
  194. border: 2rpx solid #cccccc;
  195. border-radius: 44rpx;
  196. padding: 0 30rpx;
  197. box-sizing: border-box;
  198. input {
  199. width: 80%;
  200. height: 100%;
  201. }
  202. .iconfont {
  203. font-size: 50rpx;
  204. color: #ccc;
  205. }
  206. }
  207. .query {
  208. margin-right: 30rpx;
  209. width: 120rpx;
  210. height: 56rpx;
  211. text-align: center;
  212. line-height: 56rpx;
  213. background: linear-gradient(94deg, #a080ff 0%, #5d6bff 100%);
  214. font-size: 28rpx;
  215. color: #fff;
  216. border-radius: 44rpx;
  217. }
  218. }
  219. .scroll {
  220. height: 84vh;
  221. scroll-view {
  222. height: 100%;
  223. }
  224. .list {
  225. margin-top: 30rpx;
  226. padding-bottom: 120rpx;
  227. .list_con {
  228. width: 690rpx;
  229. height: 128rpx;
  230. background: #fff;
  231. margin: 0 auto 30rpx;
  232. background-color: #fff;
  233. padding: 0 30rpx;
  234. box-sizing: border-box;
  235. border-radius: 25rpx;
  236. image {
  237. height: 36rpx;
  238. width: 36rpx;
  239. }
  240. .check_box {
  241. image {
  242. width: 44rpx;
  243. height: 44rpx;
  244. }
  245. }
  246. }
  247. }
  248. }
  249. .btn_box {
  250. width: 80%;
  251. margin: 0 auto;
  252. view {
  253. width: 260rpx;
  254. height: 78rpx;
  255. line-height: 78rpx;
  256. font-size: 32rpx;
  257. border-radius: 44rpx;
  258. }
  259. .after_btn {
  260. border: 2rpx solid $base-color;
  261. }
  262. }
  263. .hint {
  264. width: 100%;
  265. text-align: center;
  266. padding: 20rpx 0 0;
  267. color: $base-color;
  268. font-size: 30rpx;
  269. }
  270. }
  271. .add_new {
  272. width: 100%;
  273. height: 100rpx;
  274. background: $base-line-bg;
  275. color: #fff;
  276. position: fixed;
  277. bottom: 0;
  278. left: 0;
  279. font-size: 30rpx;
  280. }
  281. .pop {
  282. width: 100%;
  283. height: 100vh;
  284. position: fixed;
  285. top: 0;
  286. left: 0;
  287. background-color: rgba(0, 0, 0, 0.7);
  288. z-index: 9999999;
  289. .hint_icon {
  290. width: 183rpx;
  291. height: 135rpx;
  292. position: relative;
  293. margin-top: -85rpx;
  294. }
  295. .pop_con {
  296. width: 648rpx;
  297. height: 442rpx;
  298. background: #fff;
  299. border-radius: 26rpx;
  300. display: flex;
  301. flex-direction: column;
  302. // align-items: center;
  303. padding: 0 30rpx;
  304. box-sizing: border-box;
  305. .hint {
  306. width: 100%;
  307. text-align: center;
  308. .title {
  309. font-size: 36rpx;
  310. font-weight: bold;
  311. margin-top: 22rpx;
  312. }
  313. }
  314. .con {
  315. min-height: 120rpx;
  316. margin: 20rpx 0 20rpx;
  317. font-size: 34rpx;
  318. }
  319. .btn_box {
  320. width: 100%;
  321. view {
  322. width: 270rpx;
  323. height: 88rpx;
  324. background: #FFF4F3;
  325. border: 2rpx solid #FB231F;
  326. border-radius: 44rpx;
  327. color: $base-color;
  328. font-size: 32rpx;
  329. }
  330. view:last-child {
  331. background: $base-line-bg;
  332. color: #fff;
  333. }
  334. }
  335. }
  336. .iconfont {
  337. color: #fff;
  338. font-size: 60rpx;
  339. margin-top: 30rpx;
  340. }
  341. }
  342. </style>