index.vue 56 KB

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