list.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <div style="padding-top: 10px;">
  3. <i-page-header :title="pageTitle"></i-page-header>
  4. <Card :bordered="false" dis-hover class="ivu-mt">
  5. <!-- <Form ref="orderData" :model="orderData">
  6. <Row :gutter="24" type="flex">
  7. <Col>
  8. <FormItem label="UID:" label-for="uid">
  9. <Input placeholder="用户UID" v-model="orderData.uid"/>
  10. </FormItem>
  11. </Col>
  12. <Col>
  13. <FormItem label="绑定手机:" label-for="mobile">
  14. <Input placeholder="绑定手机号码" v-model="orderData.mobile"/>
  15. </FormItem>
  16. </Col>
  17. <Col>
  18. <FormItem label="购买时间:">
  19. <DatePicker v-model="orderData.time" format="yyyy/MM/dd HH:mm:ss" type="datetimerange" placement="bottom-start" placeholder="自定义时间" style="width: 300px;" class="mr20" :options="options"></DatePicker>
  20. </FormItem>
  21. </Col>
  22. <Col>
  23. <Button label="default" type="primary" icon="ios-search" class="mr15" style="margin-top: 32px;" @click="orderSearch()">搜索</Button>
  24. </Col>
  25. </Row>
  26. </Form> -->
  27. <Col>
  28. <Button type="primary" class="export" icon="ios-share-outline" @click="sendOpen">发布贴子</Button>
  29. </Col>
  30. <Table :columns="columns" :data="orderList" ref="table" :loading="loading" highlight-row no-data-text="暂无数据"
  31. no-filtered-data-text="暂无筛选结果" class="orderData mt25">
  32. <template slot-scope="{ row, index }" slot="order_id">
  33. <span v-text="row.order_id" style="display: block;"></span>
  34. </template>
  35. <template slot-scope="{ row, index }" slot="uid">
  36. <div>{{row.nickname || '微信用户'}}[UID:{{row.uid}}]</div>
  37. <div>{{row.mobile || '未绑定手机号'}}</div>
  38. </template>
  39. <template slot-scope="{ row, index }" slot="imgs">
  40. <div v-if="row.imgs.length>0" style="display: flex;">
  41. <img v-for="item in row.imgs" v-lazy="item" :src="item" v-image-preview
  42. style="width: 60px;cursor: pointer" />
  43. </div>
  44. </template>
  45. <template slot-scope="{ row, index }" slot="handle">
  46. <div><el-button plain size="mini" @click="">查看评论</el-button></div>
  47. <br />
  48. <div><el-button plain size="mini" @click="">删除</el-button></div>
  49. </template>
  50. </Table>
  51. <div class="acea-row row-right page">
  52. <Page :total="page.count" show-elevator show-total @on-change="tapPage" :page-size="page.pageSize" />
  53. </div>
  54. </Card>
  55. <Modal v-model="sendModel" title="发布贴子" @on-ok="sendOk('sendFormValidate')" @on-cancel="sendCancel" width="800">
  56. <Form :model="sendData" :label-width="labelWidth" :rules="ruleValidate" ref="sendFormValidate">
  57. <FormItem label="贴子文本" prop="content">
  58. <Input v-model="sendData.content" type="textarea" :autosize="{minRows: 5,maxRows: 5}"
  59. placeholder="请输入贴子内容"></Input>
  60. </FormItem>
  61. <FormItem label="图片">
  62. <div class="clearfix">
  63. <div class="upimg-item fx-r fx-bc fx-ac" style="" v-for="(item,index) in sendData.imgs"
  64. :key="index">
  65. <img v-lazy="item" :src="item" v-image-preview />
  66. <i class="el-icon-error img-remove-btn" @click="removeImgs(index)"></i>
  67. </div>
  68. <ui-upload style="float: left;" :upUrl="upUrl" fileName="上传图片" :headers="upHeaders"
  69. :updata="{isz:0,code:'goods'}" @onUpload="onUpload"
  70. v-if="sendData.imgs.length<6"></ui-upload>
  71. </div>
  72. </FormItem>
  73. </Form>
  74. <div slot="footer">
  75. <Button size="large" :loading="modal_loading" @click="sendCancel">取消</Button>
  76. <Button type="primary" size="large" :loading="modal_loading" @click="sendOk('sendFormValidate')">提交</Button>
  77. </div>
  78. </Modal>
  79. </div>
  80. </template>
  81. <script>
  82. import IPageHeader from "../../../layouts/system/page-header/index";
  83. import {
  84. SystemShowTemplateList
  85. } from "../../../api/system/user";
  86. import Setting from '@/setting';
  87. import UiUpload from "@/ui/upload/index";
  88. export default {
  89. name: "forumList",
  90. components: {
  91. SystemShowTemplateList,
  92. IPageHeader,
  93. UiUpload
  94. },
  95. computed: {},
  96. data() {
  97. return {
  98. modal_loading: false,
  99. ruleValidate: {
  100. content: [{
  101. required: true,
  102. message: '请输入贴子内容',
  103. trigger: 'blur'
  104. }],
  105. },
  106. labelWidth: 120,
  107. upHeaders: {},
  108. upUrl: '',
  109. sendData: {
  110. content: '',
  111. imgs: []
  112. },
  113. sendModel: false,
  114. pageTitle: "贴子记录",
  115. options: {
  116. shortcuts: [{
  117. text: '今天',
  118. value() {
  119. const end = new Date();
  120. const start = new Date();
  121. start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), new Date()
  122. .getDate()));
  123. return [start, end];
  124. }
  125. },
  126. {
  127. text: '昨天',
  128. value() {
  129. const end = new Date();
  130. const start = new Date();
  131. start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(),
  132. new Date().getDate() - 1)));
  133. end.setTime(end.setTime(new Date(new Date().getFullYear(), new Date().getMonth(),
  134. new Date().getDate())));
  135. return [start, end];
  136. }
  137. },
  138. {
  139. text: '最近7天',
  140. value() {
  141. const end = new Date();
  142. const start = new Date();
  143. start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(),
  144. new Date().getDate() - 6)));
  145. return [start, end];
  146. }
  147. },
  148. {
  149. text: '最近30天',
  150. value() {
  151. const end = new Date();
  152. const start = new Date();
  153. start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(),
  154. new Date().getDate() - 29)));
  155. return [start, end];
  156. }
  157. },
  158. {
  159. text: '本月',
  160. value() {
  161. const end = new Date();
  162. const start = new Date();
  163. start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(),
  164. 1)));
  165. return [start, end];
  166. }
  167. },
  168. {
  169. text: '本年',
  170. value() {
  171. const end = new Date();
  172. const start = new Date();
  173. start.setTime(start.setTime(new Date(new Date().getFullYear(), 0, 1)));
  174. return [start, end];
  175. }
  176. }
  177. ]
  178. },
  179. orderData: {
  180. uid: "",
  181. status: "all",
  182. time: [],
  183. mobile: "",
  184. show_template_id: "",
  185. },
  186. columns: [{
  187. title: 'ID',
  188. align: 'center',
  189. key: 'id',
  190. align: 'center'
  191. },
  192. {
  193. title: '发布者',
  194. slot: 'uid',
  195. align: 'center'
  196. },
  197. {
  198. title: '帖子内容',
  199. align: 'center',
  200. key: 'content',
  201. align: 'left'
  202. },
  203. {
  204. title: '帖子图片',
  205. align: 'center',
  206. slot: 'imgs',
  207. align: 'center'
  208. },
  209. {
  210. title: '时间',
  211. align: 'center',
  212. key: 'add_time',
  213. align: 'left'
  214. },
  215. {
  216. title: '操作',
  217. align: 'center',
  218. slot: 'handle',
  219. align: 'left'
  220. },
  221. ],
  222. loading: false,
  223. orderList: [],
  224. orderDatalist: {},
  225. orderId: 0,
  226. page: {
  227. total: 0, // 总条数
  228. page: 1, // 当前页
  229. pageSize: 10 // 每页显示条数
  230. },
  231. }
  232. },
  233. created() {
  234. if (this.$route.query.title) {
  235. this.pageTitle = this.$route.query.title;
  236. }
  237. if (this.$route.query.uid) {
  238. this.orderData.uid = parseInt(this.$route.query.uid);
  239. }
  240. if (this.$route.query.show_template_id) {
  241. this.orderData.show_template_id = parseInt(this.$route.query.show_template_id);
  242. }
  243. this.initView();
  244. },
  245. methods: {
  246. initView: function() {
  247. var upHeaders = {};
  248. this.upUrl = Setting.apiBaseURL + "/systemv1/upload/index";
  249. const token = this.$utils.util.cookies.get('system_token');
  250. if (token) {
  251. upHeaders['SYSTEM-ACC-TOKEN'] = token;
  252. }
  253. this.upHeaders = upHeaders;
  254. },
  255. onUpload: function(res) {
  256. if (res.code == -1) {
  257. Notice.error({
  258. title: "系统提示",
  259. content: res.msg
  260. });
  261. } else {
  262. this.sendData.imgs.push(res.data.img);
  263. }
  264. },
  265. removeImgs: function(index) {
  266. this.$delete(this.sendData.imgs, index);
  267. },
  268. sendOpen() {
  269. this.sendModel = true
  270. },
  271. sendCancel() {
  272. this.sendModel = false
  273. this.sendData = {
  274. content: '',
  275. imgs: []
  276. }
  277. console.log('sendCancel');
  278. },
  279. sendOk(name) {
  280. this.$refs[name].validate((valid) => {
  281. if (valid) {
  282. this.sendCancel()
  283. this.$Message.success('发布成功!');
  284. } else {
  285. }
  286. })
  287. },
  288. tabsHandleClick: function(tab, event) {
  289. this.page.page = 1;
  290. this.getData();
  291. },
  292. orderSearch: function() {
  293. this.page.page = 1;
  294. this.getData();
  295. },
  296. /**
  297. * 分页
  298. */
  299. tapPage: function(index) {
  300. this.page.page = index;
  301. this.getData();
  302. },
  303. /**
  304. * 获取数据
  305. */
  306. getData: function() {
  307. var that = this;
  308. // this.loading = true;
  309. var data = {
  310. page: that.page.page,
  311. ...that.orderData
  312. };
  313. // SystemShowTemplateList(data)
  314. // .then(res=>{
  315. // that.loading = false;
  316. // if(res.code == 200) {
  317. // that.orderList = res.data.list;
  318. // that.page.pageSize = res.data.pageSize;
  319. // that.page.count = res.data.pageCount;
  320. // } else {
  321. // that.$alert(res.msg);
  322. // }
  323. // })
  324. // .catch(err=>{
  325. // that.loading = false;
  326. // that.$alert("网络繁忙,加载失败,请稍等片刻在尝试!", '系统提示');
  327. // });
  328. },
  329. }
  330. }
  331. </script>
  332. <style scoped>
  333. .upimg-item {
  334. width: 82px;
  335. height: 82px;
  336. margin-right: 5px;
  337. overflow: hidden;
  338. float: left;
  339. margin-bottom: 5px;
  340. position: relative;
  341. }
  342. .upimg-item img {
  343. width: 82px;
  344. cursor: pointer;
  345. }
  346. .img-remove-btn {
  347. position: absolute;
  348. top: 0px;
  349. right: 0px;
  350. font-size: 24px;
  351. }
  352. </style>