index.vue 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899
  1. <template>
  2. <!-- 用户-用户列表 -->
  3. <div>
  4. <Card :bordered="false" dis-hover class="ivu-mt" :padding="0">
  5. <div class="padding-add">
  6. <!-- 筛选条件 -->
  7. <Form
  8. ref="userFrom"
  9. :model="userFrom"
  10. :label-width="labelWidth"
  11. :label-position="labelPosition"
  12. @submit.native.prevent
  13. >
  14. <Row :gutter="24">
  15. <Col span="18">
  16. <Row>
  17. <Col span="24">
  18. <Row>
  19. <Col>
  20. <FormItem label="用户搜索:" label-for="nickname">
  21. <Input
  22. v-model="userFrom.nickname"
  23. placeholder="请输入"
  24. element-id="nickname"
  25. clearable
  26. class="input-add"
  27. >
  28. <Select
  29. v-model="field_key"
  30. slot="prepend"
  31. style="width: 80px"
  32. >
  33. <Option value="all">全部</Option>
  34. <Option value="uid">UID</Option>
  35. <Option value="phone">手机号</Option>
  36. <Option value="nickname">用户昵称</Option>
  37. </Select>
  38. </Input>
  39. </FormItem>
  40. </Col>
  41. </Row>
  42. </Col>
  43. </Row>
  44. </Col>
  45. <template v-if="collapse">
  46. <Col span="18">
  47. <Row>
  48. <Col>
  49. <FormItem label="用户分组:" label-for="group_id">
  50. <Select
  51. v-model="userFrom.group_id"
  52. placeholder="请选择"
  53. element-id="group_id"
  54. clearable
  55. class="input-add"
  56. >
  57. <!-- <Option value="">全部</Option>-->
  58. <Option
  59. :value="item.id"
  60. v-for="(item, index) in groupList"
  61. :key="index"
  62. >{{ item.group_name }}</Option
  63. >
  64. </Select>
  65. </FormItem>
  66. </Col>
  67. <Col>
  68. <FormItem label="用户标签:" label-for="label_id">
  69. <div
  70. class="labelInput acea-row row-between-wrapper input-add"
  71. @click="openLabelList"
  72. >
  73. <div>
  74. <div v-if="dataLabel.length">
  75. <Tag
  76. closable
  77. v-for="(item, index) in dataLabel"
  78. :key="index"
  79. @on-close="closeLabel(item)"
  80. >{{ item.label_name }}</Tag
  81. >
  82. </div>
  83. <span class="span" v-else>请选择</span>
  84. </div>
  85. <div class="iconfont iconxiayi"></div>
  86. </div>
  87. </FormItem>
  88. </Col>
  89. <Col>
  90. <FormItem label="性别:" label-for="sex">
  91. <Select
  92. v-model="userFrom.sex"
  93. placeholder="请选择"
  94. clearable
  95. class="input-add"
  96. >
  97. <!-- <Option value="">全部</Option>-->
  98. <Option value="1">男</Option>
  99. <Option value="2">女</Option>
  100. <Option value="0">未知</Option>
  101. </Select>
  102. </FormItem>
  103. </Col>
  104. </Row>
  105. </Col>
  106. <Col span="18">
  107. <Row>
  108. <Col>
  109. <FormItem label="会员等级:" label-for="level">
  110. <Select
  111. v-model="userFrom.level"
  112. placeholder="请选择"
  113. element-id="level"
  114. clearable
  115. class="input-add"
  116. >
  117. <!-- <Option value="">全部</Option>-->
  118. <Option
  119. :value="item.id"
  120. v-for="(item, index) in levelList"
  121. :key="index"
  122. >{{ item.name }}</Option
  123. >
  124. </Select>
  125. </FormItem>
  126. </Col>
  127. <Col>
  128. <FormItem label="付费会员:" label-for="isMember">
  129. <Select
  130. v-model="userFrom.isMember"
  131. placeholder="请选择"
  132. clearable
  133. class="input-add"
  134. >
  135. <!-- <Option value="">全部</Option>-->
  136. <Option value="1">是</Option>
  137. <Option value="0">否</Option>
  138. </Select>
  139. </FormItem>
  140. </Col>
  141. <Col>
  142. <FormItem label="身份:">
  143. <Select
  144. v-model="userFrom.is_promoter"
  145. placeholder="请选择"
  146. clearable
  147. class="input-add"
  148. >
  149. <!-- <Option value="">全部</Option>-->
  150. <Option value="1">推广员</Option>
  151. <Option value="0">普通用户</Option>
  152. </Select>
  153. </FormItem>
  154. </Col>
  155. </Row>
  156. </Col>
  157. <Col span="18">
  158. <Row>
  159. <Col class="dateMedia">
  160. <FormItem label="访问时间:" label-for="user_time">
  161. <DatePicker
  162. :editable="false"
  163. @on-change="onchangeTime"
  164. :value="timeVal"
  165. format="yyyy/MM/dd"
  166. type="daterange"
  167. placement="bottom-start"
  168. placeholder="自定义时间"
  169. :options="options"
  170. class="input-add"
  171. ></DatePicker>
  172. </FormItem>
  173. </Col>
  174. <Col>
  175. <FormItem label="访问情况:" label-for="user_time_type">
  176. <Select
  177. v-model="userFrom.user_time_type"
  178. placeholder="请选择"
  179. element-id="user_time_type"
  180. clearable
  181. class="input-add"
  182. >
  183. <!-- <Option value="all">全部</Option>-->
  184. <Option value="visitno">时间段未访问</Option>
  185. <Option value="visit">时间段访问过</Option>
  186. <Option value="add_time">首次访问</Option>
  187. </Select>
  188. </FormItem>
  189. </Col>
  190. <Col>
  191. <FormItem label="下单次数:" label-for="pay_count">
  192. <Select
  193. v-model="userFrom.pay_count"
  194. placeholder="请选择"
  195. element-id="pay_count"
  196. clearable
  197. class="input-add"
  198. >
  199. <!-- <Option value="">全部</Option>-->
  200. <Option value="-1">0次</Option>
  201. <Option value="0">1次以上</Option>
  202. <Option value="1">2次以上</Option>
  203. <Option value="2">3次以上</Option>
  204. <Option value="3">4次以上</Option>
  205. <Option value="4">5次以上</Option>
  206. </Select>
  207. </FormItem>
  208. </Col>
  209. </Row>
  210. </Col>
  211. <Col span="18">
  212. <Row>
  213. <Col>
  214. <FormItem label="国家:" label-for="country">
  215. <Select
  216. v-model="userFrom.country"
  217. placeholder="请选择"
  218. element-id="country"
  219. clearable
  220. @on-change="changeCountry"
  221. class="input-add"
  222. >
  223. <!-- <Option value="">全部</Option>-->
  224. <Option value="domestic">中国</Option>
  225. <Option value="abroad">其他</Option>
  226. </Select>
  227. </FormItem>
  228. </Col>
  229. <Col v-if="userFrom.country === 'domestic'">
  230. <FormItem label="省份:">
  231. <Cascader
  232. :data="addresData"
  233. change-on-select
  234. :value="address"
  235. v-model="address"
  236. @on-change="handleChange"
  237. class="input-add"
  238. ></Cascader>
  239. </FormItem>
  240. </Col>
  241. </Row>
  242. </Col>
  243. </template>
  244. <Col span="6" class="ivu-text-right userFrom">
  245. <FormItem>
  246. <Button
  247. type="primary"
  248. label="default"
  249. class="mr15"
  250. @click="userSearchs"
  251. >搜索</Button
  252. >
  253. <Button class="ResetSearch" @click="reset('userFrom')"
  254. >重置</Button
  255. >
  256. <a v-font="14" class="ivu-ml-8" @click="collapse = !collapse">
  257. <template v-if="!collapse">
  258. 展开 <Icon type="ios-arrow-down" />
  259. </template>
  260. <template v-else>
  261. 收起 <Icon type="ios-arrow-up" />
  262. </template>
  263. </a>
  264. </FormItem>
  265. </Col>
  266. </Row>
  267. </Form>
  268. </div>
  269. </Card>
  270. <Card :bordered="false" dis-hover class="ivu-mt listbox">
  271. <div class="new_tab">
  272. <!-- Tab栏切换 -->
  273. <Tabs v-model="headeType" @on-click="onClickTab">
  274. <TabPane
  275. :label="item.name"
  276. :name="item.type"
  277. v-for="(item, index) in headeNum"
  278. :key="index"
  279. />
  280. </Tabs>
  281. </div>
  282. <Row type="flex" justify="space-between">
  283. <!-- 相关操作 -->
  284. <Col span="24">
  285. <Button
  286. v-auth="['admin-user-save']"
  287. type="primary"
  288. class="mr20"
  289. @click="save"
  290. >添加用户</Button
  291. >
  292. <Tooltip
  293. content="本页至少选中一项"
  294. :disabled="!!checkUidList.length && isAll==0"
  295. >
  296. <Button
  297. v-auth="['admin-user-coupon']"
  298. type="primary"
  299. class="mr20"
  300. :disabled="!checkUidList.length && isAll==0"
  301. @click="onSend"
  302. >发送优惠券</Button
  303. >
  304. <Button
  305. v-auth="['admin-user-coupon']"
  306. type="primary"
  307. class="mr20"
  308. :disabled="!checkUidList.length && isAll==0"
  309. @click="sendMsg"
  310. >发送短信</Button
  311. >
  312. </Tooltip>
  313. <Tooltip
  314. content="本页至少选中一项"
  315. :disabled="!!checkUidList.length && isAll==0"
  316. >
  317. <Button
  318. v-auth="['admin-wechat-news']"
  319. class="greens mr20"
  320. size="default"
  321. :disabled="!checkUidList.length && isAll==0"
  322. @click="onSendPic"
  323. v-if="userFrom.user_type === 'wechat'"
  324. >
  325. <Icon type="md-list"></Icon>
  326. 发送图文消息
  327. </Button>
  328. </Tooltip>
  329. <Tooltip
  330. content="本页至少选中一项"
  331. :disabled="!!checkUidList.length && isAll==0"
  332. >
  333. <Button
  334. v-auth="['admin-user-set_label']"
  335. class="mr20"
  336. :disabled="!checkUidList.length && isAll==0"
  337. @click="setBatch"
  338. >批量设置</Button
  339. >
  340. </Tooltip>
  341. </Col>
  342. </Row>
  343. <!-- 用户列表表格 -->
  344. <vxe-table
  345. ref="xTable"
  346. class="mt25"
  347. :loading="loading"
  348. row-id="uid"
  349. :expand-config="{accordion: true}"
  350. :checkbox-config="{reserve: true}"
  351. @checkbox-all="checkboxAll"
  352. @checkbox-change="checkboxItem"
  353. :data="userLists">
  354. <vxe-column type="" width="0"></vxe-column>
  355. <vxe-column type="expand" width="35">
  356. <template #content="{ row }">
  357. <div class="tdinfo">
  358. <Row class="expand-row">
  359. <Col span="6">
  360. <span class="expand-key">首次访问:</span>
  361. <span class="expand-value"> {{row.add_time | formatDate}}</span>
  362. </Col>
  363. <Col span="6">
  364. <span class="expand-key">近次访问:</span>
  365. <span class="expand-value">{{row.last_time | formatDate}}</span>
  366. </Col>
  367. <Col span="6">
  368. <span class="expand-key">身份证号:</span>
  369. <span class="expand-value">{{row.card_id}}</span>
  370. </Col>
  371. <Col span="6">
  372. <span class="expand-key">真实姓名:</span>
  373. <span class="expand-value">{{row.real_name}}</span>
  374. </Col>
  375. <!-- <Col span="6">
  376. <span class="expand-key">手机号:</span>
  377. <span class="expand-value">{{row.phone}}</span>
  378. </Col> -->
  379. </Row>
  380. <Row class="expand-row">
  381. <!-- <Col span="6">
  382. <span class="expand-key">真实姓名:</span>
  383. <span class="expand-value">{{row.real_name}}</span>
  384. </Col> -->
  385. <Col span="6">
  386. <span class="expand-key">标签:</span>
  387. <span class="expand-value">{{row.labels}}</span>
  388. </Col>
  389. <Col span="6">
  390. <span class="expand-key">生日:</span>
  391. <span class="expand-value">{{row.birthday}}</span>
  392. </Col>
  393. <Col span="6">
  394. <span class="expand-key">地址:</span>
  395. <span class="expand-value">{{row.addres}}</span>
  396. </Col>
  397. </Row>
  398. <Row class="expand-row">
  399. <Col span="6">
  400. <span class="expand-key">备注:</span>
  401. <span class="expand-value">{{row.mark}}</span>
  402. </Col>
  403. </Row>
  404. </div>
  405. </template>
  406. </vxe-column>
  407. <vxe-column type="checkbox" width="100">
  408. <template #header>
  409. <div>
  410. <Dropdown transfer @on-click="allPages">
  411. <a href="javascript:void(0)" class="acea-row row-middle">
  412. <span>全选({{isAll==1?(total-checkUidList.length):checkUidList.length}})</span>
  413. <Icon type="ios-arrow-down"></Icon>
  414. </a>
  415. <template #list>
  416. <DropdownMenu>
  417. <DropdownItem name="0">当前页</DropdownItem>
  418. <DropdownItem name="1">所有页</DropdownItem>
  419. </DropdownMenu>
  420. </template>
  421. </Dropdown>
  422. </div>
  423. </template>
  424. </vxe-column>
  425. <vxe-column field="uid" title="UID" width="60"></vxe-column>
  426. <vxe-column field="avatars" title="头像" width="50">
  427. <template v-slot="{ row }">
  428. <viewer>
  429. <div class="tabBox_img">
  430. <img v-lazy="row.avatar" />
  431. </div>
  432. </viewer>
  433. </template>
  434. </vxe-column>
  435. <vxe-column field="nickname" title="昵称" min-width="150">
  436. <template v-slot="{ row }">
  437. <div class="acea-row">
  438. <Icon
  439. type="md-male"
  440. v-show="row.sex === '男'"
  441. color="#2db7f5"
  442. size="15"
  443. class="mr5"
  444. />
  445. <Icon
  446. type="md-female"
  447. v-show="row.sex === '女'"
  448. color="#ed4014"
  449. size="15"
  450. class="mr5"
  451. />
  452. <div v-if="row.delete_time != null" style="color:#ed4014;">{{row.nickname}} (已注销)</div>
  453. <div v-else v-text="row.nickname"></div>
  454. </div>
  455. </template>
  456. </vxe-column>
  457. <vxe-column field="isMember" title="付费会员" min-width="90">
  458. <template v-slot="{ row }">
  459. <div>{{ row.isMember ? "是" : "否" }}</div>
  460. </template>
  461. </vxe-column>
  462. <vxe-column field="level" title="用户等级" min-width="90"></vxe-column>
  463. <vxe-column field="group_id" title="分组" min-width="100"></vxe-column>
  464. <vxe-column field="phone" title="手机号" min-width="110"></vxe-column>
  465. <vxe-column field="user_type" title="用户类型" min-width="100"></vxe-column>
  466. <vxe-column field="spread_uid_nickname" title="推荐人" min-width="100"></vxe-column>
  467. <vxe-column field="now_money" title="余额" min-width="100"></vxe-column>
  468. <vxe-column field="action" title="操作" align="center" width="180" fixed="right">
  469. <template v-slot="{ row }">
  470. <span v-if="row.delete_time != null" style="color: #c5c8ce;">编辑</span>
  471. <a v-else @click="edit(row)">编辑</a>
  472. <Divider type="vertical" v-if="row.is_extend_info"/>
  473. <a @click="extendInfo(row)" v-if="row.is_extend_info">信息补充</a>
  474. <Divider type="vertical" />
  475. <a @click="changeMenu(row, '1')">详情</a>
  476. </template>
  477. </vxe-column>
  478. </vxe-table>
  479. <vxe-pager class="mt20" border size="medium" :page-size="userFrom.limit" :current-page="userFrom.page" :total="total"
  480. :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Total']" @page-change="pageChange">
  481. </vxe-pager>
  482. </Card>
  483. <!-- 用户标签 -->
  484. <Modal
  485. v-model="labelListShow"
  486. scrollable
  487. title="选择用户标签"
  488. :closable="true"
  489. width="540"
  490. :footer-hide="true"
  491. :mask-closable="false"
  492. >
  493. <labelList
  494. ref="labelList"
  495. @activeData="activeData"
  496. @close="labelListClose"
  497. ></labelList>
  498. </Modal>
  499. <!-- 编辑表单 积分余额-->
  500. <edit-from
  501. ref="edits"
  502. :FromData="FromData"
  503. :userEdit="1"
  504. @submitFail="submitFail"
  505. ></edit-from>
  506. <!-- 发送优惠券-->
  507. <send-from
  508. ref="sends"
  509. :is-all="isAll"
  510. :where="userFrom"
  511. :userIds="checkUidList.join(',')"
  512. ></send-from>
  513. <!-- 会员详情-->
  514. <user-details ref="userDetails" :group-list="groupList"></user-details>
  515. <!--发送图文消息 -->
  516. <Modal
  517. v-model="modal14"
  518. scrollable
  519. title="发送消息"
  520. width="600"
  521. height="800"
  522. footer-hide
  523. class="modelBox"
  524. >
  525. <el-input
  526. type="textarea"
  527. placeholder="请输入短信内容"
  528. v-model="textarea"
  529. maxlength="50"
  530. show-word-limit
  531. >
  532. </el-input>
  533. <div style="padding-top: 20px;display: flex;justify-content: flex-end;">
  534. <Button type="primary" @click="msgSend()" style="margin-right: 20px;">发送</Button>
  535. <Button @click="msgCancel()">取消</Button>
  536. </div>
  537. </Modal>
  538. <!--修改推广人-->
  539. <Modal
  540. v-model="promoterShow"
  541. scrollable
  542. title="修改推广人"
  543. class="order_box"
  544. :closable="false"
  545. >
  546. <Form
  547. ref="formInline"
  548. :model="formInline"
  549. :label-width="100"
  550. @submit.native.prevent
  551. >
  552. <FormItem label="用户头像:" prop="image">
  553. <div class="picBox" @click="customer">
  554. <div class="pictrue" v-if="formInline.image">
  555. <img v-lazy="formInline.image" />
  556. </div>
  557. <div class="upLoad acea-row row-center-wrapper" v-else>
  558. <Icon type="ios-camera-outline" size="26" />
  559. </div>
  560. </div>
  561. </FormItem>
  562. </Form>
  563. <div slot="footer">
  564. <Button type="primary" @click="putSend('formInline')">提交</Button>
  565. <Button @click="cancel('formInline')">取消</Button>
  566. </div>
  567. </Modal>
  568. <Modal
  569. v-model="customerShow"
  570. scrollable
  571. title="请选择商城用户"
  572. :closable="false"
  573. width="900"
  574. >
  575. <customerInfo
  576. v-if="customerShow"
  577. @imageObject="imageObject"
  578. ></customerInfo>
  579. </Modal>
  580. <Modal
  581. v-model="labelShow"
  582. scrollable
  583. title="选择用户标签"
  584. :closable="true"
  585. width="540"
  586. :footer-hide="true"
  587. >
  588. <userLabel :uid="labelActive.uid" @close="labelClose"></userLabel>
  589. </Modal>
  590. <!-- 批量设置 -->
  591. <Modal v-model="batchModal" title="批量设置" width="750" class-name="batch-modal" @on-visible-change="batchVisibleChange">
  592. <Alert show-icon>每次只能修改一项,如需修改多项,请多次操作。</Alert>
  593. <Row type="flex" align="middle">
  594. <Col span="4">
  595. <Menu :active-name="menuActive" width="auto" @on-select="menuSelect">
  596. <MenuItem :name="1">用户分组</MenuItem>
  597. <MenuItem :name="2">用户标签</MenuItem>
  598. <MenuItem :name="3">用户等级</MenuItem>
  599. <MenuItem :name="4">积分余额</MenuItem>
  600. <MenuItem :name="5">赠送会员</MenuItem>
  601. <MenuItem :name="6">上级推广人</MenuItem>
  602. </Menu>
  603. </Col>
  604. <Col span="20">
  605. <Form :model="batchData" :label-width="122">
  606. <FormItem v-if="menuActive === 1" label="用户分组:">
  607. <Select v-model="batchData.group_id">
  608. <Option v-for="item in groupList" :key="item.id" :value="item.id">{{ item.group_name }}</Option>
  609. </Select>
  610. </FormItem>
  611. <FormItem v-if="menuActive === 2" label="用户标签:">
  612. <div class="select-tag" @click="openLabelList">
  613. <div v-if="batchLabel.length">
  614. <Tag v-for="item in batchLabel" :key="item.id" closable @on-close="tagClose(item.id)">{{ item.label_name }}</Tag>
  615. </div>
  616. <span v-else class="placeholder">请选择</span>
  617. <Icon type="ios-arrow-down" />
  618. </div>
  619. </FormItem>
  620. <FormItem v-if="menuActive === 3" label="用户等级:">
  621. <Select v-model="batchData.level_id">
  622. <Option v-for="item in levelList" :key="item.id" :value="item.id">{{ item.name }}</Option>
  623. </Select>
  624. </FormItem>
  625. <FormItem v-if="menuActive === 4" label="修改余额:">
  626. <RadioGroup v-model="batchData.money_status">
  627. <Radio :label="1">增加</Radio>
  628. <Radio :label="2">减少</Radio>
  629. </RadioGroup>
  630. </FormItem>
  631. <FormItem v-if="menuActive === 4" label="余额:">
  632. <InputNumber v-model="batchData.money" :min="0" :max="999999"></InputNumber>
  633. </FormItem>
  634. <FormItem v-if="menuActive === 4" label="修改积分:">
  635. <RadioGroup v-model="batchData.integration_status">
  636. <Radio :label="1">增加</Radio>
  637. <Radio :label="2">减少</Radio>
  638. </RadioGroup>
  639. </FormItem>
  640. <FormItem v-if="menuActive === 4" label="积分:">
  641. <InputNumber v-model="batchData.integration" :min="0" :max="999999"></InputNumber>
  642. </FormItem>
  643. <FormItem v-if="menuActive === 5" label="修改时长:">
  644. <RadioGroup v-model="batchData.days_status">
  645. <Radio :label="1">增加</Radio>
  646. <Radio :label="2">减少</Radio>
  647. </RadioGroup>
  648. </FormItem>
  649. <FormItem v-if="menuActive === 5" label="修改时长(天):">
  650. <InputNumber v-model="batchData.day" :min="0" :max="999999"></InputNumber>
  651. </FormItem>
  652. <FormItem v-if="menuActive === 6" label="上级推广员:">
  653. <Input :value="spread_name" placeholder="请选择" icon="ios-arrow-down" @on-click="customer" @on-focus="customer"></Input>
  654. </FormItem>
  655. </Form>
  656. </Col>
  657. </Row>
  658. <div slot="footer">
  659. <Button @click="cancelBatch">取消</Button>
  660. <Button type="primary" @click="saveBatch">保存</Button>
  661. </div>
  662. </Modal>
  663. </div>
  664. </template>
  665. <script>
  666. import { formatDate } from '@/utils/validate';
  667. import userLabel from "../../../components/userLabel";
  668. import labelList from "@/components/labelList";
  669. import { mapState } from "vuex";
  670. import expandRow from "./tableExpand.vue";
  671. import {
  672. userList,
  673. getUserData,
  674. isShowApi,
  675. editOtherApi,
  676. giveLevelApi,
  677. userSetGroup,
  678. userGroupApi,
  679. levelListApi,
  680. userSetLabelApi,
  681. userLabelApi,
  682. userSynchro,
  683. getUserSaveForm,
  684. giveLevelTimeApi,
  685. extendInfo,
  686. batchProcess,
  687. sendMsgs
  688. } from "@/api/user";
  689. import { agentSpreadApi } from "@/api/agent";
  690. import editFrom from "../../../components/from/from";
  691. import sendFrom from "@/components/sendCoupons/index";
  692. import userDetails from "./handle/userDetails";
  693. import newsCategory from "@/components/newsCategory/index";
  694. import city from "@/utils/city";
  695. import customerInfo from "@/components/customerInfo";
  696. export default {
  697. name: "user_list",
  698. filters: {
  699. formatDate (time) {
  700. if (time !== 0) {
  701. let date = new Date(time * 1000);
  702. return formatDate(date, 'yyyy-MM-dd hh:mm');
  703. }
  704. }
  705. },
  706. components: {
  707. expandRow,
  708. editFrom,
  709. sendFrom,
  710. userDetails,
  711. newsCategory,
  712. customerInfo,
  713. userLabel,
  714. labelList,
  715. },
  716. data() {
  717. return {
  718. textarea: '',
  719. modal14: false,
  720. dataLabel: [],
  721. labelListShow: false,
  722. labelShow: false,
  723. customerShow: false,
  724. promoterShow: false,
  725. labelActive: {
  726. uid: 0,
  727. },
  728. formInline: {
  729. uid: 0,
  730. spread_uid: 0,
  731. image: "",
  732. },
  733. options: {
  734. shortcuts: [
  735. {
  736. text: "今天",
  737. value() {
  738. const end = new Date();
  739. const start = new Date();
  740. start.setTime(
  741. new Date(
  742. new Date().getFullYear(),
  743. new Date().getMonth(),
  744. new Date().getDate()
  745. )
  746. );
  747. return [start, end];
  748. },
  749. },
  750. {
  751. text: "昨天",
  752. value() {
  753. const end = new Date();
  754. const start = new Date();
  755. start.setTime(
  756. start.setTime(
  757. new Date(
  758. new Date().getFullYear(),
  759. new Date().getMonth(),
  760. new Date().getDate() - 1
  761. )
  762. )
  763. );
  764. end.setTime(
  765. end.setTime(
  766. new Date(
  767. new Date().getFullYear(),
  768. new Date().getMonth(),
  769. new Date().getDate() - 1
  770. )
  771. )
  772. );
  773. return [start, end];
  774. },
  775. },
  776. {
  777. text: "最近7天",
  778. value() {
  779. const end = new Date();
  780. const start = new Date();
  781. start.setTime(
  782. start.setTime(
  783. new Date(
  784. new Date().getFullYear(),
  785. new Date().getMonth(),
  786. new Date().getDate() - 6
  787. )
  788. )
  789. );
  790. return [start, end];
  791. },
  792. },
  793. {
  794. text: "最近30天",
  795. value() {
  796. const end = new Date();
  797. const start = new Date();
  798. start.setTime(
  799. start.setTime(
  800. new Date(
  801. new Date().getFullYear(),
  802. new Date().getMonth(),
  803. new Date().getDate() - 29
  804. )
  805. )
  806. );
  807. return [start, end];
  808. },
  809. },
  810. {
  811. text: "上月",
  812. value() {
  813. const end = new Date();
  814. const start = new Date();
  815. const day = new Date(start.getFullYear(), start.getMonth(), 0).getDate();
  816. start.setTime(
  817. start.setTime(
  818. new Date(new Date().getFullYear(), new Date().getMonth()-1, 1)
  819. )
  820. );
  821. end.setTime(
  822. end.setTime(
  823. new Date(new Date().getFullYear(), new Date().getMonth()-1, day)
  824. )
  825. );
  826. return [start, end];
  827. },
  828. },
  829. {
  830. text: "本月",
  831. value() {
  832. const end = new Date();
  833. const start = new Date();
  834. start.setTime(
  835. start.setTime(
  836. new Date(new Date().getFullYear(), new Date().getMonth(), 1)
  837. )
  838. );
  839. return [start, end];
  840. },
  841. },
  842. {
  843. text: "本年",
  844. value() {
  845. const end = new Date();
  846. const start = new Date();
  847. start.setTime(
  848. start.setTime(new Date(new Date().getFullYear(), 0, 1))
  849. );
  850. return [start, end];
  851. },
  852. },
  853. ],
  854. },
  855. collapse: false,
  856. headeType: "-1",
  857. headeNum: [
  858. { type: "-1", name: "全部" },
  859. { type: "wechat", name: "微信公众号" },
  860. { type: "routine", name: "微信小程序" },
  861. { type: "h5", name: "H5" },
  862. { type: "pc", name: "PC" },
  863. { type: "app", name: "APP" },
  864. ],
  865. address: [],
  866. addresData: city,
  867. isShowSend: true,
  868. modal13: false,
  869. maxCols: 4,
  870. scrollerHeight: "600",
  871. contentTop: "130",
  872. contentWidth: "98%",
  873. // grid: {
  874. // xl: 8,
  875. // lg: 8,
  876. // md: 12,
  877. // sm: 24,
  878. // xs: 24,
  879. // },
  880. grid2: {
  881. xl: 18,
  882. lg: 16,
  883. md: 12,
  884. sm: 24,
  885. xs: 24,
  886. },
  887. loading: false,
  888. total: 0,
  889. userFrom: {
  890. label_id: "",
  891. user_type: "",
  892. status: "",
  893. sex: "",
  894. is_promoter: "",
  895. country: "",
  896. isMember: "",
  897. pay_count: "",
  898. user_time_type: "",
  899. user_time: "",
  900. nickname: "",
  901. province: "",
  902. city: "",
  903. page: 1,
  904. limit: 15,
  905. level: "",
  906. group_id: "",
  907. field_key: "",
  908. },
  909. field_key: "",
  910. level: "",
  911. group_id: "",
  912. label_id: "",
  913. user_time_type: "",
  914. pay_count: "",
  915. userLists: [],
  916. FromData: null,
  917. selectionList: [],
  918. user_ids: "",
  919. selectedData: [],
  920. timeVal: [],
  921. array_ids: [],
  922. groupList: [],
  923. levelList: [],
  924. labelFrom: {
  925. page: 1,
  926. limit: "",
  927. },
  928. labelLists: [],
  929. display: "none",
  930. checkBox: false,
  931. selectionCopy: [],
  932. isCheckBox: false,
  933. isAll: 0,
  934. userId: 0,
  935. checkUidList:[],
  936. batchModal: false,
  937. menuActive: 1,
  938. batchLabel: [],
  939. batchData: {
  940. group_id: 0,
  941. label_id: [],
  942. level_id: 0,
  943. money_status: 0,
  944. money: 0,
  945. integration_status: 0,
  946. integration: 0,
  947. days_status: 1,
  948. day: 0,
  949. spread_uid: '',
  950. },
  951. spread_name: ''
  952. };
  953. },
  954. watch: {
  955. selectionList(value) {
  956. let arr = value.map((item) => item.uid);
  957. this.array_ids = arr;
  958. this.user_ids = arr.join();
  959. },
  960. userLists: {
  961. deep: true,
  962. handler(value) {
  963. value.forEach((item) => {
  964. this.selectionList.forEach((itm) => {
  965. if (itm.uid === item.uid) {
  966. item.checkBox = true;
  967. }
  968. });
  969. });
  970. const arr = this.userLists.filter((item) => item.checkBox);
  971. if (this.userLists.length) {
  972. this.checkBox = this.userLists.length === arr.length;
  973. } else {
  974. this.checkBox = false;
  975. }
  976. },
  977. },
  978. },
  979. computed: {
  980. ...mapState("admin/layout", ["isMobile"]),
  981. labelWidth() {
  982. return this.isMobile ? undefined : 100;
  983. },
  984. labelPosition() {
  985. return this.isMobile ? "top" : "right";
  986. },
  987. },
  988. created() {
  989. this.getList();
  990. },
  991. mounted() {
  992. this.userGroup();
  993. this.levelLists();
  994. this.groupLists();
  995. },
  996. methods: {
  997. msgCancel() {
  998. this.modal14 = false
  999. this.textarea = ''
  1000. },
  1001. msgSend() {
  1002. sendMsgs({
  1003. uid_list: this.checkUidList,
  1004. content: this.textarea,
  1005. all: this.isAll,
  1006. }).then(res => {
  1007. console.log(res)
  1008. this.msgCancel()
  1009. })
  1010. },
  1011. checkboxItem(e){
  1012. let uid = parseInt(e.rowid);
  1013. let index = this.checkUidList.indexOf(uid);
  1014. if(index !== -1){
  1015. this.checkUidList = this.checkUidList.filter((item)=> item !== uid);
  1016. }else{
  1017. this.checkUidList.push(uid);
  1018. }
  1019. },
  1020. checkboxAll(){
  1021. // 获取选中当前值
  1022. let obj2 = this.$refs.xTable.getCheckboxRecords(true);
  1023. // 获取之前选中值
  1024. let obj = this.$refs.xTable.getCheckboxReserveRecords(true);
  1025. if(this.isAll == 0 && this.checkUidList.length <= obj.length && !this.isCheckBox){
  1026. obj = [];
  1027. }
  1028. obj = obj.concat(obj2);
  1029. let uids = [];
  1030. obj.forEach((item)=>{
  1031. uids.push(parseInt(item.uid))
  1032. })
  1033. this.checkUidList = uids;
  1034. if(!obj2.length){
  1035. this.isCheckBox = false;
  1036. }
  1037. },
  1038. allPages(e){
  1039. this.isAll = e;
  1040. if(e==0){
  1041. this.$refs.xTable.toggleAllCheckboxRow();
  1042. // this.checkboxAll();
  1043. }else{
  1044. if(!this.isCheckBox){
  1045. this.$refs.xTable.setAllCheckboxRow(true);
  1046. this.isCheckBox = true;
  1047. this.isAll = 1;
  1048. }else{
  1049. this.$refs.xTable.setAllCheckboxRow(false);
  1050. this.isCheckBox = false;
  1051. this.isAll = 0;
  1052. }
  1053. this.checkUidList = []
  1054. }
  1055. },
  1056. closeLabel(label) {
  1057. let index = this.dataLabel.indexOf(
  1058. this.dataLabel.filter((d) => d.id == label.id)[0]
  1059. );
  1060. this.dataLabel.splice(index, 1);
  1061. },
  1062. activeData(dataLabel) {
  1063. this.labelListShow = false;
  1064. if (this.batchModal && this.menuActive === 2) {
  1065. this.batchLabel = dataLabel;
  1066. this.batchData.label_id = dataLabel.map(item => item.id);
  1067. } else {
  1068. this.dataLabel = dataLabel;
  1069. }
  1070. },
  1071. openLabelList(row) {
  1072. this.labelListShow = true;
  1073. let data = JSON.parse(JSON.stringify(this.dataLabel));
  1074. if (this.batchModal && this.menuActive === 2) {
  1075. data = JSON.parse(JSON.stringify(this.batchLabel));
  1076. }
  1077. this.$refs.labelList.userLabel(data);
  1078. },
  1079. // 标签弹窗关闭
  1080. labelListClose() {
  1081. this.labelListShow = false;
  1082. },
  1083. // 标签弹窗关闭
  1084. labelClose(e) {
  1085. if (!e) {
  1086. this.getList();
  1087. }
  1088. this.labelShow = false;
  1089. this.labelActive.uid = 0;
  1090. },
  1091. // 提交
  1092. putSend(name) {
  1093. this.$refs[name].validate((valid) => {
  1094. if (valid) {
  1095. if (!this.formInline.spread_uid) {
  1096. return this.$Message.error("请上传用户");
  1097. }
  1098. agentSpreadApi(this.formInline)
  1099. .then((res) => {
  1100. this.promoterShow = false;
  1101. this.$Message.success(res.msg);
  1102. this.getList();
  1103. this.$refs[name].resetFields();
  1104. })
  1105. .catch((res) => {
  1106. this.$Message.error(res.msg);
  1107. });
  1108. }
  1109. });
  1110. },
  1111. save() {
  1112. this.$modalForm(getUserSaveForm()).then(() => this.getList());
  1113. // getUserSaveForm().then(async (res) => {
  1114. // if(res.data.status === false){
  1115. // return this.$authLapse(res.data);
  1116. // }
  1117. // this.FromData = res.data;
  1118. // this.$refs.edits.modals = true;
  1119. // }).catch(err=>{
  1120. // this.$Message.error(err.msg);
  1121. // })
  1122. },
  1123. synchro() {
  1124. userSynchro()
  1125. .then((res) => {
  1126. this.$Message.success(res.msg);
  1127. })
  1128. .catch((err) => {
  1129. this.$Message.error(err.msg);
  1130. });
  1131. },
  1132. // 分组列表
  1133. groupLists() {
  1134. this.loading = true;
  1135. userLabelApi(this.labelFrom)
  1136. .then(async (res) => {
  1137. let data = res.data;
  1138. this.labelLists = data.list;
  1139. })
  1140. .catch((res) => {
  1141. this.loading = false;
  1142. this.$Message.error(res.msg);
  1143. });
  1144. },
  1145. onClickTab(type) {
  1146. this.isAll = 0;
  1147. this.isCheckBox = false;
  1148. this.$refs.xTable.setAllCheckboxRow(false);
  1149. this.checkUidList = [];
  1150. this.userFrom.page = 1;
  1151. this.userFrom.user_type = type==-1?'':type;
  1152. this.getList();
  1153. },
  1154. userGroup() {
  1155. let data = {
  1156. page: 1,
  1157. limit: "",
  1158. };
  1159. userGroupApi(data).then((res) => {
  1160. this.groupList = res.data.list;
  1161. });
  1162. },
  1163. levelLists() {
  1164. let data = {
  1165. page: 1,
  1166. limit: "",
  1167. title: "",
  1168. is_show: 1,
  1169. };
  1170. levelListApi(data).then((res) => {
  1171. this.levelList = res.data.list;
  1172. });
  1173. },
  1174. // 批量设置分组;
  1175. setGroup() {
  1176. if (this.selectionList.length === 0) {
  1177. this.$Message.warning("请选择要设置分组的用户");
  1178. } else {
  1179. let uids = {
  1180. all: this.isAll,
  1181. uids: this.array_ids
  1182. };
  1183. if (this.isAll == 1) {
  1184. uids.where = this.userFrom;
  1185. uids.where = {
  1186. city: this.userFrom.city,
  1187. country: this.userFrom.country,
  1188. field_key: this.userFrom.field_key,
  1189. group_id: this.userFrom.group_id,
  1190. isMember: this.userFrom.isMember,
  1191. is_promoter: this.userFrom.is_promoter,
  1192. label_id: this.userFrom.label_id,
  1193. level: this.userFrom.level,
  1194. nickname: this.userFrom.nickname,
  1195. pay_count: this.userFrom.pay_count,
  1196. province: this.userFrom.province,
  1197. sex: this.userFrom.sex,
  1198. status: this.userFrom.status,
  1199. user_time: this.userFrom.user_time,
  1200. user_time_type: this.userFrom.user_time_type,
  1201. user_type: this.userFrom.user_type,
  1202. };
  1203. }
  1204. this.$modalForm(userSetGroup(uids)).then(() => this.getList());
  1205. }
  1206. },
  1207. // 批量设置标签;
  1208. setLabel() {
  1209. if (this.selectionList.length === 0) {
  1210. this.$Message.warning("请选择要设置标签的用户");
  1211. } else {
  1212. let uids = {
  1213. all: this.isAll,
  1214. uids: this.array_ids
  1215. };
  1216. if (this.isAll == 1) {
  1217. uids.where = {
  1218. city: this.userFrom.city,
  1219. country: this.userFrom.country,
  1220. field_key: this.userFrom.field_key,
  1221. group_id: this.userFrom.group_id,
  1222. isMember: this.userFrom.isMember,
  1223. is_promoter: this.userFrom.is_promoter,
  1224. label_id: this.userFrom.label_id,
  1225. level: this.userFrom.level,
  1226. nickname: this.userFrom.nickname,
  1227. pay_count: this.userFrom.pay_count,
  1228. province: this.userFrom.province,
  1229. sex: this.userFrom.sex,
  1230. status: this.userFrom.status,
  1231. user_time: this.userFrom.user_time,
  1232. user_time_type: this.userFrom.user_time_type,
  1233. user_type: this.userFrom.user_type,
  1234. };
  1235. }
  1236. this.labelShow = true;
  1237. this.labelActive.uid = uids;
  1238. // this.$modalForm(userSetLabelApi(uids)).then(() => this.getList());
  1239. }
  1240. },
  1241. // 是否为付费会员;
  1242. changeMember() {
  1243. this.userFrom.page = 1;
  1244. this.getList();
  1245. },
  1246. // 选择国家
  1247. changeCountry() {
  1248. if (this.userFrom.country === "abroad" || !this.userFrom.country) {
  1249. this.selectedData = [];
  1250. this.userFrom.province = "";
  1251. this.userFrom.city = "";
  1252. this.address = [];
  1253. }
  1254. },
  1255. // 选择地址
  1256. handleChange(value, selectedData) {
  1257. this.selectedData = selectedData.map((o) => o.label);
  1258. this.userFrom.province = this.selectedData[0];
  1259. this.userFrom.city = this.selectedData[1];
  1260. },
  1261. // 具体日期
  1262. onchangeTime(e) {
  1263. this.timeVal = e;
  1264. this.userFrom.user_time = this.timeVal[0] ? this.timeVal.join("-") : "";
  1265. },
  1266. // 操作
  1267. changeMenu(row, name, index) {
  1268. this.userId = row.uid;
  1269. let uid = [];
  1270. uid.push(row.uid);
  1271. let uids = { uids: uid };
  1272. switch (name) {
  1273. case "1":
  1274. this.$refs.userDetails.modals = true;
  1275. this.$refs.userDetails.activeName = "info";
  1276. this.$refs.userDetails.getDetails(row.uid);
  1277. break;
  1278. case "2":
  1279. this.getOtherFrom(row.uid);
  1280. break;
  1281. case "3":
  1282. // this.giveLevel(row.uid);
  1283. this.giveLevelTime(row.uid);
  1284. break;
  1285. case "4":
  1286. this.del(
  1287. row,
  1288. "清除 【 " + row.nickname + " 】的会员等级",
  1289. index,
  1290. "user"
  1291. );
  1292. break;
  1293. case "5":
  1294. this.$modalForm(userSetGroup(uids)).then(() =>
  1295. this.$refs.sends.getList()
  1296. );
  1297. break;
  1298. case "6":
  1299. this.openLabel(row);
  1300. // this.$modalForm(userSetLabelApi(uids)).then(() => this.$refs.sends.getList());
  1301. break;
  1302. case "7":
  1303. this.editS(row);
  1304. break;
  1305. default:
  1306. this.del(
  1307. row,
  1308. "解除【 " + row.nickname + " 】的上级推广人",
  1309. index,
  1310. "tuiguang"
  1311. );
  1312. break;
  1313. // this.del(row, '清除 【 ' + row.nickname + ' 】的会员等级', index)
  1314. }
  1315. },
  1316. openLabel(row) {
  1317. this.labelShow = true;
  1318. this.labelActive.uid = row.uid;
  1319. },
  1320. editS(row) {
  1321. this.promoterShow = true;
  1322. this.formInline.uid = row.uid;
  1323. },
  1324. customer() {
  1325. this.customerShow = true;
  1326. },
  1327. imageObject(e) {
  1328. this.customerShow = false;
  1329. if (this.batchModal && this.menuActive === 6) {
  1330. this.batchData.spread_uid = e.uid;
  1331. this.spread_name = e.name;
  1332. } else {
  1333. this.formInline.spread_uid = e.uid;
  1334. this.formInline.image = e.image;
  1335. }
  1336. },
  1337. cancel(name) {
  1338. this.promoterShow = false;
  1339. this.$refs[name].resetFields();
  1340. },
  1341. // 赠送会员等级
  1342. giveLevel(id) {
  1343. giveLevelApi(id)
  1344. .then(async (res) => {
  1345. if (res.data.status === false) {
  1346. return this.$authLapse(res.data);
  1347. }
  1348. this.FromData = res.data;
  1349. this.$refs.edits.modals = true;
  1350. })
  1351. .catch((res) => {
  1352. this.$Message.error(res.msg);
  1353. });
  1354. },
  1355. // 赠送会员等级
  1356. giveLevelTime(id) {
  1357. giveLevelTimeApi(id)
  1358. .then(async (res) => {
  1359. if (res.data.status === false) {
  1360. return this.$authLapse(res.data);
  1361. }
  1362. this.FromData = res.data;
  1363. this.$refs.edits.modals = true;
  1364. })
  1365. .catch((res) => {
  1366. this.$Message.error(res.msg);
  1367. });
  1368. },
  1369. // 删除
  1370. del(row, tit, num, name) {
  1371. let delfromData = {
  1372. title: tit,
  1373. num: num,
  1374. url:
  1375. name === "user"
  1376. ? `user/del_level/${row.uid}`
  1377. : `agent/stair/delete_spread/${row.uid}`,
  1378. method: name === "user" ? "DELETE" : "PUT",
  1379. // url: `user/del_level/${row.uid}`,
  1380. // method: 'DELETE',
  1381. ids: "",
  1382. };
  1383. this.$modalSure(delfromData)
  1384. .then((res) => {
  1385. this.$Message.success(res.msg);
  1386. this.getList();
  1387. })
  1388. .catch((res) => {
  1389. this.$Message.error(res.msg);
  1390. });
  1391. },
  1392. // 清除会员删除成功
  1393. submitModel() {
  1394. this.getList();
  1395. },
  1396. // 会员列表
  1397. getList() {
  1398. this.loading = true;
  1399. let activeIds = [];
  1400. this.dataLabel.forEach((item) => {
  1401. activeIds.push(item.id);
  1402. });
  1403. this.userFrom.label_id = activeIds.join(",") || "";
  1404. this.userFrom.user_type = this.userFrom.user_type || "";
  1405. this.userFrom.status = this.userFrom.status || "";
  1406. this.userFrom.sex = this.userFrom.sex || "";
  1407. this.userFrom.is_promoter = this.userFrom.is_promoter || "";
  1408. this.userFrom.country = this.userFrom.country || "";
  1409. this.userFrom.user_time_type = this.userFrom.user_time_type || "";
  1410. this.userFrom.pay_count = this.userFrom.pay_count || "";
  1411. // this.userFrom.label_id = this.userFrom.label_id || "";
  1412. this.userFrom.field_key = this.field_key === "all" ? "" : this.field_key;
  1413. this.userFrom.level =
  1414. this.userFrom.level === "all" ? "" : this.userFrom.level;
  1415. this.userFrom.group_id =
  1416. this.userFrom.group_id === "all" ? "" : this.userFrom.group_id;
  1417. userList(this.userFrom)
  1418. .then(async (res) => {
  1419. let data = res.data;
  1420. data.list.forEach((item) => {
  1421. item.checkBox = false;
  1422. });
  1423. this.userLists = data.list;
  1424. this.total = data.count;
  1425. this.loading = false;
  1426. this.$nextTick(function(){
  1427. if (this.isAll == 1) {
  1428. this.selectionList = this.userLists;
  1429. if(this.isCheckBox){
  1430. this.$refs.xTable.setAllCheckboxRow(true);
  1431. }else{
  1432. this.$refs.xTable.setAllCheckboxRow(false);
  1433. }
  1434. }else{
  1435. let obj = this.$refs.xTable.getCheckboxReserveRecords(true);
  1436. if(!this.checkUidList.length || this.checkUidList.length <= obj.length){
  1437. this.$refs.xTable.setAllCheckboxRow(false);
  1438. }
  1439. }
  1440. })
  1441. })
  1442. .catch((res) => {
  1443. this.loading = false;
  1444. this.$Message.error(res.msg);
  1445. });
  1446. },
  1447. pageChange({ currentPage, pageSize }) {
  1448. this.userFrom.page = currentPage;
  1449. this.userFrom.limit = pageSize;
  1450. this.getList();
  1451. },
  1452. // pageChange(index) {
  1453. // this.userFrom.page = index;
  1454. // this.getList();
  1455. // },
  1456. // 搜索
  1457. userSearchs() {
  1458. if (this.userFrom.user_time_type && !this.timeVal.length) {
  1459. return this.$Message.error("请选择访问时间");
  1460. }
  1461. if (this.timeVal.length && !this.userFrom.user_time_type) {
  1462. return this.$Message.error("请选择访问情况");
  1463. }
  1464. this.isAll = 0;
  1465. this.$refs.xTable.setAllCheckboxRow(false);
  1466. this.checkUidList = [];
  1467. this.userFrom.page = 1;
  1468. this.selectionList = [];
  1469. this.getList();
  1470. },
  1471. // 重置
  1472. reset(name) {
  1473. this.$refs.xTable.setAllCheckboxRow(false);
  1474. this.checkUidList = []
  1475. this.headeType = "-1";
  1476. this.userFrom = {
  1477. user_type: "",
  1478. status: "",
  1479. sex: "",
  1480. is_promoter: "",
  1481. country: "",
  1482. pay_count: "",
  1483. user_time_type: "",
  1484. user_time: "",
  1485. nickname: "",
  1486. field_key: "",
  1487. level: "",
  1488. group_id: "",
  1489. label_id: "",
  1490. page: 1, // 当前页
  1491. limit: 20, // 每页显示条数
  1492. };
  1493. this.field_key = "";
  1494. this.level = "";
  1495. this.group_id = "";
  1496. this.label_id = "";
  1497. this.user_time_type = "";
  1498. this.pay_count = "";
  1499. this.timeVal = [];
  1500. this.selectionList = [];
  1501. this.dataLabel = [];
  1502. this.getList();
  1503. },
  1504. // 获取编辑表单数据
  1505. getUserFrom(id) {
  1506. this.$modalForm(getUserData(id)).then(() => this.getList());
  1507. // getUserData(id)
  1508. // .then(async (res) => {
  1509. // if (res.data.status === false) {
  1510. // return this.$authLapse(res.data);
  1511. // }
  1512. // this.FromData = res.data;
  1513. // this.$refs.edits.modals = true;
  1514. // })
  1515. // .catch((res) => {
  1516. // this.$Message.error(res.msg);
  1517. // });
  1518. },
  1519. // 获取积分余额表单
  1520. getOtherFrom(id) {
  1521. editOtherApi(id)
  1522. .then(async (res) => {
  1523. if (res.data.status === false) {
  1524. return this.$authLapse(res.data);
  1525. }
  1526. res.data.rules[1].props.max = 999999;
  1527. this.FromData = res.data;
  1528. this.$refs.edits.modals = true;
  1529. })
  1530. .catch((res) => {
  1531. this.$Message.error(res.msg);
  1532. });
  1533. },
  1534. // 修改状态
  1535. onchangeIsShow(row) {
  1536. let data = {
  1537. id: row.uid,
  1538. status: row.status,
  1539. };
  1540. isShowApi(data)
  1541. .then(async (res) => {
  1542. this.$Message.success(res.msg);
  1543. })
  1544. .catch((res) => {
  1545. this.$Message.error(res.msg);
  1546. });
  1547. },
  1548. // 点击发送优惠券
  1549. onSend() {
  1550. if (this.checkUidList.length === 0 && this.isAll==0) {
  1551. return this.$Message.warning("请选择要发送优惠券的用户");
  1552. }
  1553. this.$refs.sends.modals = true;
  1554. this.$refs.sends.getList();
  1555. },
  1556. sendMsg() {
  1557. if (this.checkUidList.length === 0 && this.isAll==0) {
  1558. return this.$Message.warning("请选择要发送优惠券的用户");
  1559. }
  1560. console.log(this.checkUidList,'this.checkUidList',this.isAll)
  1561. this.modal14 = true
  1562. // this.$refs.sends.modals = true;
  1563. // this.$refs.sends.modals = true;
  1564. // this.$refs.sends.getList();
  1565. },
  1566. // 发送图文消息
  1567. onSendPic() {
  1568. if (this.checkUidList.length === 0 && this.isAll==0) {
  1569. this.$Message.warning("请选择要发送图文消息的用户");
  1570. } else {
  1571. this.modal13 = true;
  1572. }
  1573. },
  1574. // 编辑
  1575. edit(row) {
  1576. this.getUserFrom(row.uid);
  1577. // this.$modalForm(getUserSaveForm(row.uid)).then(() => this.getList());
  1578. },
  1579. //信息补充
  1580. extendInfo(row) {
  1581. // this.$modalForm(extendInfo(row.uid)).then(() => this.getList());
  1582. extendInfo(row.uid).then(async (res) => {
  1583. if(res.data.status === false){
  1584. return this.$authLapse(res.data);
  1585. }
  1586. this.FromData = res.data;
  1587. this.$refs.edits.modals = true;
  1588. // this.getList()
  1589. }).catch(err=>{
  1590. this.$Message.error(err.msg);
  1591. })
  1592. },
  1593. // 修改成功
  1594. submitFail(p) {
  1595. // this.getList();
  1596. if (this.$refs.userDetails.modals) {
  1597. this.$refs.userDetails.getDetails(this.userId);
  1598. }
  1599. },
  1600. // 排序
  1601. // sortChanged(e) {
  1602. // this.userFrom[e.key] = e.order;
  1603. // this.getList();
  1604. // },
  1605. // onSelectCancel(selection, row) {},
  1606. menuSelect(name) {
  1607. this.menuActive = name;
  1608. },
  1609. setBatch() {
  1610. this.batchModal = true;
  1611. },
  1612. tagClose(id) {
  1613. let index = this.batchLabel.findIndex(item => item.id === id);
  1614. this.batchLabel.splice(index, 1);
  1615. },
  1616. cancelBatch() {
  1617. this.batchModal = false;
  1618. },
  1619. // 保存批量操作
  1620. saveBatch() {
  1621. batchProcess({
  1622. type: this.menuActive,
  1623. uids: this.checkUidList,
  1624. all: this.isAll,
  1625. where: this.userFrom,
  1626. data: this.batchData
  1627. }).then(res => {
  1628. this.$Message.success(res.msg);
  1629. this.batchModal = false;
  1630. }).catch(res => {
  1631. this.$Message.error(res.msg);
  1632. });
  1633. },
  1634. batchVisibleChange() {
  1635. this.batchData = {
  1636. group_id: 0,
  1637. label_id: [],
  1638. level_id: 0,
  1639. money_status: 0,
  1640. money: 0,
  1641. integration_status: 0,
  1642. integration: 0,
  1643. days_status: 1,
  1644. day: 0,
  1645. spread_uid: '',
  1646. };
  1647. this.batchLabel = [];
  1648. this.spread_name = '';
  1649. this.menuActive = 1;
  1650. }
  1651. },
  1652. };
  1653. </script>
  1654. <style scoped lang="stylus">
  1655. /deep/.ivu-dropdown-item{
  1656. font-size: 12px!important;
  1657. }
  1658. /deep/.vxe-table--render-default .vxe-cell{
  1659. font-size: 12px;
  1660. }
  1661. .expand-row{
  1662. margin-bottom: 16px;
  1663. font-size: 12px;
  1664. }
  1665. .tdinfo {
  1666. margin-left: 88px;
  1667. margin-top: 15px;
  1668. }
  1669. .padding-add {
  1670. padding: 20px 20px 0;
  1671. }
  1672. .input-add {
  1673. max-width:250px;
  1674. }
  1675. .labelInput {
  1676. max-width:250px;
  1677. border: 1px solid #dcdee2;
  1678. padding: 0 5px;
  1679. border-radius: 5px;
  1680. min-height: 30px;
  1681. cursor: pointer;
  1682. .span {
  1683. color: #c5c8ce;
  1684. }
  1685. .iconxiayi {
  1686. font-size: 12px;
  1687. }
  1688. }
  1689. .picBox {
  1690. display: inline-block;
  1691. cursor: pointer;
  1692. .upLoad {
  1693. width: 58px;
  1694. height: 58px;
  1695. line-height: 58px;
  1696. border: 1px dotted rgba(0, 0, 0, 0.1);
  1697. border-radius: 4px;
  1698. background: rgba(0, 0, 0, 0.02);
  1699. }
  1700. .pictrue {
  1701. width: 60px;
  1702. height: 60px;
  1703. border: 1px dotted rgba(0, 0, 0, 0.1);
  1704. margin-right: 10px;
  1705. img {
  1706. width: 100%;
  1707. height: 100%;
  1708. }
  1709. }
  1710. }
  1711. .userFrom {
  1712. >>> .ivu-form-item-content {
  1713. margin-left: 0px !important;
  1714. }
  1715. }
  1716. .userAlert {
  1717. margin-top: 20px;
  1718. }
  1719. .userI {
  1720. color: #1890FF;
  1721. font-style: normal;
  1722. }
  1723. img {
  1724. height: 36px;
  1725. display: block;
  1726. }
  1727. .tabBox_img {
  1728. width: 36px;
  1729. height: 36px;
  1730. border-radius: 4px;
  1731. cursor: pointer;
  1732. img {
  1733. width: 100%;
  1734. height: 100%;
  1735. }
  1736. }
  1737. .tabBox_tit {
  1738. width: 60%;
  1739. font-size: 12px !important;
  1740. margin: 0 2px 0 10px;
  1741. letter-spacing: 1px;
  1742. padding: 5px 0;
  1743. box-sizing: border-box;
  1744. }
  1745. .modelBox {
  1746. >>> .ivu-modal-body {
  1747. padding: 0 16px 16px 16px !important;
  1748. }
  1749. }
  1750. .vipName {
  1751. color: #dab176;
  1752. }
  1753. .listbox {
  1754. >>>.ivu-divider-horizontal {
  1755. margin: 0 !important;
  1756. }
  1757. }
  1758. /deep/.ivu-table-header {
  1759. // overflow visible
  1760. }
  1761. /deep/.ivu-table th {
  1762. overflow: visible;
  1763. }
  1764. /deep/.select-item:hover {
  1765. background-color: #f3f3f3;
  1766. }
  1767. /deep/.select-on {
  1768. display: block;
  1769. }
  1770. /deep/.select-item.on {
  1771. /* background: #f3f3f3; */
  1772. }
  1773. .pane_pd{
  1774. padding:4px 16px 20px !important;
  1775. font-weight: 500;
  1776. }
  1777. .new_tab {
  1778. >>>.ivu-tabs-nav .ivu-tabs-tab{
  1779. padding:4px 16px 20px !important;
  1780. font-weight: 500;
  1781. }
  1782. }
  1783. .dateMedia{
  1784. /deep/.ivu-form-item-content{
  1785. max-width 250px;
  1786. /deep/.ivu-date-picker{
  1787. width 100%;
  1788. }
  1789. }
  1790. }
  1791. .select-tag{
  1792. position: relative;
  1793. min-height: 32px;
  1794. padding: 0 24px 0 4px;
  1795. border: 1px solid #dcdee2;
  1796. border-radius: 4px;
  1797. line-height: normal;
  1798. user-select: none;
  1799. cursor: pointer;
  1800. &:hover {
  1801. border-color: #57a3f3;
  1802. }
  1803. .ivu-icon {
  1804. position: absolute;
  1805. top: 50%;
  1806. right: 8px;
  1807. line-height: 1;
  1808. transform: translateY(-50%);
  1809. font-size: 14px;
  1810. color: #808695;
  1811. transition: all .2s ease-in-out;
  1812. }
  1813. .ivu-tag {
  1814. position: relative;
  1815. max-width: 99%;
  1816. height: 24px;
  1817. margin: 3px 4px 3px 0;
  1818. line-height: 22px;
  1819. }
  1820. .placeholder {
  1821. display: block;
  1822. height: 30px;
  1823. line-height: 30px;
  1824. color: #c5c8ce;
  1825. font-size: 12px;
  1826. overflow: hidden;
  1827. text-overflow: ellipsis;
  1828. white-space: nowrap;
  1829. padding-left: 4px;
  1830. padding-right: 22px;
  1831. }
  1832. }
  1833. >>> .batch-modal {
  1834. .ivu-modal-body {
  1835. padding: 0;
  1836. }
  1837. .ivu-alert {
  1838. margin: 12px 24px;
  1839. }
  1840. .ivu-col-span-4 {
  1841. flex: none;
  1842. width: 130px;
  1843. }
  1844. .ivu-col-span-20 {
  1845. padding-right: 37px;
  1846. }
  1847. .ivu-input-number {
  1848. width: 100%;
  1849. }
  1850. .ivu-menu-light.ivu-menu-vertical .ivu-menu-item-active:not(.ivu-menu-submenu) {
  1851. z-index: auto;
  1852. }
  1853. .ivu-menu-light.ivu-menu-vertical .ivu-menu-item-active:not(.ivu-menu-submenu):after {
  1854. right: auto;
  1855. left: 0;
  1856. }
  1857. .ivu-menu-item {
  1858. padding-right: 0;
  1859. }
  1860. }
  1861. </style>