prodComm.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <div class="mod-prod-prodComm">
  3. <div class="search-bar">
  4. <el-form :inline="true" class="search-form" ref="searchForm" :model="searchForm" label-width="auto" size="small">
  5. <div class="input-row">
  6. <el-form-item prop="prodName" :label="$t('product.prodName') + ':'">
  7. <el-input type="text" v-model="searchForm.prodName" :placeholder="$t('product.prodName')"></el-input>
  8. </el-form-item>
  9. <el-form-item prop="nickName" :label="$t('users.name') + ':'">
  10. <el-input type="text" v-model="searchForm.nickName" :placeholder="$t('users.name')"></el-input>
  11. </el-form-item>
  12. <el-form-item prop="isDeleted" label="是否删除">
  13. <el-select key="isDeleted" v-model="searchForm.isDeleted" :clearable="true">
  14. <el-option label="正常" value="0"></el-option>
  15. <el-option label="已删除" value="1"></el-option>
  16. </el-select>
  17. </el-form-item>
  18. <!-- <el-form-item prop="status" :label="$t('product.reviewStatus') + ':'">-->
  19. <!-- <el-select v-model="searchForm.status" :placeholder="$t('product.reviewStatus')">-->
  20. <!-- <el-option :label="$t('productComm.pass')" :value="1"></el-option>-->
  21. <!-- <el-option :label="$t('productComm.noPass')" :value="-1"></el-option>-->
  22. <!-- </el-select>-->
  23. <!-- </el-form-item>-->
  24. <el-form-item prop="status" label="审核状态">
  25. <el-select key="status" v-model="searchForm.status" :clearable="true">
  26. <el-option label="待审核" value="0"></el-option>
  27. <el-option label="通过" value="1"></el-option>
  28. <el-option label="不通过" value="-1"></el-option>
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item :label="$t('productComm.recTime') + ':'">
  32. <el-date-picker
  33. v-model="recDateRange"
  34. type="datetimerange"
  35. :range-separator="$t('time.tip')"
  36. value-format="yyyy-MM-dd HH:mm:ss"
  37. :start-placeholder="$t('time.start')"
  38. :end-placeholder="$t('time.end')"
  39. ></el-date-picker>
  40. </el-form-item>
  41. <el-form-item :label="$t('productComm.replyTime') + ':'">
  42. <el-date-picker
  43. v-model="replyDateRange"
  44. type="datetimerange"
  45. :range-separator="$t('time.tip')"
  46. value-format="yyyy-MM-dd HH:mm:ss"
  47. :start-placeholder="$t('time.start')"
  48. :end-placeholder="$t('time.end')"
  49. ></el-date-picker>
  50. </el-form-item>
  51. <el-form-item>
  52. <div class="default-btn primary-btn" @click="searchChange(true)">{{$t('crud.searchBtn')}}</div>
  53. <div class="default-btn" @click="resetSearchForm('searchForm')">{{$t('shop.resetMap')}}</div>
  54. </el-form-item>
  55. </div>
  56. </el-form>
  57. </div>
  58. <div class="main-container">
  59. <div class="table-con prod-conmm-table">
  60. <el-table
  61. ref="prodCommTable"
  62. :data="dataList"
  63. header-cell-class-name="table-header"
  64. row-class-name="table-row"
  65. style="width: 100%">
  66. <el-table-column
  67. align="left"
  68. prop="prodName"
  69. width="240"
  70. :label="$t('product.prodName')">
  71. <template slot-scope="scope">
  72. <div class="table-cell-con">
  73. <div v-if="scope.row.pic" class="table-cell-image">
  74. <img :src="scope.row.pic" alt="">
  75. </div>
  76. <span class="table-cell-text">{{ scope.row.prodName }}</span>
  77. </div>
  78. </template>
  79. </el-table-column>
  80. <el-table-column
  81. align="center"
  82. prop="status"
  83. label="审核状态">
  84. <template slot-scope="scope">
  85. <el-tag v-if="scope.row.status === 0" type="warning">待审核</el-tag>
  86. <el-tag v-if="scope.row.status === 1" type="success">通过</el-tag>
  87. <el-tag v-if="scope.row.status === -1" type="danger">不通过</el-tag>
  88. </template>
  89. </el-table-column>
  90. <el-table-column
  91. align="center"
  92. prop="isDeleted"
  93. label="是否删除">
  94. <template slot-scope="scope">
  95. <el-tag v-if="scope.row.isDeleted === 1" type="danger">已删除</el-tag>
  96. <el-tag v-if="scope.row.isDeleted === 0" type="success">正常</el-tag>
  97. </template>
  98. </el-table-column>
  99. <el-table-column
  100. align="left"
  101. prop="nickName"
  102. :label="$t('users.name')">
  103. <template slot-scope="scope">
  104. <span class="table-cell-text line-clamp-one">{{ scope.row.nickName }}</span>
  105. </template>
  106. </el-table-column>
  107. <el-table-column
  108. align="center"
  109. prop="score"
  110. :label="$t('productComm.score')">
  111. </el-table-column>
  112. <el-table-column
  113. align="center"
  114. prop="isAnonymous"
  115. :label="$t('productComm.isAnonymous')">
  116. <template slot-scope="scope">
  117. <div class="tag-text">{{[$t('publics.no'), $t('publics.yes')][scope.row.isAnonymous]}}</div>
  118. </template>
  119. </el-table-column>
  120. <!-- <el-table-column-->
  121. <!-- align="left"-->
  122. <!-- prop="status"-->
  123. <!-- :label="$t('product.reviewStatus')"-->
  124. <!-- width="130">-->
  125. <!-- <template slot-scope="scope">-->
  126. <!-- <div class="tag-text" v-if="scope.row.status === -1">{{ $t("productComm.noPass") }}</div>-->
  127. <!-- <div class="tag-text" v-if="scope.row.status === 0">{{ $t("productComm.waitPass") }}</div>-->
  128. <!-- <div class="tag-text" v-if="scope.row.status === 1">{{ $t("productComm.pass") }}</div>-->
  129. <!-- </template>-->
  130. <!-- </el-table-column>-->
  131. <el-table-column
  132. align="center"
  133. prop="recTime"
  134. :label="$t('productComm.recTime')">
  135. <template slot-scope="scope">
  136. <div>{{scope.row.recTime}}</div>
  137. </template>
  138. </el-table-column>
  139. <el-table-column
  140. align="center"
  141. prop="content"
  142. label="用户评价">
  143. <template slot-scope="scope" :show-overflow-tooltip="true">
  144. <div>{{scope.row.content}}</div>
  145. </template>
  146. </el-table-column>
  147. <el-table-column
  148. align="center"
  149. prop="replyTime"
  150. :label="$t('productComm.replyTime')">
  151. <template slot-scope="scope">
  152. <div>{{scope.row.replyTime}}</div>
  153. </template>
  154. </el-table-column>
  155. <el-table-column
  156. fixed="right"
  157. align="center"
  158. :label="$t('publics.operating')"
  159. width="250"
  160. >
  161. <template slot-scope="scope">
  162. <div class="text-btn-con">
  163. <div
  164. class="default-btn text-btn"
  165. @click="openOrderInfo(scope.row.prodCommId)"
  166. >订单
  167. </div>
  168. <div
  169. class="default-btn text-btn"
  170. @click="addOrUpdateHandle(scope.row.prodCommId, true)"
  171. >{{$t('groups.edit')}}
  172. </div>
  173. <div
  174. class="default-btn text-btn"
  175. @click="addOrUpdateHandle(scope.row.prodCommId, false)"
  176. >{{$t('查看')}}
  177. </div>
  178. <div
  179. class="default-btn text-btn"
  180. @click="deleteHandle(scope.row.prodCommId)"
  181. >{{$t("text.delBtn")}}
  182. </div>
  183. <div
  184. class="default-btn text-btn"
  185. @click="handleAudit(scope.row.prodCommId)"
  186. >审核
  187. </div>
  188. </div>
  189. </template>
  190. </el-table-column>
  191. </el-table>
  192. </div>
  193. <el-pagination
  194. v-if="dataList.length"
  195. @size-change="handleSizeChange"
  196. @current-change="handleCurrentChange"
  197. :current-page="page.currentPage"
  198. :page-sizes="[10, 20, 50, 100]"
  199. :page-size="page.pageSize"
  200. layout="total, sizes, prev, pager, next, jumper"
  201. :total="page.total">
  202. </el-pagination>
  203. </div>
  204. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="refreshChange"></add-or-update>
  205. <order-info ref="orderInfo"></order-info>
  206. </div>
  207. </template>
  208. <script>
  209. import AddOrUpdate from './prodComm-add-or-update'
  210. import OrderInfo from "../order/orderInfo";
  211. export default {
  212. data () {
  213. return {
  214. dataList: [],
  215. page: {
  216. total: 0, // 总页数
  217. currentPage: 1, // 当前页数
  218. pageSize: 20 // 每页显示多少条
  219. },
  220. searchForm: {
  221. prodName: '',
  222. nickName: '',
  223. status: ''
  224. },
  225. recDateRange: [],
  226. replyDateRange: [],
  227. dataListLoading: false,
  228. addOrUpdateVisible: false
  229. }
  230. },
  231. components: {
  232. AddOrUpdate,
  233. OrderInfo
  234. },
  235. created () {
  236. this.getDataList()
  237. },
  238. mounted () {
  239. },
  240. methods: {
  241. handleAudit(prodCommId){
  242. this.$confirm("请确认审核状态", this.$i18n.t('text.tips'), {
  243. distinguishCancelAndClose:true,
  244. confirmButtonText: "通过",
  245. cancelButtonText: "不通过",
  246. type: 'warning'
  247. }).then(() => {
  248. this.$http({
  249. url: this.$http.adornUrl('/prod/prodComm/audit'),
  250. method: 'post',
  251. data: this.$http.adornData({prodCommId:prodCommId, status: 1})
  252. }).then(({ data }) => {
  253. this.getDataList(this.page);
  254. this.$message({
  255. message: "审核操作成功",
  256. type: 'success',
  257. })
  258. })
  259. }).catch(action => {
  260. if(action === 'cancel'){
  261. this.$http({
  262. url: this.$http.adornUrl('/prod/prodComm/audit'),
  263. method: 'post',
  264. data: this.$http.adornData({prodCommId:prodCommId, status:-1})
  265. }).then(({ data }) => {
  266. this.getDataList(this.page);
  267. this.$message({
  268. message: "审核操作成功",
  269. type: 'success',
  270. })
  271. })
  272. }
  273. })
  274. },
  275. getDataList (page) {
  276. this.dataListLoading = true
  277. this.$http({
  278. url: this.$http.adornUrl('/prod/prodComm/page'),
  279. method: 'get',
  280. params: this.$http.adornParams(Object.assign({
  281. current: page == null ? this.page.currentPage : page.currentPage,
  282. size: page == null ? this.page.pageSize : page.pageSize,
  283. 'recStartTime': this.recDateRange === null ? null : this.recDateRange[0],
  284. 'recEndTime': this.recDateRange === null ? null : this.recDateRange[1],
  285. 'replyTimeStart': this.replyDateRange === null ? null : this.replyDateRange[0],
  286. 'replyTimeEnd': this.replyDateRange === null ? null : this.replyDateRange[1]
  287. }, this.searchForm))
  288. }).then(({ data }) => {
  289. this.dataList = data.records
  290. this.page.total = data.total
  291. this.page.pageSize = data.size
  292. this.page.currentPage = data.current
  293. this.dataListLoading = false
  294. })
  295. },
  296. openOrderInfo(prodCommId){
  297. this.$http({
  298. url: this.$http.adornUrl(`/prod/prodComm/info/${prodCommId}`),
  299. method: 'GET',
  300. params: this.$http.adornParams()
  301. }).then(({data}) => {
  302. if(data){
  303. this.$refs.orderInfo.init({
  304. orderNumber: data.orderNumber
  305. })
  306. }
  307. })
  308. },
  309. // 新增 / 修改
  310. addOrUpdateHandle (id, isEdit) {
  311. this.addOrUpdateVisible = true
  312. this.$nextTick(() => {
  313. this.$refs.addOrUpdate.init(id, isEdit)
  314. })
  315. },
  316. deleteHandle: function (prodCommId) {
  317. this.$confirm(this.$i18n.t('admin.isDeleOper'), this.$i18n.t('text.tips'), {
  318. confirmButtonText: this.$i18n.t('crud.filter.submitBtn'),
  319. cancelButtonText: this.$i18n.t('crud.filter.cancelBtn'),
  320. type: 'warning'
  321. }).then(() => {
  322. this.$http({
  323. url: this.$http.adornUrl('/prod/prodComm/' + prodCommId),
  324. method: 'delete',
  325. data: this.$http.adornData({})
  326. }).then(({ data }) => {
  327. this.$message({
  328. message: this.$i18n.t('publics.operation'),
  329. type: 'success',
  330. duration: 1500,
  331. onClose: () => {
  332. this.refreshChange()
  333. }
  334. })
  335. })
  336. }).catch(() => { })
  337. },
  338. // 刷新回调用
  339. refreshChange () {
  340. this.getDataList(this.page)
  341. },
  342. searchChange () {
  343. this.page.currentPage = 1
  344. this.getDataList(this.page)
  345. },
  346. /**
  347. * 重置表单
  348. * @param {String} formName 表单名称
  349. */
  350. resetSearchForm (formName) {
  351. this.$refs[formName].resetFields()
  352. this.replyDateRange = []
  353. this.recDateRange = []
  354. },
  355. handleSizeChange (val) {
  356. this.page.pageSize = val
  357. this.getDataList()
  358. },
  359. handleCurrentChange (val) {
  360. this.page.currentPage = val
  361. this.getDataList()
  362. }
  363. }
  364. }
  365. </script>
  366. <style lang="scss" scoped>
  367. </style>