曲靖复制郫都 商品管理,订单管理,网格员积分
This commit is contained in:
		
							
								
								
									
										63
									
								
								project/qujing/app/AppGoods/AppGoods.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								project/qujing/app/AppGoods/AppGoods.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,63 @@ | ||||
| <template> | ||||
|   <div class="doc-circulation"> | ||||
|     <keep-alive :include="['List']"> | ||||
|       <component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component> | ||||
|     </keep-alive> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   import List from './components/List' | ||||
|   import Add from './components/Add' | ||||
|  | ||||
|   export default { | ||||
|     name: 'AppGoods', | ||||
|     label: '商品管理', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         component: 'List', | ||||
|         params: {}, | ||||
|         include: [] | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     components: { | ||||
|       Add, | ||||
|       List | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       onChange (data) { | ||||
|         if (data.type === 'Add') { | ||||
|           this.component = 'Add' | ||||
|           this.params = data.params | ||||
|         } | ||||
|  | ||||
|         if (data.type === 'List') { | ||||
|           this.component = 'List' | ||||
|           this.params = data.params | ||||
|  | ||||
|           this.$nextTick(() => { | ||||
|             if (data.isRefresh) { | ||||
|               this.$refs.component.getList() | ||||
|             } | ||||
|           }) | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss"> | ||||
|   .doc-circulation { | ||||
|     height: 100%; | ||||
|     background: #F3F6F9; | ||||
|     overflow: auto; | ||||
|   } | ||||
| </style> | ||||
							
								
								
									
										268
									
								
								project/qujing/app/AppGoods/components/Add.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										268
									
								
								project/qujing/app/AppGoods/components/Add.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,268 @@ | ||||
| <template> | ||||
|   <ai-detail class="appgoods"> | ||||
|     <template slot="title"> | ||||
|       <ai-title title="添加商品" isShowBack isShowBottomBorder @onBackClick="cancel(false)"> | ||||
|       </ai-title> | ||||
|     </template> | ||||
|     <template slot="content"> | ||||
|       <ai-card title="基本信息"> | ||||
|         <template #content> | ||||
|           <el-form :model="form" label-width="120px" ref="form"> | ||||
|             <el-form-item label="商品名称" prop="merchandiseName" :rules="[{required: true, message: '请输入商品名称', trigger: 'blur'}]"> | ||||
|               <el-input type="input" v-model="form.merchandiseName" clearable placeholder="请输入商品名称" maxlength="30" show-word-limit></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="商品图片" prop="imageUrl" :rules="[{required: true, message: '请选择商品图片', trigger: 'change'}]"> | ||||
|               <ai-uploader | ||||
|                 :instance="instance" | ||||
|                 isShowTip | ||||
|                 isCrop | ||||
|                 :cropOps="{ | ||||
|                   fixedNumber: [1, 1] | ||||
|                 }" | ||||
|                 v-model="form.imageUrl" | ||||
|                 :limit="1"> | ||||
|                 <template slot="tips"> | ||||
|                   <p>最多上传1张图片,单个文件最大10MB,支持jpg、jpeg、png格式</p> | ||||
|                   <p>建议尺寸:800*800</p> | ||||
|                 </template> | ||||
|               </ai-uploader> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="商品单价" prop="merchandiseIntegral" :rules="[{required: true, message: '请输入商品单价', trigger: 'blur'}]"> | ||||
|               <el-input-number type="input" v-model="form.merchandiseIntegral" clearable placeholder="请输入商品单价" :min="1"></el-input-number> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="商品库存" prop="merchandiseNumber" :rules="[{required: true, message: '请输入商品库存', trigger: 'blur'}]"> | ||||
|               <el-input-number type="input" v-model="form.merchandiseNumber" clearable placeholder="请输入商品库存" :min="1"></el-input-number> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="可见范围" prop="visibleRange" :rules="[{required: true, message: '请输入商品名称', trigger: 'blur'}]"> | ||||
|               <el-radio-group v-model="form.visibleRange"> | ||||
|                 <el-radio label="0">不限</el-radio> | ||||
|                 <el-radio label="1">仅指定网格可见</el-radio> | ||||
|               </el-radio-group> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="选择网格" v-if="form.visibleRange === '1'" prop="wxGroupsName" style="width: 100%;" :rules="[{ required: true, message: '请选择网格', trigger: 'change' }]"> | ||||
|               <ai-picker | ||||
|                 :instance="instance" | ||||
|                 multiple | ||||
|                 dialogTitle="选择网格" | ||||
|                 :ops="{label: 'girdName'}" | ||||
|                 pageTitle="网格" | ||||
|                 action="/app/appgirdinfo/girdList" | ||||
|                 v-model="form.rangeList" | ||||
|                 @pick="onPick" | ||||
|                 @change="onSelcetChange"> | ||||
|                 <div class="AppAnnounceDetail-select"> | ||||
|                   <el-input size="small" class="AppAnnounceDetail-select__input" placeholder="请选择..." disabled v-model="form.wxGroupsName"></el-input> | ||||
|                   <div class="select-left" v-if="form.rangeList.length"> | ||||
|                     <span v-for="(item, index) in girdList" :key="index" v-if="index < 9">{{ item.girdName }}</span> | ||||
|                     <em v-if="girdList.length > 9">等{{ girdList.length }}个</em> | ||||
|                   </div> | ||||
|                   <i v-if="!form.rangeList.length">请选择</i> | ||||
|                   <div class="select-right">{{ form.rangeList.length ? '重新选择' : '选择' }}</div> | ||||
|                 </div> | ||||
|               </ai-picker> | ||||
|             </el-form-item> | ||||
|           </el-form> | ||||
|         </template> | ||||
|       </ai-card> | ||||
|     </template> | ||||
|     <template #footer> | ||||
|       <el-button @click="cancel">取消</el-button> | ||||
|       <el-button type="primary" @click="confirm">提交</el-button> | ||||
|     </template> | ||||
|   </ai-detail> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   export default { | ||||
|     name: 'Add', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object, | ||||
|       params: Object | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         info: {}, | ||||
|         form: { | ||||
|           merchandiseName: '', | ||||
|           merchandiseIntegral: '', | ||||
|           merchandiseNumber: '', | ||||
|           wxGroupsName: '', | ||||
|           rangeList: [], | ||||
|           visibleRange: '', | ||||
|           imageUrl: [] | ||||
|         }, | ||||
|         girdList: [], | ||||
|         cropOps: { | ||||
|           width: "336px", | ||||
|           height: "210px" | ||||
|         }, | ||||
|         id: '' | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     created () { | ||||
|       if (this.params && this.params.id) { | ||||
|         this.id = this.params.id | ||||
|         this.getInfo(this.params.id) | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       getInfo (id) { | ||||
|         this.instance.post(`/app/appintegralmerchandise/queryDetailById?id=${id}`).then(res => { | ||||
|           if (res.code === 0) { | ||||
|             this.form = res.data | ||||
|             this.form.imageUrl = [{ | ||||
|               url: res.data.imageUrl | ||||
|             }] | ||||
|  | ||||
|             if (res.data.rangeList && res.data.rangeList.length) { | ||||
|               this.form.wxGroupsName = 1 | ||||
|               this.girdList = res.data.rangeList.map(v => { | ||||
|                 return { | ||||
|                   ...v, | ||||
|                   id: v.rangeId, | ||||
|                   girdName: v.rangeName | ||||
|                 } | ||||
|               }) | ||||
|               this.form.rangeList = res.data.rangeList.map(v => v.rangeId) | ||||
|             } | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       onPick (e) { | ||||
|         this.girdList = e | ||||
|       }, | ||||
|  | ||||
|       onSelcetChange (e) { | ||||
|         if (e.length) { | ||||
|           this.form.wxGroupsName = '1' | ||||
|         } else { | ||||
|           this.form.wxGroupsName = '' | ||||
|           this.form.wxGroups = [] | ||||
|         } | ||||
|       }, | ||||
|  | ||||
|       confirm () { | ||||
|         this.$refs.form.validate((valid) => { | ||||
|           if (valid) { | ||||
|             this.instance.post(`/app/appintegralmerchandise/addOrUpdate`, { | ||||
|               ...this.form, | ||||
|               imageUrl: this.form.imageUrl[0].url, | ||||
|               rangeList: this.girdList.length ? this.girdList.map(v => { | ||||
|                 return { | ||||
|                   rangeId: v.id, | ||||
|                   rangeName: v.girdName | ||||
|                 } | ||||
|               }): [] | ||||
|             }).then(res => { | ||||
|               if (res.code == 0) { | ||||
|                 this.$message.success('提交成功') | ||||
|                 setTimeout(() => { | ||||
|                   this.cancel(true) | ||||
|                 }, 600) | ||||
|               } | ||||
|             }) | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       cancel (isRefresh) { | ||||
|         this.$emit('change', { | ||||
|           type: 'List', | ||||
|           isRefresh: !!isRefresh | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style scoped lang="scss"> | ||||
|   .appgoods { | ||||
|     .AppAnnounceDetail-select { | ||||
|       display: flex; | ||||
|       align-items: center; | ||||
|       min-height: 32px; | ||||
|       line-height: 1; | ||||
|       background: #F5F5F5; | ||||
|       border-radius: 4px; | ||||
|       border: 1px solid #D0D4DC; | ||||
|       cursor: pointer; | ||||
|       overflow: hidden; | ||||
|       transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); | ||||
|  | ||||
|       &:hover { | ||||
|         border-color: #26f; | ||||
|       } | ||||
|  | ||||
|       & > i { | ||||
|         flex: 1; | ||||
|         height: 100%; | ||||
|         line-height: 32px; | ||||
|         padding: 0 12px; | ||||
|         color: #888888; | ||||
|         font-size: 14px; | ||||
|         font-style: normal; | ||||
|         border-right: 1px solid #D0D4DC; | ||||
|         background: #fff; | ||||
|       } | ||||
|  | ||||
|       .AppAnnounceDetail-select__input { | ||||
|         position: absolute; | ||||
|         left: 0; | ||||
|         top: 0; | ||||
|         z-index: -1; | ||||
|         opacity: 0; | ||||
|         height: 100%; | ||||
|       } | ||||
|  | ||||
|       .select-right { | ||||
|         height: 100%; | ||||
|         padding: 0 12px; | ||||
|         color: #222222; | ||||
|         font-size: 12px; | ||||
|         cursor: pointer; | ||||
|         transition: all ease 0.3s; | ||||
|  | ||||
|         &:hover { | ||||
|           opacity: 0.5; | ||||
|         } | ||||
|       } | ||||
|  | ||||
|       .select-left { | ||||
|         display: flex; | ||||
|         flex-wrap: wrap; | ||||
|         flex: 1; | ||||
|         padding: 5px 0 0px 12px; | ||||
|         border-right: 1px solid #D0D4DC; | ||||
|         border-radius: 4px 0 0 4px; | ||||
|         background: #fff; | ||||
|  | ||||
|         em { | ||||
|           height: 22px; | ||||
|           line-height: 22px; | ||||
|           margin: 0 4px 5px 0; | ||||
|           color: #222222; | ||||
|           font-size: 12px; | ||||
|           font-style: normal; | ||||
|         } | ||||
|  | ||||
|         span { | ||||
|           height: 22px; | ||||
|           line-height: 22px; | ||||
|           margin: 0 4px 5px 0; | ||||
|           padding: 0 8px; | ||||
|           font-size: 12px; | ||||
|           color: #222222; | ||||
|           background: #F3F4F7; | ||||
|           border-radius: 2px; | ||||
|           border: 1px solid #D0D4DC; | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </style> | ||||
							
								
								
									
										270
									
								
								project/qujing/app/AppGoods/components/List.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										270
									
								
								project/qujing/app/AppGoods/components/List.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,270 @@ | ||||
| <template> | ||||
|   <ai-list class="list"> | ||||
|     <ai-title slot="title" title="商品管理" isShowBottomBorder> | ||||
|       <template #sub> | ||||
|         <span>添加的商品即可在积分超市中下单兑换</span> | ||||
|       </template> | ||||
|     </ai-title> | ||||
|     <template slot="content"> | ||||
|       <ai-search-bar bottomBorder> | ||||
|         <template #left> | ||||
|           <ai-picker | ||||
|             :instance="instance" | ||||
|             dialogTitle="选择网格" | ||||
|             :ops="{label: 'girdName'}" | ||||
|             pageTitle="网格" | ||||
|             action="/app/appgirdinfo/girdList" | ||||
|             @pick="onPick" | ||||
|             @change="search.current = 1, getList()"> | ||||
|             <div class="AppAnnounceDetail-select"> | ||||
|               <div class="userSelcet"> | ||||
|                 <span style="color: #606266;" v-if="girdList.length">{{ girdList.length ? girdList[0].girdName : '' }}</span> | ||||
|                 <span v-else>选择网格</span> | ||||
|                 <i class="el-icon-arrow-up"  v-if="!girdList.length"></i> | ||||
|                 <i class="el-icon-circle-close" v-if="girdList.length" @click.stop="girdList = [], search.girdId = '', search.current = 1, getList()"></i> | ||||
|               </div> | ||||
|             </div> | ||||
|           </ai-picker> | ||||
|           <el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加商品</el-button> | ||||
|         </template> | ||||
|         <template #right> | ||||
|           <el-input | ||||
|             v-model="search.merchandiseName" | ||||
|             size="small" | ||||
|             placeholder="请输入商品名称" | ||||
|             clearable | ||||
|             v-throttle="() => {search.current = 1, getList()}" | ||||
|             @clear="search.current = 1, search.merchandiseName = '', getList()" | ||||
|             suffix-icon="iconfont iconSearch"> | ||||
|           </el-input> | ||||
|         </template> | ||||
|       </ai-search-bar> | ||||
|       <ai-table | ||||
|         :tableData="tableData" | ||||
|         :col-configs="colConfigs" | ||||
|         :total="total" | ||||
|         v-loading="loading" | ||||
|         style="margin-top: 16px;" | ||||
|         :current.sync="search.current" | ||||
|         :size.sync="search.size" | ||||
|         @getList="getList"> | ||||
|         <el-table-column slot="goods" width="280px" label="商品" align="left"> | ||||
|           <template slot-scope="{ row }"> | ||||
|             <div class="goods"> | ||||
|               <ai-uploader | ||||
|                 :instance="instance" | ||||
|                 disabled | ||||
|                 :value="[{url: row.imageUrl}]" | ||||
|                 :limit="1"> | ||||
|               </ai-uploader> | ||||
|               <span :title="row.merchandiseName">{{ row.merchandiseName }}</span> | ||||
|             </div> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column slot="options" width="160px" fixed="right" label="操作" align="center"> | ||||
|           <template slot-scope="{ row }"> | ||||
|             <div class="table-options"> | ||||
|               <el-button type="text" @click="operation(row.id, 0)" v-if="row.status === '0' || row.status === '2'">下架</el-button> | ||||
|               <el-button type="text" @click="operation(row.id, 1)" v-if="row.status === '1'">上架</el-button> | ||||
|               <el-button type="text" @click="toAdd(row.id)">编辑</el-button> | ||||
|               <el-button type="text" @click="remove(row.id)">删除</el-button> | ||||
|             </div> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </ai-table> | ||||
|     </template> | ||||
|   </ai-list> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   export default { | ||||
|     name: 'List', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         search: { | ||||
|           current: 1, | ||||
|           size: 10, | ||||
|           merchandiseName: '', | ||||
|           girdId: '' | ||||
|         }, | ||||
|         name: '', | ||||
|         info: {}, | ||||
|         colConfigs: [ | ||||
|           { slot: 'goods', label: '商品' }, | ||||
|           { prop: 'merchandiseIntegral', align: 'center', label: '单价', sortable: true }, | ||||
|           { prop: 'merchandiseNumber', align: 'center', label: '库存', sortable: true }, | ||||
|           { | ||||
|             prop: 'exchangeNumber', | ||||
|             align: 'center', | ||||
|             label: '兑换量', | ||||
|             sortable: true | ||||
|           }, | ||||
|           { | ||||
|             prop: 'visibleRange', | ||||
|             align: 'center', | ||||
|             label: '可见范围', | ||||
|             format: v => v === '0' ? '不限' : '指定网格' | ||||
|           }, | ||||
|           { | ||||
|             prop: 'launchTime', | ||||
|             align: 'center', | ||||
|             label: '上架时间' | ||||
|           }, | ||||
|           { | ||||
|             prop: 'status', | ||||
|             align: 'center', | ||||
|             label: '状态', | ||||
|             format: v => this.mapStatus(v) | ||||
|           } | ||||
|         ], | ||||
|         ids: [], | ||||
|         tableData: [], | ||||
|         total: 0, | ||||
|         loading: false, | ||||
|         girdList: [] | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     created () { | ||||
|       this.getList() | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       onPick (e) { | ||||
|         this.girdList = e | ||||
|  | ||||
|         if (e.length) { | ||||
|           this.search.girdId = e[0].id | ||||
|         } else { | ||||
|           this.search.girdId = '' | ||||
|  | ||||
|           this.getList() | ||||
|         } | ||||
|       }, | ||||
|       getList () { | ||||
|         this.instance.post(`/app/appintegralmerchandise/list`, null, { | ||||
|           params: { | ||||
|             ...this.search | ||||
|           } | ||||
|         }).then(res => { | ||||
|           if (res.code == 0) { | ||||
|             this.tableData = res.data.records | ||||
|             this.total = res.data.total | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       mapStatus (status) { | ||||
|         return { | ||||
|           '0': '可兑换', | ||||
|           '1': '已下架', | ||||
|           '2': '已兑完', | ||||
|           '3': '已删除' | ||||
|         }[status] | ||||
|       }, | ||||
|  | ||||
|       toAdd (id) { | ||||
|         this.$emit('change', { | ||||
|           type: 'Add', | ||||
|           params: { | ||||
|             id: id || '' | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       operation (id, status) { | ||||
|         this.$confirm(status === '1' ? '确定上架该商品?' : '确定下架该商品?').then(() => { | ||||
|           this.instance.post(`/app/appintegralmerchandise/takeOnOffById?id=${id}&opType=${status}`).then(res => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success(status === '1' ? '上架成功' : '下架成功') | ||||
|               this.getList() | ||||
|             } | ||||
|           }) | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       remove (id) { | ||||
|         this.$confirm('删除后,商品将不可恢复,是否继续?').then(() => { | ||||
|           this.instance.post(`/app/appintegralmerchandise/delete?ids=${id}`).then(res => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success('删除成功!') | ||||
|               this.getList() | ||||
|             } | ||||
|           }) | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style scoped lang="scss"> | ||||
|   .list { | ||||
|     .goods { | ||||
|       display: flex; | ||||
|       align-items: center; | ||||
|  | ||||
|       img { | ||||
|         width: 80px; | ||||
|         height: 80px; | ||||
|         margin-right: 20px; | ||||
|       } | ||||
|  | ||||
|       span { | ||||
|         flex: 1; | ||||
|         display: -webkit-box; | ||||
|         overflow: hidden; | ||||
|         -webkit-line-clamp: 2; | ||||
|         -webkit-box-orient: vertical; | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     .userSelcet { | ||||
|       display: flex; | ||||
|       align-items: center; | ||||
|       justify-content: space-between; | ||||
|       width: 215px; | ||||
|       height: 32px; | ||||
|       line-height: 32px; | ||||
|       border-radius: 4px; | ||||
|       border: 1px solid #d0d4dc; | ||||
|       overflow: hidden; | ||||
|       cursor: pointer; | ||||
|       transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); | ||||
|  | ||||
|       &:hover { | ||||
|         border-color: $placeholderColor; | ||||
|       } | ||||
|  | ||||
|       i { | ||||
|         display: flex; | ||||
|         position: relative; | ||||
|         align-items: center; | ||||
|         justify-content: center; | ||||
|         width: 30px; | ||||
|         height: 100%; | ||||
|         line-height: 32px; | ||||
|         font-size: 14px; | ||||
|         text-align: center; | ||||
|         color: #d0d4dc; | ||||
|         transform: rotateZ(180deg); | ||||
|       } | ||||
|  | ||||
|       .el-icon-circle-close:hover { | ||||
|         opacity: 0.6; | ||||
|       } | ||||
|  | ||||
|       span { | ||||
|         flex: 1; | ||||
|         padding: 0 15px; | ||||
|         font-size: 12px; | ||||
|         color: $placeholderColor; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </style> | ||||
							
								
								
									
										56
									
								
								project/qujing/app/AppGridMemberScore/AppGridMemberScore.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								project/qujing/app/AppGridMemberScore/AppGridMemberScore.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,56 @@ | ||||
| <template> | ||||
|   <keep-alive include="gmScore"> | ||||
|     <component :is="currentPage" v-bind="$props" @change="onChange"/> | ||||
|   </keep-alive> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import gridScoreManage from "./components/gridScoreManage.vue" | ||||
| import gridScoreRules from "./components/gridScoreRules.vue" | ||||
| import gridScoreStatistics from './components/gridScoreStatistics.vue' | ||||
| import gridScoreDetail from './components/gridScoreDetail.vue' | ||||
| import gmScore from './components/gmScore.vue' | ||||
|  | ||||
| export default { | ||||
|   name: 'AppGridMemberScore', | ||||
|   label: "网格员积分", | ||||
|  | ||||
|   props: { | ||||
|     instance: Function, | ||||
|     dict: Object, | ||||
|     permissions: Function, | ||||
|     menuName: {default: "网格员积分"} | ||||
|   }, | ||||
|   computed: { | ||||
|     currentPage() { | ||||
|       let {hash} = this.$route | ||||
|       return hash == "#gridScoreDetail" ? gridScoreDetail : | ||||
|           hash == "#gridScoreRules" ? gridScoreRules : | ||||
|               hash == "#gridScoreStatistics" ? gridScoreStatistics : | ||||
|                   hash == "#gridScoreManage" ? gridScoreManage : gmScore | ||||
|     } | ||||
|   }, | ||||
|   components: { | ||||
|     gmScore, | ||||
|     gridScoreManage, | ||||
|     gridScoreRules, | ||||
|     gridScoreStatistics, | ||||
|     gridScoreDetail, | ||||
|   }, | ||||
|  | ||||
|   methods: { | ||||
|     onChange(data) { | ||||
|       let {type, params: query} = data, | ||||
|           hash = ["gridScoreManage", "gridScoreRules", "gridScoreStatistics"].includes(type) ? "" : "#" + type | ||||
|       this.$router.push({hash, query}) | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| .AppGridMemberScore { | ||||
|   height: 100%; | ||||
|   width: 100%; | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										169
									
								
								project/qujing/app/AppGridMemberScore/components/ApplyList.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										169
									
								
								project/qujing/app/AppGridMemberScore/components/ApplyList.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,169 @@ | ||||
| <template> | ||||
|   <ai-list class="list" isTabs> | ||||
|     <template slot="content"> | ||||
|       <ai-search-bar bottomBorder> | ||||
|         <template #left> | ||||
|           <ai-select | ||||
|             v-model="search.status" | ||||
|             clearable | ||||
|             placeholder="请选择审核状态" | ||||
|             :selectList="dict.getDict('integralDeclareStatus')" | ||||
|             @change="search.current = 1, getList()"> | ||||
|           </ai-select> | ||||
|         </template> | ||||
|         <template #right> | ||||
|           <el-input | ||||
|             v-model="search.createUserName" | ||||
|             size="small" | ||||
|             placeholder="请输入申请人名称" | ||||
|             clearable | ||||
|             v-throttle="() => {search.current = 1, getList()}" | ||||
|             @clear="search.current = 1, search.createUserName = '', getList()" | ||||
|             suffix-icon="iconfont iconSearch"> | ||||
|           </el-input> | ||||
|         </template> | ||||
|       </ai-search-bar> | ||||
|       <ai-table | ||||
|         :tableData="tableData" | ||||
|         :col-configs="colConfigs" | ||||
|         :total="total" | ||||
|         style="margin-top: 16px;" | ||||
|         :current.sync="search.current" | ||||
|         :size.sync="search.size" | ||||
|         @getList="getList"> | ||||
|         <el-table-column slot="imgs" width="240px" label="凭证" align="center"> | ||||
|           <template slot-scope="{ row }"> | ||||
|             <ai-uploader | ||||
|               :instance="instance" | ||||
|               disabled | ||||
|               :value="[{ | ||||
|                 url: row.voucherImageUrl | ||||
|               }]" | ||||
|               :limit="1"> | ||||
|             </ai-uploader> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column slot="options" width="120px" fixed="right" label="操作" align="center"> | ||||
|           <template slot-scope="{ row }"> | ||||
|             <div class="table-options"> | ||||
|               <el-button type="text" @click="operation(row)" v-if="row.status === '0'">审核</el-button> | ||||
|             </div> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </ai-table> | ||||
|       <ai-dialog :customFooter="true" | ||||
|         title="积分审核" | ||||
|         :visible.sync="dialog" | ||||
|         :destroyOnClose="true" | ||||
|         width="720px"> | ||||
|         <el-form ref="form" :model="form" :rules="rules" label-width="80px"> | ||||
|           <el-form-item label="积分" prop="applyIntegral"> | ||||
|             <el-input v-model.trim="form.applyIntegral" placeholder="请输入正数" size="small"></el-input> | ||||
|           </el-form-item> | ||||
|         </el-form> | ||||
|         <p style="padding-left:80px;font-weight:700;">请根据申请事项和凭证选是否审核通过</p> | ||||
|         <div class="dialog-footer" slot="footer"> | ||||
|           <el-button @click="onCancel" size="medium">审核拒绝</el-button> | ||||
|           <el-button @click="onConfirm" type="primary" size="medium">审核通过</el-button> | ||||
|         </div> | ||||
|       </ai-dialog> | ||||
|     </template> | ||||
|   </ai-list> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   export default { | ||||
|     name: 'List', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         search: { | ||||
|           current: 1, | ||||
|           size: 10, | ||||
|           createUserName: '', | ||||
|           status: '' | ||||
|         }, | ||||
|         name: '', | ||||
|         info: {}, | ||||
|         colConfigs: [ | ||||
|           { prop: 'createUserName', align: 'left', label: '申请人' }, | ||||
|           { prop: 'eventType', align: 'center', label: '事件类型', dict: 'integralApplyEventType'}, | ||||
|           { prop: 'applyItem', align: 'center', label: '申请事项' }, | ||||
|           { slot: 'imgs', label: '凭证' }, | ||||
|           { | ||||
|             prop: 'applyIntegral', | ||||
|             align: 'center', | ||||
|             label: '积分数' | ||||
|           }, | ||||
|           { | ||||
|             prop: 'status', | ||||
|             align: 'center', | ||||
|             label: '状态', | ||||
|             format: v => this.dict.getLabel('integralDeclareStatus', v) | ||||
|           } | ||||
|         ], | ||||
|         tableData: [], | ||||
|         total: 0, | ||||
|         form: {applyIntegral: '', id: ''}, | ||||
|         rules: { | ||||
|           applyIntegral: [{required: true, message: '请输入积分', trigger: 'blur' }, | ||||
|           {pattern: /^([1-9]\d*|0)(\.\d{1,2})?$/, message: '请输入正数且最多只能保留两位小数'}], | ||||
|         }, | ||||
|         dialog: false, | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     created () { | ||||
|       this.dict.load('integralDeclareStatus', 'integralApplyEventType').then(() => { | ||||
|         this.getList() | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       getList () { | ||||
|         this.instance.post(`/app/appintegralmemberapply/list`, null, { | ||||
|           params: { | ||||
|             ...this.search | ||||
|           } | ||||
|         }).then(res => { | ||||
|           if (res.code == 0) { | ||||
|             this.tableData = res.data.records | ||||
|             this.total = res.data.total | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       operation (row) { | ||||
|         this.dialog = true | ||||
|         this.form = {...row} | ||||
|       }, | ||||
|  | ||||
|       onConfirm() { | ||||
|         this.instance.post(`/app/appintegralmemberapply/auditApply?id=${this.form.id}&opType=1&applyIntegral=${this.form.applyIntegral}`).then(res => { | ||||
|           if (res.code == 0) { | ||||
|             this.$message.success('审核通过成功') | ||||
|             this.dialog = false | ||||
|             this.getList() | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|       onCancel() { | ||||
|         this.instance.post(`/app/appintegralmemberapply/auditApply?id=${this.form.id}&opType=2&applyIntegral=${this.form.applyIntegral}`).then(res => { | ||||
|           if (res.code == 0) { | ||||
|             this.$message.success('审核拒绝成功') | ||||
|             this.dialog = false | ||||
|             this.getList() | ||||
|           } | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style scoped lang="scss"> | ||||
| </style> | ||||
							
								
								
									
										94
									
								
								project/qujing/app/AppGridMemberScore/components/gmScore.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								project/qujing/app/AppGridMemberScore/components/gmScore.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,94 @@ | ||||
| <template> | ||||
|   <ai-list class="AppGridMemberScore"> | ||||
|     <template slot="title"> | ||||
|       <ai-title :title="menuName" :isShowBottomBorder="false" :instance="instance"> | ||||
|         <template slot="sub"> | ||||
|           <div>网格员可通过完成某些任务获取一定数量的积分,积分可去兑换相应的奖励。</div> | ||||
|         </template> | ||||
|       </ai-title> | ||||
|     </template> | ||||
|     <template slot="tabs"> | ||||
|       <el-tabs v-model="currIndex"> | ||||
|         <el-tab-pane v-for="(tab,i) in tabs" :key="i" :label="tab.label"> | ||||
|           <component :is="tab.comp" v-if="currIndex === String(i)" :ref="tab.name" v-on="$listeners" :areaId="areaId" v-bind="$props"/> | ||||
|         </el-tab-pane> | ||||
|       </el-tabs> | ||||
|     </template> | ||||
|   </ai-list> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import girdScoreManage from "./gridScoreManage.vue" | ||||
| import gridScoreRules from "./gridScoreRules.vue" | ||||
| import ApplyList from './ApplyList.vue' | ||||
| import gridScoreStatistics from './gridScoreStatistics.vue' | ||||
| import {mapState} from 'vuex' | ||||
|  | ||||
| export default { | ||||
|   name: 'gmScore', | ||||
|   components: { | ||||
|     girdScoreManage, | ||||
|     gridScoreRules, | ||||
|     ApplyList, | ||||
|     gridScoreStatistics | ||||
|   }, | ||||
|   props: { | ||||
|     instance: Function, | ||||
|     dict: Object, | ||||
|     permissions: Function, | ||||
|     menuName: String | ||||
|   }, | ||||
|  | ||||
|   data() { | ||||
|     return { | ||||
|       currIndex: "0", | ||||
|       areaId: '', | ||||
|     } | ||||
|   }, | ||||
|  | ||||
|   computed: { | ||||
|     ...mapState(['user']), | ||||
|     tabs() { | ||||
|       return [ | ||||
|         { | ||||
|           label: "积分管理", | ||||
|           name: "girdScoreManage", | ||||
|           comp: girdScoreManage, | ||||
|           permission: "", | ||||
|         }, | ||||
|         { | ||||
|           label: "积分申请", | ||||
|           name: "ApplyList", | ||||
|           comp: ApplyList, | ||||
|           permission: "", | ||||
|         }, | ||||
|         { | ||||
|           label: "积分规则", | ||||
|           name: "gridScoreRules", | ||||
|           comp: gridScoreRules, | ||||
|           permission: "", | ||||
|         }, | ||||
|         { | ||||
|           label: "积分统计", | ||||
|           name: "gridScoreStatistics", | ||||
|           comp: gridScoreStatistics, | ||||
|           permission: "", | ||||
|         }, | ||||
|       ] | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|     this.areaId = this.user.info.areaId | ||||
|     // this.$dict.load("") | ||||
|   }, | ||||
|   methods: {}, | ||||
|  | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| .AppGridMemberScore { | ||||
|   height: 100%; | ||||
|   width: 100%; | ||||
| } | ||||
| </style> | ||||
| @@ -0,0 +1,358 @@ | ||||
| <template> | ||||
|   <section class="gridScoreDetail"> | ||||
|     <ai-title slot="title" :title="`${menuName}详情`" isShowBottomBorder :isShowBack="true" @onBackClick="cancel(false)"/> | ||||
|     <el-row style="margin-top: 20px;"> | ||||
|       <div class="card_list"> | ||||
|         <div class="card"> | ||||
|           <h2>姓名</h2> | ||||
|           <p class="color1">{{ data.userName }}</p> | ||||
|         </div> | ||||
|         <div class="card"> | ||||
|           <h2>积分余额</h2> | ||||
|           <p class="color2">{{ data.integral || 0 }}</p> | ||||
|         </div> | ||||
|         <div class="card"> | ||||
|           <h2>已用积分</h2> | ||||
|           <p class="color3">{{ data.usedIntegral || 0 }}</p> | ||||
|         </div> | ||||
|       </div> | ||||
|     </el-row> | ||||
|     <el-row class="echertsBox" style="margin-bottom: 16px"> | ||||
|       <div class="title"> | ||||
|         <h4>事件汇总</h4> | ||||
|         <div class="timecSelect"> | ||||
|           时间: | ||||
|           <el-date-picker size="small" value-format="yyyy-MM-dd" @change="timeChange" v-model="timeList" type="daterange" range-separator="至" | ||||
|                           :start-placeholder="startPla" :end-placeholder="endPla"></el-date-picker> | ||||
|         </div> | ||||
|       </div> | ||||
|       <div class="bar_Box"> | ||||
|         <div id="chartDom" style="height: 230px; width: 100%;" v-show="xData.length && yData.length"></div> | ||||
|         <ai-empty style="height: 200px; width: 100%;" v-show="!xData.length && !yData.length"></ai-empty> | ||||
|       </div> | ||||
|     </el-row> | ||||
|     <ai-card> | ||||
|       <ai-title slot="title" title="余额变动明细"/> | ||||
|       <template #content> | ||||
|         <ai-search-bar> | ||||
|           <template #left> | ||||
|             <ai-select v-model="search.type" placeholder="请选择类型" @change="search.current=1,getIntegralChange()" | ||||
|                        :selectList="dict.getDict('integralType')"/> | ||||
|           </template> | ||||
|           <template #right> | ||||
|             <ai-download :instance="instance" :url="`/app/appintegraluser/changeIntegralExport?id=${$route.query.id}`" :params="search" fileName="网格员余额变动明细" | ||||
|                          :disabled="tableData.length == 0"> | ||||
|               <el-button size="small">导出</el-button> | ||||
|             </ai-download> | ||||
|           </template> | ||||
|         </ai-search-bar> | ||||
|         <ai-table :tableData="tableData" :total="total" :current.sync="search.current" :size.sync="search.size" | ||||
|                   @getList="getIntegralChange" :col-configs="colConfigs" :dict="dict"> | ||||
|           <el-table-column slot="changeIntegral" label="变动积分" align="center"> | ||||
|             <template slot-scope="{ row }"> | ||||
|               <span v-if="row.integralType == 0">{{ row.integralCalcType == 0 ? '-' : '+' }}{{ row.changeIntegral }}</span> | ||||
|               <span v-if="row.integralType == 1">-{{ row.changeIntegral }}</span> | ||||
|               <span v-if="row.integralType == 2">+{{ row.changeIntegral }}</span> | ||||
|               <span v-if="row.integralType == 3">{{ row.changeIntegral | formatTime }}</span> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|           <el-table-column slot="integralType" label="类型" align="center"> | ||||
|             <template slot-scope="{ row }"> | ||||
|               <span v-if="row.integralType == 0">积分调整</span> | ||||
|               <span v-if="row.integralType == 1">积分消费</span> | ||||
|               <span v-if="row.integralType == 2">积分申请</span> | ||||
|               <span v-if="row.integralType == 3">{{ row.eventType }}</span> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|           <el-table-column slot="eventDesc" label='事件' align="center" width="400px" show-overflow-tooltip> | ||||
|             <template slot-scope="{ row }"> | ||||
|               <span>{{ row.integralRuleName || row.eventDesc}}</span> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|         </ai-table> | ||||
|       </template> | ||||
|     </ai-card> | ||||
|   </section> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import dayjs from "dayjs"; | ||||
| import * as echarts from 'echarts'; | ||||
|  | ||||
| export default { | ||||
|   name: "gridScoreDetail", | ||||
|   data() { | ||||
|     return { | ||||
|       myChart: null, | ||||
|       tableData: [], | ||||
|       search: { | ||||
|         name: '', | ||||
|         girdId: '', | ||||
|         type: '', | ||||
|         current: 1, | ||||
|         size: 10, | ||||
|       }, | ||||
|       total: 0, | ||||
|       girdList: [], | ||||
|       timeList: [], | ||||
|       data: {}, | ||||
|       startTime: '', | ||||
|       endTime: '', | ||||
|       xData: [], | ||||
|       yData: [], | ||||
|       startPla: '', | ||||
|       endPla: '' | ||||
|     } | ||||
|   }, | ||||
|   props: { | ||||
|     instance: Function, | ||||
|     dict: Object, | ||||
|     permissions: Function, | ||||
|     menuName: String | ||||
|   }, | ||||
|  | ||||
|   computed: { | ||||
|     colConfigs() { | ||||
|       return [ | ||||
|         {prop: "doTime", label: '时间', align: "left", width: "200px"}, | ||||
|         {slot: "integralType", label: '类型', align: "center", width: "240px", dict: "integralType"}, | ||||
|         {slot: "changeIntegral"}, | ||||
|         {prop: "nowIntegral", label: '剩余积分', align: "center", width: "200px"}, | ||||
|         {slot: "eventDesc"}, | ||||
|       ] | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|     this.$dict.load('integralType').then(() => { | ||||
|       this.getDetail() | ||||
|       this.getIntegralChange() | ||||
|       this.getEventSummary() | ||||
|       let nowTime = dayjs().format('YYYY-MM-DD') | ||||
|       this.startPla = dayjs().subtract(29, 'day').format('YYYY-MM-DD') | ||||
|       this.endPla = nowTime | ||||
|     }) | ||||
|  | ||||
|   }, | ||||
|   methods: { | ||||
|     // 详情 | ||||
|     getDetail() { | ||||
|       this.instance.post(`/app/appintegraluser/girdDetail`, null, { | ||||
|         params: { | ||||
|           id: this.$route.query.id | ||||
|         } | ||||
|       }).then(res => { | ||||
|         if (res?.data) { | ||||
|           this.data = res.data | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     // 事件汇总 | ||||
|     getEventSummary() { | ||||
|       this.instance.post(`/app/appintegraluser/eventSummary`, null, { | ||||
|         params: { | ||||
|           id: this.$route.query.id, | ||||
|           startTime: this.startTime, | ||||
|           endTime: this.endTime, | ||||
|         } | ||||
|       }).then(res => { | ||||
|         if (res?.data) { | ||||
|           this.xData = res.data.map(x => x.eventName) | ||||
|           this.yData = res.data.map(y => y.totalIntegral) | ||||
|           this.getColEcherts(this.xData, this.yData) | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     // 余额变动明细 | ||||
|     getIntegralChange() { | ||||
|       this.instance.post(`/app/appintegraluser/getChangeDetail`, null, { | ||||
|         params: { | ||||
|           ...this.search,  //积分类型 | ||||
|           total: this.total, | ||||
|           id: this.$route.query.id, | ||||
|         } | ||||
|       }).then(res => { | ||||
|         if (res?.data) { | ||||
|           this.tableData = res.data.records | ||||
|           this.total = res.data.total | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     timeChange() { | ||||
|       if (this.timeList.length) { | ||||
|         this.startTime = this.timeList[0] | ||||
|         this.endTime = this.timeList[1] | ||||
|         this.getEventSummary() | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     getColEcherts(xData, yData) { | ||||
|       let chartDom = document.getElementById('chartDom'); | ||||
|       chartDom.style.width = window.innerWidth - 335 + "px"; | ||||
|       this.myChart = echarts.init(chartDom); | ||||
|       this.myChart.setOption({ | ||||
|         dataZoom: [ | ||||
|           { | ||||
|             type: "slider", | ||||
|             xAxisIndex: [0], | ||||
|             filterMode: "filter", | ||||
|           }, | ||||
|         ], | ||||
|         grid: { | ||||
|           left: '16px', | ||||
|           right: '28px', | ||||
|           bottom: '14px', | ||||
|           top: '30px', | ||||
|           containLabel: true | ||||
|         }, | ||||
|         xAxis: { | ||||
|           type: 'category', | ||||
|           data: xData, | ||||
|         }, | ||||
|         yAxis: { | ||||
|           type: 'value', | ||||
|         }, | ||||
|         series: [ | ||||
|           { | ||||
|             data: yData, | ||||
|             type: 'bar', | ||||
|             itemStyle: { | ||||
|               normal: { | ||||
|                 color: "#5087ec", | ||||
|                 label: { | ||||
|                   show: true,  //开启显示 | ||||
|                   position: 'top',    //在上方显示 | ||||
|                   textStyle: { | ||||
|                     fontSize: 13, | ||||
|                     color: '#666' | ||||
|                   } | ||||
|                 }, | ||||
|               }, | ||||
|             }, | ||||
|             barWidth: 20, | ||||
|             barGap: '20%', | ||||
|           } | ||||
|         ] | ||||
|       }, true); | ||||
|       window.addEventListener("resize", this.onResize) | ||||
|     }, | ||||
|  | ||||
|     onResize() { | ||||
|       this.myChart.resize() | ||||
|     }, | ||||
|  | ||||
|     cancel(isRefresh) { | ||||
|       this.$emit('change', { | ||||
|         type: 'gridScoreManage', | ||||
|         isRefresh: !!isRefresh | ||||
|       }) | ||||
|     } | ||||
|  | ||||
|   }, | ||||
|  | ||||
|   filters: { | ||||
|     formatTime(num) { | ||||
|       if (num > 0) { | ||||
|         return '+' + num | ||||
|       } else { | ||||
|         return num | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|  | ||||
|   mounted() { | ||||
|     this.getColEcherts() | ||||
|   }, | ||||
|  | ||||
|   destroyed() { | ||||
|     window.removeEventListener('resize', this.onResize) | ||||
|   }, | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| .gridScoreDetail { | ||||
|   width: 100%; | ||||
|   height: 100%; | ||||
|   padding: 0 20px; | ||||
|   box-sizing: border-box; | ||||
|   overflow-y: scroll; | ||||
|  | ||||
|   .card_list { | ||||
|     display: flex; | ||||
|  | ||||
|     .card { | ||||
|       flex: 1; | ||||
|       height: 96px; | ||||
|       background: #FFFFFF; | ||||
|       box-shadow: 0px 4px 6px -2px rgba(15, 15, 21, 0.1500); | ||||
|       border-radius: 4px; | ||||
|       margin-right: 20px; | ||||
|       padding: 16px 24px; | ||||
|       box-sizing: border-box; | ||||
|  | ||||
|       h2 { | ||||
|         color: #888888; | ||||
|         font-weight: 600; | ||||
|         font-size: 16px; | ||||
|       } | ||||
|  | ||||
|       p { | ||||
|         margin-top: 8px; | ||||
|         font-size: 24px; | ||||
|         font-weight: 600; | ||||
|       } | ||||
|  | ||||
|       .color1 { | ||||
|         color: #2891FF; | ||||
|       } | ||||
|  | ||||
|       .color2 { | ||||
|         color: #22AA99; | ||||
|       } | ||||
|  | ||||
|       .color3 { | ||||
|         color: #F8B425; | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     .card:last-child { | ||||
|       margin-right: 0; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   .echertsBox { | ||||
|     width: 100%; | ||||
|     margin-top: 20px; | ||||
|     background: #FFFFFF; | ||||
|     box-shadow: 0px 4px 6px -2px rgba(15, 15, 21, 0.1500); | ||||
|     border-radius: 4px; | ||||
|     padding: 16px; | ||||
|     box-sizing: border-box; | ||||
|  | ||||
|     .title { | ||||
|       display: flex; | ||||
|       justify-content: space-between; | ||||
|  | ||||
|       h4 { | ||||
|         color: #222222; | ||||
|         font-weight: 600; | ||||
|       } | ||||
|  | ||||
|     } | ||||
|  | ||||
|     .bar_Box { | ||||
|       width: 100%; | ||||
|  | ||||
|       #chartDom { | ||||
|         width: 100%; | ||||
|         height: 230px; | ||||
|         margin-top: 16px; | ||||
|       } | ||||
|     } | ||||
|  | ||||
|   } | ||||
| } | ||||
| </style> | ||||
| @@ -0,0 +1,365 @@ | ||||
| <template> | ||||
|   <section class="gridScoreManage"> | ||||
|     <ai-list isTabs> | ||||
|       <template #content> | ||||
|         <ai-search-bar> | ||||
|           <template #left> | ||||
|             <el-button type="primary" size="small" icon="iconfont iconAdd" @click="changeIntegral('',0)"> 批量调整积分</el-button> | ||||
|             <el-cascader ref="cascader1" clearable v-model="girdIdList" :options="girdOptions" placeholder="所属网格" size="small" | ||||
|               :props="defaultProps" :show-all-levels="false" @change="gridChange"></el-cascader> | ||||
|           </template> | ||||
|           <template #right> | ||||
|             <ai-import :instance="instance" :dict="dict" type="appintegraluser" name="积分管理" | ||||
|                       @success="getTableData()"> | ||||
|               <el-button icon="iconfont iconImport">导入</el-button> | ||||
|             </ai-import> | ||||
|             <ai-download :instance="instance" url="/app/appintegraluser/girdIntegralExport" :params="search" :fileName="menuName" | ||||
|                          :disabled="tableData.length == 0"> | ||||
|             </ai-download> | ||||
|             <el-input size="small" placeholder="姓名" v-model="search.userName" clearable | ||||
|               @clear="current = 1, search.userName = '', getTableData()" suffix-icon="iconfont iconSearch" | ||||
|               v-throttle="() => {(current = 1), getTableData();}"/> | ||||
|           </template> | ||||
|         </ai-search-bar> | ||||
|         <ai-table :tableData="tableData" :total="total" :current.sync="current" :size.sync="size" | ||||
|                   @getList="getTableData()" :col-configs="colConfigs" :dict="dict" @sort-change="changeTableSort"> | ||||
|  | ||||
|  | ||||
|           <el-table-column slot="options" label="操作"  align="center"> | ||||
|             <template slot-scope="{ row }"> | ||||
|               <el-button type="text" @click="changeIntegral(row,1)">调整积分</el-button> | ||||
|               <el-button type="text" @click="toDetail(row.id)">详情</el-button> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|         </ai-table> | ||||
|       </template> | ||||
|     </ai-list> | ||||
|     <ai-dialog | ||||
|         title="调整积分" | ||||
|         :visible.sync="dialog" | ||||
|         :destroyOnClose="true" | ||||
|         width="720px" | ||||
|         @onConfirm="onConfirm" | ||||
|         @closed="form={},chooseUserList=[]"> | ||||
|       <el-form ref="form" :model="form" :rules="rules" label-width="80px"> | ||||
|         <el-form-item label="选择人员" prop="ids"> | ||||
|           <ai-person-select :instance="instance" :customClicker="true" :chooseUserList="chooseUserList" | ||||
|               url="/app/appgirdmemberinfo/list" headerTitle="网格员列表" | ||||
|               :isMultiple="true" dialogTitle="选择" @selectPerson="selectPerson" class="aipersonselect"> | ||||
|             <template name="option" v-slot:option="{ item }"> | ||||
|               <span class="iconfont iconProlife">{{ item.name }}</span> | ||||
|               <ai-id mode="show" :show-eyes="false" :value="item.idNumber"/> | ||||
|             </template> | ||||
|           </ai-person-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="调整说明" prop="eventDesc"> | ||||
|           <el-input v-model.trim="form.eventDesc" placeholder="请输入..." type="textarea" :rows="4" show-word-limit | ||||
|                     maxlength="100"></el-input> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="上传凭证"> | ||||
|           <ai-uploader :instance="instance" fileType="file" v-model="form.file" :limit="1"></ai-uploader> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="类型" prop="integralCalcType"> | ||||
|           <ai-select v-model="form.integralCalcType" :selectList="dict.getDict('integralCalcType')"/> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="积分" prop="integral"> | ||||
|           <el-input v-model.trim="form.integral" placeholder="请输入正数" size="small"></el-input> | ||||
|         </el-form-item> | ||||
|       </el-form> | ||||
|     </ai-dialog> | ||||
|   </section> | ||||
|  | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import { mapState } from "vuex"; | ||||
| export default { | ||||
|   name: "gridScoreManage", | ||||
|   label: "积分管理", | ||||
|   props: { | ||||
|     instance: Function, | ||||
|     dict: Object, | ||||
|     permissions: Function, | ||||
|     menuName:String | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       search: { | ||||
|         userName: '', | ||||
|         girdId: '', | ||||
|         current: 1, | ||||
|         size: 10, | ||||
|         sortFiled: '', | ||||
|         sortRule: '', | ||||
|       }, | ||||
|       girdIdList: [], | ||||
|       tableData: [], | ||||
|       size: 10, | ||||
|       total: 0, | ||||
|       current: 1, | ||||
|       girdList: [], | ||||
|       form: { | ||||
|         ids: [], | ||||
|         eventDesc: "", | ||||
|         enclosure: "",   // 附件 | ||||
|         integralCalcType: "", | ||||
|         integral: '', | ||||
|         file: [], | ||||
|       }, | ||||
|       personList: [], | ||||
|       dialog: false, | ||||
|       girdOptions: [], | ||||
|       defaultProps: { | ||||
|         label: 'girdName', | ||||
|         value: 'id', | ||||
|         checkStrictly: true, | ||||
|       }, | ||||
|       chooseUserList: [], | ||||
|       flag: false, | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|     this.$dict.load('integralCalcType') | ||||
|     this.getTableData() | ||||
|     this.getGridList() | ||||
|   }, | ||||
|   computed: { | ||||
|     ...mapState(['user']), | ||||
|     colConfigs() { | ||||
|       return [ | ||||
|         { prop: "userName", label: '姓名', align: "left",  }, | ||||
|         { prop: "girdName", label: '所属网格' }, | ||||
|         { prop: "integral", label: '积分余额', align: "center", sortable: "custom" }, | ||||
|         { prop: "totalIntegral", label: '累计积分', align: "center", sortable: "custom" }, | ||||
|         { prop: "usedIntegral", label: '已用积分', align: "center", sortable: "custom"  }, | ||||
|         { slot: "options" }, | ||||
|       ] | ||||
|     }, | ||||
|     rules() { | ||||
|       return { | ||||
|         ids: [{required: true, message: '请选择人员', trigger: 'blur'}], | ||||
|         eventDesc: [{required: true, message: '请输入调整说明', trigger: 'blur'}], | ||||
|         integralCalcType: [{required: true, message: '请选择类型', trigger: 'change'}], | ||||
|         integral: [{required: true, message: '请输入积分', trigger: 'blur' }, | ||||
|         {pattern: /^([1-9]\d*|0)(\.\d{1,2})?$/, message: '请输入正数且最多只能保留两位小数'}], | ||||
|       } | ||||
|     }, | ||||
|   }, | ||||
|   methods: { | ||||
|     getTableData() { | ||||
|       this.instance.post(`/app/appintegraluser/integralManager`,null,{ | ||||
|         params: { | ||||
|           ...this.search, | ||||
|           current: this.current, | ||||
|           size: this.size, | ||||
|           total: this.total | ||||
|         } | ||||
|       }).then(res => { | ||||
|         if(res?.data) { | ||||
|           this.tableData = res.data.records | ||||
|           this.total = res.data.total | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     selectPerson(val) { | ||||
|       if (val) { | ||||
|         this.personList = val | ||||
|         this.form.ids = [...this.personList.map(e => e.id)] | ||||
|       } else { | ||||
|         this.form.ids = this.chooseUserList.map(e => e.id) | ||||
|       } | ||||
|     }, | ||||
|     changeIntegral(row,type) { | ||||
|       if(type==0) { | ||||
|         this.dialog = true | ||||
|       } else if(type ==1) { | ||||
|         this.chooseUserList = [{ | ||||
|           id: row.userId, | ||||
|           name: row.userName | ||||
|         }] | ||||
|         this.form.ids = this.chooseUserList.map(e => e.id) | ||||
|         this.dialog = true | ||||
|       } | ||||
|     }, | ||||
|     getGridList() { | ||||
|       this.instance.post(`/app/appgirdinfo/listAll3`).then((res) => { | ||||
|         if (res.code == 0) { | ||||
|           this.girdOptions = this.toTree(res.data) | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     // 转树形结构 | ||||
|     toTree(data) { | ||||
|       let result = []; | ||||
|       if (!Array.isArray(data)) { | ||||
|         return result | ||||
|       } | ||||
|       let map = {}; | ||||
|       data.forEach(item => { | ||||
|         map[item.id] = item; | ||||
|       }); | ||||
|       data.forEach(item => { | ||||
|         let parent = map[item.parentGirdId]; | ||||
|         if (parent) { | ||||
|           (parent.children || (parent.children = [])).push(item); | ||||
|         } else { | ||||
|           result.push(item); | ||||
|         } | ||||
|       }); | ||||
|       return result; | ||||
|     }, | ||||
|  | ||||
|     gridChange(val) { | ||||
|       this.girdIdList = val | ||||
|       this.search.girdId = val?.[val.length - 1] | ||||
|       this.$refs.cascader1.dropDownVisible = false; | ||||
|       this.getTableData() | ||||
|     }, | ||||
|  | ||||
|     changeTableSort(col) { | ||||
|       if(col.prop === 'integral') { // 剩余积分 | ||||
|         this.search.sortFiled = 0 | ||||
|         if(col.order === 'ascending') { | ||||
|           this.search.sortRule = true | ||||
|         } else if(col.order === 'descending') { | ||||
|           this.search.sortRule = false | ||||
|         } else if(col.order === null) { | ||||
|           this.search.sortRule = '' | ||||
|         } | ||||
|       } else if(col.prop === 'totalIntegral') {  // 累计积分 | ||||
|         this.search.sortFiled = 1 | ||||
|         if(col.order === 'ascending') { | ||||
|           this.search.sortRule = true | ||||
|         } else if(col.order === 'descending') { | ||||
|           this.search.sortRule = false | ||||
|         } else if(col.order === null) { | ||||
|           this.search.sortRule = '' | ||||
|         } | ||||
|       } else if(col.prop === 'usedIntegral') {  // 已用积分 | ||||
|         this.search.sortFiled = 2 | ||||
|         if(col.order === 'ascending') { | ||||
|           this.search.sortRule = true | ||||
|         } else if(col.order === 'descending') { | ||||
|           this.search.sortRule = false | ||||
|         } else if(col.order === null) { | ||||
|           this.search.sortRule = '' | ||||
|         } | ||||
|       } | ||||
|       this.getTableData() | ||||
|     }, | ||||
|  | ||||
|     onConfirm() { | ||||
|       if(this.flag) return | ||||
|  | ||||
|       if(this.form.file?.length) { | ||||
|         this.form.enclosure = this.form.file[0].url | ||||
|       } | ||||
|       this.$refs.form.validate((valid)=> { | ||||
|         if(valid) { | ||||
|           this.flag = true | ||||
|           this.instance.post(`/app/appintegraluser/changeIntegral`,{ | ||||
|             ids: this.form.ids, | ||||
|             eventDesc: this.form.eventDesc, | ||||
|             enclosure: this.form.enclosure,   // 附件 | ||||
|             integralCalcType: this.form.integralCalcType, | ||||
|             integral: this.form.integral, | ||||
|           }).then(res => { | ||||
|             if(res?.code == 0) { | ||||
|               this.$message.success('调整积分成功') | ||||
|               setTimeout(() =>{ | ||||
|                 this.dialog = false | ||||
|                 this.getTableData() | ||||
|                 this.flag = false | ||||
|               }, 600) | ||||
|             } else { | ||||
|               this.flag = false | ||||
|             } | ||||
|           }) | ||||
|         } | ||||
|       }) | ||||
|  | ||||
|     }, | ||||
|  | ||||
|     toDetail(id) { | ||||
|       this.$emit('change', { | ||||
|         type: 'gridScoreDetail', | ||||
|         params: { | ||||
|           id: id | ||||
|         } | ||||
|       }) | ||||
|     } | ||||
|   }, | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| .gridScoreManage { | ||||
|   height: 100%; | ||||
|  | ||||
|   :deep( .ai-dialog .ai-dialog__content ){ | ||||
|     max-height: 600px!important; | ||||
|   } | ||||
|  | ||||
|  | ||||
|  | ||||
|   .userlist { | ||||
|     display: inline-block; | ||||
|   } | ||||
|  | ||||
|   .userlist, .user { | ||||
|     display: inline-block; | ||||
|   } | ||||
|  | ||||
|   .user { | ||||
|     position: relative; | ||||
|     width: 70px; | ||||
|     text-align: center; | ||||
|  | ||||
|     .remove-icon { | ||||
|       position: absolute; | ||||
|       right: 7px; | ||||
|       top: -4px; | ||||
|       line-height: 1; | ||||
|       padding: 6px 0; | ||||
|       font-size: 16px; | ||||
|       cursor: pointer; | ||||
|  | ||||
|       &:hover { | ||||
|         color: crimson; | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     img, h2 { | ||||
|       display: block; | ||||
|       width: 40px; | ||||
|       height: 40px; | ||||
|       line-height: 40px; | ||||
|       text-align: center; | ||||
|       margin: 0 auto 4px; | ||||
|       font-size: 14px; | ||||
|       color: #fff; | ||||
|       border-radius: 50%; | ||||
|     } | ||||
|  | ||||
|     h2 { | ||||
|       background-color: $primaryColor; | ||||
|     } | ||||
|  | ||||
|     span { | ||||
|       color: #666; | ||||
|       font-size: 14px; | ||||
|       white-space: nowrap; | ||||
|       overflow: hidden; | ||||
|       word-break: break-all; | ||||
|       text-overflow: ellipsis; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   :deep( .selectCont .pagination ){ | ||||
|     width: 100%!important; | ||||
|     background: pink; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
| @@ -0,0 +1,492 @@ | ||||
| <template> | ||||
|   <section class="gridScoreRules"> | ||||
|     <!--  v-if="permissions('app_appvillagerintegralrule_detail')" --> | ||||
|     <ai-list isTabs> | ||||
|       <template slot="content"> | ||||
|         <ai-search-bar> | ||||
|           <template #left> | ||||
|             <el-button type="primary" icon="iconfont iconAdd" @click="dialog = true"> 添加</el-button> | ||||
|             <el-cascader size="small" v-model="systemRuleIdList" :options="rulesOps" placeholder="请选择事件/类型" clearable :props="rulesProps" | ||||
|                          @change="handleTypeSearch" ref="eventTypeSearch"/> | ||||
|             <ai-select v-model="search.status" @change="(page.current = 1), getList()" placeholder="请选择状态" :selectList="$dict.getDict('integralRuleStatus')"> | ||||
|             </ai-select> | ||||
|           </template> | ||||
|         </ai-search-bar> | ||||
|         <ai-table :tableData="tableData" :col-configs="colConfigs" :total="page.total" :dict="dict" :current.sync="page.current" :size.sync="page.size" | ||||
|                   @getList="getList()"> | ||||
|           <el-table-column slot="integral" label="分值" align="center"> | ||||
|             <template slot-scope="{ row }"> | ||||
|               <!-- <span v-if="row.integralValueType == 1"> | ||||
|                 {{ row.integralStart > 0 ? "+" + row.integralStart : row.integralStart }}~{{ row.integralEnd > 0 ? "+" + row.integralEnd : row.integralEnd }} | ||||
|               </span> --> | ||||
|               <span>{{ row.integral > 0 ? "+" : "" }}{{ row.integral }}</span> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|           <el-table-column slot="options" label="操作" align="center" fixed="right" width="200"> | ||||
|             <template slot-scope="{ row }"> | ||||
|               <div class="table-options"> | ||||
|                 <el-button type="text" @click="changeStatus(row.id, 0)" v-if="row.status == 1">停用</el-button> | ||||
|                 <el-button type="text" @click="changeStatus(row.id, 1)" v-else>启用</el-button> | ||||
|                 <el-button type="text" @click="toEdit(row)">编辑</el-button> | ||||
|                 <el-button type="text" @click="remove(row.id)">删除</el-button> | ||||
|               </div> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|         </ai-table> | ||||
|       </template> | ||||
|     </ai-list> | ||||
|     <!-- <ai-empty v-else>暂无应用权限</ai-empty> --> | ||||
|     <ai-dialog :title="dialogTitle" :visible.sync="dialog" @onConfirm="onConfirm" @closed="closed" width="900px" @open="beforeSelectTree"> | ||||
|       <div class="form_div"> | ||||
|         <el-form ref="DialogForm" :model="form" :rules="formRules" size="small" label-suffix=":" label-width="150px"> | ||||
|           <el-form-item label="事件类型" prop="systemRuleId"> | ||||
|             <el-cascader v-model="form.systemRuleId" ref="cascaderArr" :props="etOps" clearable placeholder="请选择" @change="handleTypeForm" :options="rulesOps"/> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="自定义事件" v-if="form.systemRuleId == '自定义'" prop="ruleName"> | ||||
|             <el-input placeholder="请输入,周期范围内,不填写表示不限制" v-model="form.ruleName" clearable maxlength="10" show-word-limit/> | ||||
|           </el-form-item> | ||||
|  | ||||
|           <el-form-item label="规则"> | ||||
|             <div>常规</div> | ||||
|           </el-form-item> | ||||
|  | ||||
|           <!-- <el-form-item label="规则" prop="ruleType" v-if="form.ruleType>-1" required> | ||||
|             <el-row type="flex" justify="space-between"> | ||||
|               <div v-text="$dict.getLabel('integralRuleRuleType',form.ruleType)"/> | ||||
|               <el-button v-if="form.ruleType==1" type="text" icon="iconfont iconAdd" | ||||
|                          @click="form.ladderRule.push({viewCount:null,integral:null})">添加 | ||||
|               </el-button> | ||||
|             </el-row> | ||||
|             <el-table v-if="form.ruleType==1" :data="form.ladderRule" size="mini" border stripe> | ||||
|               <el-table-column label="查看人数(人)" align="center"> | ||||
|                 <template slot-scope="{row}"> | ||||
|                   <el-input class="tableInput" v-model.number="row.viewCount" clearable placeholder="请输入"/> | ||||
|                 </template> | ||||
|               </el-table-column> | ||||
|               <el-table-column label="获得积分(分)" align="center"> | ||||
|                 <template slot-scope="{row}"> | ||||
|                   <el-input class="tableInput" v-model="row.integral" clearable placeholder="请输入" type="number" | ||||
|                             @keyup.native="row.integral=checkIntegral(row.integral)"/> | ||||
|                 </template> | ||||
|               </el-table-column> | ||||
|               <el-table-column label="操作" align="center"> | ||||
|                 <template slot-scope="{$index}"> | ||||
|                   <el-button type="text" @click="handleDelete($index)">删除</el-button> | ||||
|                 </template> | ||||
|               </el-table-column> | ||||
|             </el-table> | ||||
|           </el-form-item> --> | ||||
|  | ||||
|           <el-form-item label="周期范围" prop="scoringCycle"> | ||||
|             <ai-select v-model="form.scoringCycle" :selectList="$dict.getDict('integralRuleScoringCycle')" :disabled="isOneAndTen"/> | ||||
|           </el-form-item> | ||||
|  | ||||
|           <el-form-item label="奖励次数"> | ||||
|             <el-input type="number" placeholder="请输入,周期范围内,不填写表示不限制" v-model.number="form.numberLimit" clearable :disabled="isOneAndTen"/> | ||||
|           </el-form-item> | ||||
|  | ||||
|           <el-form-item label="积分分值" prop="integral"> | ||||
|             <el-input placeholder="请输入" v-model="form.integral" clearable/> | ||||
|           </el-form-item> | ||||
|  | ||||
|           <el-form-item label="有效范围" prop="validRangeType" required> | ||||
|             <el-radio-group v-model="form.validRangeType"> | ||||
|               <el-radio label="0">全局</el-radio> | ||||
|               <el-radio label="1">指定网格</el-radio> | ||||
|             </el-radio-group> | ||||
|           </el-form-item> | ||||
|  | ||||
|           <el-form-item label="生效网格" :prop="form.validRangeType == 1 ? 'validRangeData' : ''" | ||||
|                         :rules="[{ required: true, message: '请选择生效网格', trigger: 'change' }, ]" v-if="form.validRangeType == 1"> | ||||
|             <ai-dialog-btn dialogTitle="选择网格" append-to-body @onConfirm="getCheckedTree" :customFooter="false" :text="girdInfoList.length ? '重新选择' : '请选择'"> | ||||
|               <div class="grid"> | ||||
|                 <el-tree :data="treeObj.treeList" :props="treeObj.defaultProps" node-key="id" :expand-on-click-node="false"> | ||||
|                   <template slot-scope="{data}"> | ||||
|                     <el-row class="fill" type="flex" @click.native.stop="handleTreeChecked(data)"> | ||||
|                       <div class="fill" v-text="data.girdName"/> | ||||
|                       <div class="iconfont iconSuccess color-primary mar-r8" v-if="data.checked"/> | ||||
|                     </el-row> | ||||
|                   </template> | ||||
|                 </el-tree> | ||||
|               </div> | ||||
|             </ai-dialog-btn> | ||||
|  | ||||
|             <div v-if="girdInfoList.length"> | ||||
|               <span v-for="(e,index) in girdNameList" :key="index" class="mar-r8" v-text="e"/> | ||||
|             </div> | ||||
|           </el-form-item> | ||||
|         </el-form> | ||||
|       </div> | ||||
|     </ai-dialog> | ||||
|   </section> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| export default { | ||||
|   name: "gridScoreRules", | ||||
|   label: "积分规则", | ||||
|   props: { | ||||
|     instance: Function, | ||||
|     dict: Object, | ||||
|     permissions: Function, | ||||
|   }, | ||||
|   data() { | ||||
|     var validcode = (rule, value, callback) => { | ||||
|       if (value) { | ||||
|         if (value != 0) { | ||||
|           if (!/^([+-]?([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/.test(value)) { | ||||
|             callback(new Error('请输入积分分值,可输入正数、负数、最多保留两位小数')) | ||||
|           } else { | ||||
|             callback(); | ||||
|           } | ||||
|         } else { | ||||
|           callback(new Error('请输入有效的积分分值')); | ||||
|         } | ||||
|       } else { | ||||
|         callback(new Error('请输入积分分值')); | ||||
|       } | ||||
|     } | ||||
|     return { | ||||
|       search: { | ||||
|         status: "", | ||||
|         systemRuleId: "", | ||||
|         ruleName: "" | ||||
|       }, | ||||
|       systemRuleIdList: [], | ||||
|       page: {current: 1, size: 10, total: 0}, | ||||
|       colConfigs: [ | ||||
|         { | ||||
|           prop: "parentRuleName", | ||||
|           label: "类型", | ||||
|           dict: "integralRuleEventType", | ||||
|         }, | ||||
|         {prop: "ruleName", label: "事件", dict: "integralRuleEvent"}, | ||||
|         {prop: "ruleType", label: "规则", dict: "integralRuleRuleType"}, | ||||
|         { | ||||
|           prop: "scoringCycle", | ||||
|           label: "周期范围", | ||||
|           dict: "integralRuleScoringCycle", | ||||
|           render: (h, {row}) => { | ||||
|             return h( | ||||
|                 "span", | ||||
|                 {}, | ||||
|                 row.numberLimit.length | ||||
|                     ? $dict.getLabel("integralRuleScoringCycle", row.scoringCycle) | ||||
|                     : $dict.getLabel("integralRuleScoringCycle", row.scoringCycle) + | ||||
|                     row.numberLimit + | ||||
|                     "次" | ||||
|             ); | ||||
|           }, | ||||
|         }, | ||||
|         {slot: "integral", label: "积分分值", align: "center"}, | ||||
|         { | ||||
|           prop: "validRangeType", | ||||
|           label: "有效范围", | ||||
|           format: (v) => (v == 0 ? "全局" : "指定网格"), | ||||
|         }, | ||||
|         { | ||||
|           prop: "status", | ||||
|           label: "状态", | ||||
|           align: "center", | ||||
|           width: 96, | ||||
|           dict: "integralRuleStatus", | ||||
|         }, | ||||
|         {slot: "options", label: "操作", align: "center"}, | ||||
|       ], | ||||
|       tableData: [], | ||||
|       dialog: false, | ||||
|       form: { | ||||
|         ruleType: "0", | ||||
|         systemRuleId: "", | ||||
|         ruleName: "", | ||||
|         scoringCycle: "", | ||||
|         numberLimit: "", | ||||
|         integral: "", | ||||
|         validRangeType: "0", | ||||
|         validRangeData: "", | ||||
|       }, | ||||
|       formRules: { | ||||
|         systemRuleId: [ | ||||
|           {required: true, message: "请选择事件/类型", trigger: "change"}, | ||||
|         ], | ||||
|         ruleName: [ | ||||
|           {required: true, message: "请输入自定义事件", trigger: "change"}, | ||||
|         ], | ||||
|         scoringCycle: [ | ||||
|           {required: true, message: "请选择周期范围", trigger: "change"}, | ||||
|         ], | ||||
|         integral: [{required: true, validator: validcode, trigger: "blur"},], | ||||
|         validRangeType: [ | ||||
|           {required: true, message: "请选择有效范围", trigger: "change"}, | ||||
|         ], | ||||
|       }, | ||||
|       rulesOps: [], | ||||
|       rulesProps: { | ||||
|         label: "ruleName", | ||||
|         value: "id", | ||||
|         checkStrictly: true, | ||||
|       }, | ||||
|       radio: 0, | ||||
|       treeObj: { | ||||
|         treeList: [], | ||||
|         defaultProps: { | ||||
|           label: "girdName", | ||||
|           value: "id", | ||||
|           children: 'children', | ||||
|           isLeaf: 'leaf' | ||||
|         }, | ||||
|       }, | ||||
|       treeSelected: {}, | ||||
|       girdInfoList: [], | ||||
|       rulueType: "0", | ||||
|       girdNameList: [], | ||||
|       list: [], | ||||
|       isOneAndTen: false, | ||||
|     }; | ||||
|   }, | ||||
|   created() { | ||||
|     this.$dict.load("integralRuleStatus", "integralRuleRuleType", "integralRuleScoringCycle", | ||||
|         "integralRuleEvent", "integralRuleEventType").then(() => { | ||||
|       this.getList(); | ||||
|       this.getRulesList(); | ||||
|     }); | ||||
|   }, | ||||
|   methods: { | ||||
|     getList() { | ||||
|       this.instance | ||||
|       .post(`/app/appintegralrule/list`, null, { | ||||
|         params: { | ||||
|           ...this.search, | ||||
|           ...this.page, | ||||
|         }, | ||||
|       }) | ||||
|       .then((res) => { | ||||
|         if (res?.data) { | ||||
|           this.tableData = res.data.records; | ||||
|           this.page.total = res.data.total; | ||||
|         } | ||||
|       }); | ||||
|     }, | ||||
|     closed() { | ||||
|       this.form = { | ||||
|         ruleType: "0", | ||||
|         systemRuleId: "", | ||||
|         ruleName: "", | ||||
|         scoringCycle: "", | ||||
|         numberLimit: "", | ||||
|         integral: "", | ||||
|         validRangeType: "0", | ||||
|         validRangeData: "", | ||||
|       }; | ||||
|       this.girdInfoList = [] | ||||
|       this.treeSelected = {} | ||||
|     }, | ||||
|     toEdit(row) { | ||||
|       this.form = {...row} | ||||
|       if (this.form?.validRangeData) { | ||||
|         this.girdInfoList = JSON.parse(this.form.validRangeData) | ||||
|         this.girdNameList = this.girdInfoList.map(e => e.girdName) | ||||
|       } | ||||
|       this.$nextTick(() => { | ||||
|         this.dialog = true; | ||||
|       }); | ||||
|     }, | ||||
|     remove(id) { | ||||
|       this.$confirm("删除后不可恢复,是否要删除该规则?", { | ||||
|         type: "error", | ||||
|       }).then(() => { | ||||
|         this.instance | ||||
|         .post(`/app/appintegralrule/delete?ids=${id}`) | ||||
|         .then((res) => { | ||||
|           if (res.code == 0) { | ||||
|             this.$message.success("删除成功!"); | ||||
|             this.getList(); | ||||
|           } | ||||
|         }); | ||||
|       }); | ||||
|     }, | ||||
|     changeStatus(id, status) { | ||||
|       let text = status == 1 ? "启用" : "停用"; | ||||
|       this.$confirm(`确定${text}该条规则?`).then(() => { | ||||
|         this.instance | ||||
|         .post(`/app/appintegralrule/enableStatus?id=${id}`) | ||||
|         .then((res) => { | ||||
|           if (res.code == 0) { | ||||
|             this.$message.success(`${text}成功!`); | ||||
|             this.getList(); | ||||
|           } | ||||
|         }); | ||||
|       }); | ||||
|     }, | ||||
|     onConfirm() { | ||||
|       this.$refs.DialogForm.validate((valid) => { | ||||
|         if (valid) { | ||||
|           let formData = this.$copy(this.form); | ||||
|           // formData.ladderRule = JSON.stringify(formData.ladderRule) | ||||
|           formData.integral = formData.integral || 0; | ||||
|           this.instance | ||||
|           .post(`/app/appintegralrule/addOrUpdate`, formData) | ||||
|           .then((res) => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success( | ||||
|                   `${this.isEdit ? "编辑成功" : "添加成功"}` | ||||
|               ); | ||||
|               this.dialog = false; | ||||
|               this.getList(); | ||||
|               this.closed(); | ||||
|               this.girdInfoList = [] | ||||
|               this.girdNameList = [] | ||||
|             } | ||||
|           }); | ||||
|         } else { | ||||
|           return false; | ||||
|         } | ||||
|       }); | ||||
|     }, | ||||
|     handleTypeSearch(v) { | ||||
|       this.systemRuleIdList = v | ||||
|       this.search.systemRuleId = v?.[v.length - 1]; | ||||
|       this.search.ruleName = this.$refs.eventTypeSearch.getCheckedNodes()[0]?.label | ||||
|       this.page.current = 1; | ||||
|       this.$refs.eventTypeSearch.dropDownVisible = false; | ||||
|       this.getList(); | ||||
|     }, | ||||
|     handleTypeForm(v) { | ||||
|       if (this.dialog) { | ||||
|         if(v[0] == '1' || v[0]== '10') { | ||||
|           this.form.scoringCycle = '0' | ||||
|           this.form.numberLimit = '1' | ||||
|           this.isOneAndTen = true | ||||
|         } else { | ||||
|           this.form.scoringCycle = '' | ||||
|           this.form.numberLimit = '' | ||||
|           this.isOneAndTen = false | ||||
|         } | ||||
|         this.form.systemRuleId = v?.[v.length - 1]; | ||||
|       } | ||||
|     }, | ||||
|     handleDelete(i) { | ||||
|       this.$confirm("是否要删除该规则?") | ||||
|       .then(() => { | ||||
|         this.form.ladderRule.splice(i, 1); | ||||
|       }) | ||||
|       .catch(() => 0); | ||||
|     }, | ||||
|     checkIntegral(v) { | ||||
|       return /\.\d{2,}$/.test(v) ? Math.abs(v).toFixed(1) : Math.abs(v); | ||||
|     }, | ||||
|     getRulesList() { | ||||
|       this.instance | ||||
|       .post(`/app/appintegralsystemrule/list?current=1&size=3000`) | ||||
|       .then((res) => { | ||||
|         if (res?.data) { | ||||
|           this.rulesOps = this.toTree(res.data.records); | ||||
|           this.rulesOps.push({ | ||||
|             ruleName: "自定义", | ||||
|             id: "自定义", | ||||
|           }); | ||||
|         } | ||||
|       }); | ||||
|     }, | ||||
|     // 转树形结构 | ||||
|     toTree(data) { | ||||
|       let result = []; | ||||
|       if (!Array.isArray(data)) { | ||||
|         return result; | ||||
|       } | ||||
|       let map = {}; | ||||
|       data.forEach((item) => { | ||||
|         map[item.id] = item; | ||||
|       }); | ||||
|       data.forEach((item) => { | ||||
|         let parent = map[item.parentRuleId]; | ||||
|         if (parent) { | ||||
|           (parent.children || (parent.children = [])).push(item); | ||||
|         } else { | ||||
|           result.push(item); | ||||
|         } | ||||
|       }); | ||||
|       return result; | ||||
|     }, | ||||
|     getCheckedTree() { | ||||
|       const selected = Object.values(this.treeSelected) | ||||
|       if (!selected.length) { | ||||
|         return this.$message.error("请选择网格"); | ||||
|       } | ||||
|  | ||||
|       this.girdInfoList = selected.map((item) => { | ||||
|         return {...item, checkType: true}; | ||||
|       }); | ||||
|       let validRangeData = selected.map((e) => ({id: e.id, girdName: e.girdName})) | ||||
|       this.girdNameList = validRangeData.map(e => e.girdName) | ||||
|       this.form.validRangeData = JSON.stringify(validRangeData) | ||||
|     }, | ||||
|     beforeSelectTree() { | ||||
|       this.instance.post(`/app/appgirdinfo/listAll3`, null, null).then((res) => { | ||||
|         if (res?.data) { | ||||
|           this.list = res.data.map(e => ({...e, checked: !!this.girdInfoList.find(s => s.id == e.id)})) | ||||
|           this.girdInfoList.map(e => this.treeSelected[e.id] = e) | ||||
|           this.treeObj.treeList = this.$arr2tree(this.list, {parent: 'parentGirdId'}) | ||||
|         } | ||||
|       }); | ||||
|     }, | ||||
|     handleTreeChecked(data) { | ||||
|       this.list.forEach(v => { | ||||
|         return { | ||||
|           ...v, | ||||
|           checked: false | ||||
|         } | ||||
|       }) | ||||
|       data.checked = !data.checked | ||||
|       if (data.checked) { | ||||
|         this.treeSelected[data.id] = data | ||||
|       } else { | ||||
|         delete this.treeSelected[data.id] | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   computed: { | ||||
|     isEdit() { | ||||
|       return !!this.form.id; | ||||
|     }, | ||||
|     dialogTitle() { | ||||
|       return this.isEdit ? "编辑积分规则" : "添加积分规则"; | ||||
|     }, | ||||
|     etOps() { | ||||
|       return { | ||||
|         value: "id", | ||||
|         label: "ruleName", | ||||
|       }; | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| .gridScoreRules { | ||||
|   height: 100%; | ||||
|   background: #f3f6f9; | ||||
|  | ||||
|   :deep( .ai-list__content--right ){ | ||||
|     width: 100%; | ||||
|   } | ||||
|  | ||||
|   // :deep( .searchRightZone ){ | ||||
|   //   display: flex; | ||||
|   // } | ||||
|  | ||||
|   :deep( .ai-dialog ){ | ||||
|     .el-cascader { | ||||
|       width: 100%; | ||||
|     } | ||||
|  | ||||
|     .tableInput { | ||||
|       & > input { | ||||
|         text-align: center; | ||||
|         border: none; | ||||
|         background: transparent; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </style> | ||||
| @@ -0,0 +1,660 @@ | ||||
| <template> | ||||
|   <section class="gridScoreStatistics"> | ||||
|     <el-row class="overallStatistics"> | ||||
|       <div class="title"> | ||||
|         <p>总体统计</p> | ||||
|         <div class="title_right"> | ||||
|           <div> | ||||
|             <span v-for="(item,index) in timeCheck" :key="index" :class="type == index? 'active':''" | ||||
|              @click="timeChange(index)">{{ item }}</span> | ||||
|           </div> | ||||
|             <el-cascader ref="cascader1" v-model="girdArr" :options="girdOptions" placeholder="所属网格" size="small" | ||||
|               :props="defaultProps" :show-all-levels="false" @change="gridChange" clearable></el-cascader> | ||||
|         </div> | ||||
|       </div> | ||||
|       <div class="card_list"> | ||||
|         <div class="card"> | ||||
|           <h2>积分余额汇总 | ||||
|             <el-tooltip | ||||
|               placement="right" | ||||
|               style="width: 16px;" | ||||
|               content="截止目前所有网格员剩余可用积分余额的总和"> | ||||
|               <i class="el-icon-warning-outline"></i> | ||||
|             </el-tooltip> | ||||
|           </h2> | ||||
|           <p class="color1">{{ data.nowIntegral || 0 }}</p> | ||||
|         </div> | ||||
|         <div class="card"> | ||||
|           <h2>发放积分</h2> | ||||
|           <p class="color1">{{ data.addIntegral || 0 }}</p> | ||||
|         </div> | ||||
|         <div class="card"> | ||||
|           <h2>消耗积分</h2> | ||||
|           <p class="color1">{{ Math.abs(data.reduceIntegral) || 0 }}</p> | ||||
|         </div> | ||||
|       </div> | ||||
|       <div class="echertsBox"> | ||||
|         <div class="left_Box"> | ||||
|           <p>个人积分排行</p> | ||||
|           <div> | ||||
|             <div id="chart1" style="height: 300px; width: 100%;" v-show="userSortListX.length && userSortListY.length"></div> | ||||
|             <ai-empty v-show="!userSortListX.length && !userSortListY.length" style="height: 200px; width: 100%;" id="empty"></ai-empty> | ||||
|           </div> | ||||
|         </div> | ||||
|         <div class="right_Box"> | ||||
|           <p>网格积分排行</p> | ||||
|           <div> | ||||
|             <div id="chart2" style="height: 300px; width: 100%;" v-show="girdSortListX.length && girdSortListY.length"></div> | ||||
|             <ai-empty v-show="!girdSortListX.length && !girdSortListY.length" style="height: 200px; width: 100%;" id="empty"></ai-empty> | ||||
|           </div> | ||||
|         </div> | ||||
|       </div> | ||||
|     </el-row> | ||||
|  | ||||
|     <ai-card> | ||||
|       <ai-title slot="title" title="积分明细"/> | ||||
|       <template #content> | ||||
|         <ai-search-bar> | ||||
|           <template #left> | ||||
|             <el-cascader ref="cascader2" v-model="girdIdArr" :options="girdOptions" placeholder="所属网格" size="small" | ||||
|               :props="defaultProps" :show-all-levels="false" clearable @change="gridChangeOpt"></el-cascader> | ||||
|             <ai-select v-model="search.integralType" placeholder="请选择类型" @change="current=1, getTableData()" | ||||
|             :selectList="dict.getDict('integralType')"/> | ||||
|             <el-date-picker v-model="time" size="small" type="daterange" value-format="yyyy-MM-dd" | ||||
|               range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" @change="onChange"> | ||||
|             </el-date-picker> | ||||
|           </template> | ||||
|           <template #right> | ||||
|             <el-input size="small" placeholder="请输入姓名" v-model="search.userName" clearable | ||||
|               @clear="current = 1, search.userName = '', getTableData()" suffix-icon="iconfont iconSearch" | ||||
|               v-throttle="() => {(current = 1), getTableData();}" /> | ||||
|           </template> | ||||
|         </ai-search-bar> | ||||
|         <ai-table :tableData="tableData" :total="total" :current.sync="current" :size.sync="size" | ||||
|                   @getList="getTableData" :col-configs="colConfigs" :dict="dict"> | ||||
|           <el-table-column slot="eventDesc" label='事件' align="center" width="400px" show-overflow-tooltip> | ||||
|             <template slot-scope="{ row }"> | ||||
|               <span>{{ row.integralRuleName || row.eventDesc}}</span> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|           <el-table-column slot="integralType" label="类型" align="center"> | ||||
|             <template slot-scope="{ row }"> | ||||
|               <span v-if="row.integralType == 0">积分调整</span> | ||||
|               <span v-if="row.integralType == 1">积分消费</span> | ||||
|               <span v-if="row.integralType == 2">积分申请</span> | ||||
|               <span v-if="row.integralType == 3">{{ row.eventType }}</span> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|           <el-table-column slot="changeIntegral" label="积分变动" align="center"> | ||||
|             <template slot-scope="{ row }"> | ||||
|               <span v-if="row.integralType == 0">{{ row.integralCalcType == 0 ? '-' : '+' }}{{ row.changeIntegral }}</span> | ||||
|               <span v-if="row.integralType == 1">-{{ row.changeIntegral }}</span> | ||||
|               <span v-if="row.integralType == 2">+{{ row.changeIntegral }}</span> | ||||
|               <span v-if="row.integralType == 3">{{ row.changeIntegral | formatTime }}</span> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|           <el-table-column slot="options" label="操作"  align="center"> | ||||
|             <template slot-scope="{ row }"> | ||||
|               <el-button type="text" @click="open(row.id)">详情</el-button> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|         </ai-table> | ||||
|       </template> | ||||
|     </ai-card> | ||||
|  | ||||
|     <el-dialog title="详情" :visible.sync="dialog" customFooter width="700"> | ||||
|       <ai-detail> | ||||
|         <template #content> | ||||
|           <ai-wrapper> | ||||
|             <ai-info-item label="姓名" :value="details.integralUserName" /> | ||||
|             <ai-info-item label="所属网格" :value="details.girdName"/> | ||||
|             <ai-info-item label="事件" isLine :value="details.eventDesc"> | ||||
|               <span v-if="details.integralRuleId">{{ details.integralRuleName }}</span> | ||||
|               <span v-else>{{ details.eventDesc }}</span> | ||||
|             </ai-info-item> | ||||
|             <ai-info-item label="时间" isLine :value="details.createTime"/> | ||||
|             <ai-info-item label="积分变动" v-if="details.integralType == 3"> | ||||
|               {{ details.changeIntegral | formatTime }} | ||||
|             </ai-info-item> | ||||
|             <ai-info-item label="积分变动" v-if="details.integralType == 0"> | ||||
|               {{ details.changeIntegral > 0 ? '+' : '-' }}{{ details.changeIntegral }} | ||||
|             </ai-info-item> | ||||
|             <ai-info-item label="积分余额" :value="details.nowIntegral"/> | ||||
|             <ai-info-item label="凭证" isLine v-if="fileDownLoad.length"> | ||||
|               <ai-file-list :fileList="fileDownLoad" style="width: 200px;" :fileOps="{name: 'name'}"></ai-file-list> | ||||
|             </ai-info-item> | ||||
|           </ai-wrapper> | ||||
|         </template> | ||||
|       </ai-detail> | ||||
|       <span slot="footer" class="dialog-footer" center> | ||||
|         <el-button @click="dialog = false" style="width: 92px">关闭</el-button> | ||||
|       </span> | ||||
|     </el-dialog> | ||||
|  | ||||
|     <ai-dialog :visible.sync="dialogDate" title="选择时间" width="500px" customFooter> | ||||
|       <el-date-picker v-model="timeList" size="small" type="daterange" value-format="yyyy-MM-dd" | ||||
|         range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"> | ||||
|       </el-date-picker> | ||||
|       <el-button slot="footer" @click="selectDete" type="primary">确认</el-button> | ||||
|     </ai-dialog> | ||||
|   </section> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import { mapState } from "vuex" | ||||
| import * as echarts from 'echarts'; | ||||
| import dayjs from 'dayjs' | ||||
| export default { | ||||
|   name: "gridScoreStatistics", | ||||
|   label: "积分统计", | ||||
|   props: { | ||||
|     instance: Function, | ||||
|     dict: Object, | ||||
|     permissions: Function, | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       myChart1: null, | ||||
|       myChart2: null, | ||||
|       tableData: [], | ||||
|       search: { | ||||
|         current: 1, | ||||
|         userName: '', | ||||
|         girdId: '', | ||||
|         integralType: '', | ||||
|         startTime: '', | ||||
|         endTime: '', | ||||
|       }, | ||||
|       girdIdArr:[], | ||||
|       total: 0, | ||||
|       size: 10, | ||||
|       current: 1, | ||||
|       girdList: [], | ||||
|       time: [], | ||||
|       timeCheck: ['昨日','近7天','近30天','自定义'], | ||||
|       dialog: false, | ||||
|       dialogDate: false, | ||||
|       timeList: [], | ||||
|       type: '1', | ||||
|       startTime: '', | ||||
|       endTime: '', | ||||
|       data: {}, | ||||
|       girdId: '', | ||||
|       girdArr: [], | ||||
|       girdOptions: [], | ||||
|       defaultProps: { | ||||
|         label: 'girdName', | ||||
|         value: 'id', | ||||
|         children: 'children', | ||||
|         checkStrictly: true, | ||||
|       }, | ||||
|       details: {}, | ||||
|       fileDownLoad: [], | ||||
|       userSortListX: [], | ||||
|       userSortListY: [], | ||||
|       girdSortListX: [], | ||||
|       girdSortListY: [], | ||||
|     } | ||||
|   }, | ||||
|   computed: { | ||||
|     ...mapState(['user']), | ||||
|     colConfigs() { | ||||
|       return [ | ||||
|         { prop: "integralUserName", label: '姓名', align: "left", width: "200px" }, | ||||
|         { prop: "girdName", label: '所属网格', align: "center", width: "180px" }, | ||||
|         { slot: "eventDesc"}, | ||||
|         { slot: "integralType", label: '类型' }, | ||||
|         { slot: "changeIntegral", label: '积分变动', align: "center", }, | ||||
|         { prop: "nowIntegral", label: '剩余积分', align: "center", }, | ||||
|         { prop: "createTime", label: '时间', align: "center", }, | ||||
|         { slot: "options" } | ||||
|       ] | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|     this.time = [dayjs().subtract(1,'week').format('YYYY-MM-DD'),dayjs().format('YYYY-MM-DD')] | ||||
|     this.$dict.load('epidemicDangerousAreaLevel','integralType','integralRuleEvent','integralRuleEventType').then(() => { | ||||
|       this.getStatistics() | ||||
|       this.getGridList() | ||||
|       this.getRanking() | ||||
|       this.search.startTime = this.time?.[0] | ||||
|       this.search.endTime = this.time?.[1] | ||||
|       this.getTableData() | ||||
|     }) | ||||
|   }, | ||||
|   methods: { | ||||
|     // 统计接口 | ||||
|     getStatistics() { | ||||
|       this.instance.post('/app/appintegraluser/allGirdIntegral',null, { | ||||
|         params: { | ||||
|           type: this.type, | ||||
|           girdId: this.girdId, | ||||
|           startTime: this.startTime, | ||||
|           endTime: this.endTime, | ||||
|         } | ||||
|       }).then(res => { | ||||
|         if(res?.data) { | ||||
|           this.data = res.data | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     // 人员、网格排行 | ||||
|     getRanking() { | ||||
|       this.instance.post('/app/appintegraluser/userAndGirdIntegralSort',null,{ | ||||
|         params: { | ||||
|           type: this.type, | ||||
|           girdId: this.girdId, | ||||
|           startTime: this.startTime, | ||||
|           endTime: this.endTime | ||||
|         } | ||||
|       }).then((res) => { | ||||
|         if(res?.data) { | ||||
|           this.userSortListX = res.data.userSortList.map(e=> e.userName).reverse() | ||||
|           this.userSortListY = res.data.userSortList.map(e=> e.changeIntegral).reverse() | ||||
|           this.girdSortListX = res.data.girdSortList.map(e=> e.girdName).reverse() | ||||
|           this.girdSortListY = res.data.girdSortList.map(e=> e.changeIntegral).reverse() | ||||
|           this.getColEcherts1(this.userSortListX,this.userSortListY) | ||||
|           this.getColEcherts2(this.girdSortListX,this.girdSortListY) | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     // 积分明细 | ||||
|     getTableData() { | ||||
|       this.instance.post('/app/appintegraluser/girdIntegralDetail',null,{ | ||||
|         params: { | ||||
|           ...this.search, | ||||
|           current: this.current, | ||||
|           size: this.size, | ||||
|           total: this.total, | ||||
|         } | ||||
|       }).then(res => { | ||||
|         if(res?.data) { | ||||
|           this.tableData = res.data.records | ||||
|           this.total = res.data.total | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     gridChangeOpt(val) { | ||||
|       this.girdIdArr = val | ||||
|       this.search.girdId = val?.[val.length - 1] | ||||
|       this.$refs.cascader2.dropDownVisible = false; | ||||
|       this.getTableData() | ||||
|     }, | ||||
|  | ||||
|     getColEcherts1(xData,yData) { | ||||
|       let chartDom1 = document.getElementById('chart1'); | ||||
|       chartDom1.style.width = (window.innerWidth - 435) / 2 + "px"; | ||||
|       this.myChart1 = echarts.init(chartDom1); | ||||
|       this.myChart1.setOption({ | ||||
|         tooltip: { | ||||
|           trigger: 'axis', | ||||
|           axisPointer: { | ||||
|             type: 'shadow' | ||||
|           } | ||||
|         }, | ||||
|         grid: { | ||||
|           left: '16px', | ||||
|           right: '28px', | ||||
|           bottom: '14px', | ||||
|           top: '16px', | ||||
|           containLabel: true | ||||
|         }, | ||||
|         xAxis: { | ||||
|           type: 'value', | ||||
|           boundaryGap: [0, 0.01], | ||||
|         }, | ||||
|         yAxis: { | ||||
|           type: 'category', | ||||
|           data: xData, | ||||
|           axisTick: { | ||||
|             show: false, | ||||
|           }, | ||||
|           axisLine: { | ||||
|             show: false, | ||||
|           }, | ||||
|         }, | ||||
|  | ||||
|         series: [ | ||||
|           { | ||||
|             data: yData, | ||||
|             type: 'bar', | ||||
|             itemStyle: { | ||||
|               normal: { | ||||
|                 color: "#5087ec", | ||||
|                 label: { | ||||
|                   show: true,  //开启显示 | ||||
|                   position: 'right',    //在上方显示 | ||||
|                   textStyle: { | ||||
|                     fontSize: 13, | ||||
|                     color: '#666' | ||||
|                   } | ||||
|                 }, | ||||
|               }, | ||||
|             }, | ||||
|             barWidth: 10, | ||||
|             barGap: '20%', | ||||
|           } | ||||
|         ] | ||||
|       }, true); | ||||
|       window.addEventListener("resize", this.onResize) | ||||
|     }, | ||||
|     getColEcherts2(xData,yData) { | ||||
|       let chartDom2 = document.getElementById('chart2'); | ||||
|       chartDom2.style.width = (window.innerWidth - 435) / 2 + "px"; | ||||
|       this.myChart2 = echarts.init(chartDom2); | ||||
|       this.myChart2.setOption({ | ||||
|         tooltip: { | ||||
|           trigger: 'axis', | ||||
|           axisPointer: { | ||||
|             type: 'shadow' | ||||
|           } | ||||
|         }, | ||||
|         grid: { | ||||
|           left: '16px', | ||||
|           right: '28px', | ||||
|           bottom: '14px', | ||||
|           top: '16px', | ||||
|           containLabel: true | ||||
|         }, | ||||
|         xAxis: { | ||||
|           type: 'value', | ||||
|           boundaryGap: [0, 0.01], | ||||
|         }, | ||||
|         yAxis: { | ||||
|           type: 'category', | ||||
|           data: xData, | ||||
|           axisTick: { | ||||
|             show: false, | ||||
|           }, | ||||
|           axisLine: { | ||||
|             show: false, | ||||
|           }, | ||||
|           triggerEvent: true, | ||||
|             //设置文本过长超出隐藏...表示 | ||||
|             axisLabel:{ | ||||
|               margin: 8, | ||||
|               formatter: function(params){ | ||||
|                 var val="" | ||||
|                 if(params.length > 8) { | ||||
|                   val = params.substr(0,8)+'...' | ||||
|                   return val | ||||
|                 } else { | ||||
|                   return params; | ||||
|               } | ||||
|             } | ||||
|           }, | ||||
|         }, | ||||
|         series: [ | ||||
|           { | ||||
|             data: yData, | ||||
|             type: 'bar', | ||||
|             itemStyle: { | ||||
|               normal: { | ||||
|                 color: "#5087ec", | ||||
|                 label: { | ||||
|                   show: true,  //开启显示 | ||||
|                   position: 'right',    //在右方显示 | ||||
|                   textStyle: { | ||||
|                     fontSize: 13, | ||||
|                     color: '#666' | ||||
|                   } | ||||
|                 }, | ||||
|               }, | ||||
|             }, | ||||
|             barWidth: 10, | ||||
|             barGap: '20%', | ||||
|           } | ||||
|         ] | ||||
|       }, true); | ||||
|       window.addEventListener("resize", this.onResize2) | ||||
|       // this.extension(this.myChart2) | ||||
|     }, | ||||
|     onResize1() { | ||||
|       this.myChart1.resize() | ||||
|     }, | ||||
|     onResize2() { | ||||
|       this.myChart2.resize() | ||||
|     }, | ||||
|     gridChange(val) { | ||||
|       this.girdArr = val | ||||
|       this.girdId = val?.[val.length - 1] | ||||
|       this.$refs.cascader1.dropDownVisible = false; | ||||
|       this.getStatistics() | ||||
|       this.getRanking() | ||||
|     }, | ||||
|     // 所有网格 | ||||
|     getGridList() { | ||||
|       this.instance.post(`/app/appgirdinfo/listAll3`).then((res) => { | ||||
|         if (res?.code == 0) { | ||||
|           this.girdOptions = this.toTree(res.data) | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     // 转树形结构 | ||||
|     toTree(data) { | ||||
|       let result = []; | ||||
|       if (!Array.isArray(data)) { | ||||
|         return result | ||||
|       } | ||||
|       let map = {}; | ||||
|       data.forEach(item => { | ||||
|         map[item.id] = item; | ||||
|       }); | ||||
|       data.forEach(item => { | ||||
|         let parent = map[item.parentGirdId]; | ||||
|         if (parent) { | ||||
|           (parent.children || (parent.children = [])).push(item); | ||||
|         } else { | ||||
|           result.push(item); | ||||
|         } | ||||
|       }); | ||||
|       return result; | ||||
|     }, | ||||
|  | ||||
|     timeChange(index) { | ||||
|       if(index == 3) { | ||||
|         this.dialogDate = true | ||||
|       } | ||||
|       this.type = index | ||||
|       this.getStatistics() | ||||
|       this.getRanking() | ||||
|     }, | ||||
|  | ||||
|     open(id) { | ||||
|       this.dialog = true | ||||
|       this.getDetail(id) | ||||
|     }, | ||||
|  | ||||
|     onChange(val) { | ||||
|       this.search.startTime = val?.[0] | ||||
|       this.search.endTime = val?.[1] | ||||
|       this.getTableData() | ||||
|     }, | ||||
|  | ||||
|     getDetail(id) { | ||||
|       this.instance.post(`/app/appintegraldetail/queryDetailById?id=${id}`).then(res=> { | ||||
|         if(res?.data) { | ||||
|           this.details = res.data | ||||
|           if(res.data.enclosure) { | ||||
|             let str = res.data.enclosure.split('/') | ||||
|             this.fileDownLoad = [{ | ||||
|               url:res.data.enclosure, | ||||
|               name: str?.[str.length - 1] | ||||
|             }] | ||||
|           } | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     selectDete() { | ||||
|       if(!this.timeList || !this.timeList.length) { | ||||
|         return this.$message.error('请选择自定义时间'); | ||||
|       } | ||||
|       this.startTime = this.timeList?.[0] | ||||
|       this.endTime = this.timeList?.[1] | ||||
|       this.dialogDate = false | ||||
|       this.getStatistics() | ||||
|       this.getRanking() | ||||
|     }, | ||||
|  | ||||
|   }, | ||||
|  | ||||
|   filters: { | ||||
|     formatTime(num) { | ||||
|       if(num > 0) { | ||||
|         return '+' + num | ||||
|       } else { | ||||
|         return num | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|  | ||||
|   mounted() { | ||||
|     this.getColEcherts1() | ||||
|     this.getColEcherts2() | ||||
|   }, | ||||
|  | ||||
|   destroyed () { | ||||
|     window.removeEventListener('resize', this.onResize1) | ||||
|     window.removeEventListener('resize', this.onResize2) | ||||
|   }, | ||||
|  | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| .gridScoreStatistics { | ||||
|   height: 100%; | ||||
|   box-sizing: border-box; | ||||
|   padding-top: 20px; | ||||
|   .overallStatistics { | ||||
|     width: 100%; | ||||
|     margin-bottom: 16px; | ||||
|     padding: 20px; | ||||
|     box-sizing: border-box; | ||||
|     background: #FFF; | ||||
|  | ||||
|     .title { | ||||
|       width: 100%; | ||||
|       display: flex; | ||||
|       justify-content: space-between; | ||||
|       margin-bottom: 16px; | ||||
|       p { | ||||
|         font-size: 16px; | ||||
|         font-family: MicrosoftYaHeiSemibold; | ||||
|         color: #222222; | ||||
|         font-weight: 600; | ||||
|       } | ||||
|  | ||||
|       .title_right { | ||||
|         display: flex; | ||||
|         align-items: center; | ||||
|         span { | ||||
|           display: inline-block; | ||||
|           width: 70px; | ||||
|           height: 32px; | ||||
|           line-height: 32px; | ||||
|           border-radius: 2px; | ||||
|           border: 1px solid #D0D4DC; | ||||
|           margin-right: 8px; | ||||
|           text-align: center; | ||||
|           cursor: pointer; | ||||
|         } | ||||
|         .active { | ||||
|           color: #2266FF; | ||||
|           border: 1px solid #2266FF; | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     .card_list { | ||||
|       display: flex; | ||||
|       .card { | ||||
|         flex: 1; | ||||
|         height: 96px; | ||||
|         background: #F9F9F9; | ||||
|         border-radius: 2px; | ||||
|         margin-right: 20px; | ||||
|         padding: 16px 24px; | ||||
|         box-sizing: border-box; | ||||
|         h2 { | ||||
|           color: #888888; | ||||
|           font-weight: 600; | ||||
|           font-size: 16px; | ||||
|         } | ||||
|         p { | ||||
|           margin-top: 8px; | ||||
|           font-size: 24px; | ||||
|           font-weight: 600; | ||||
|         } | ||||
|         .color1 { | ||||
|           color: #2891FF; | ||||
|         } | ||||
|         .color2 { | ||||
|           color: #22AA99; | ||||
|         } | ||||
|         .color3 { | ||||
|           color: #F8B425; | ||||
|         } | ||||
|       } | ||||
|       .card:last-child { | ||||
|         margin-right: 0; | ||||
|       } | ||||
|     } | ||||
|     .echertsBox { | ||||
|       width: 100%; | ||||
|       margin-top: 20px; | ||||
|       background: #FFF; | ||||
|       display: flex; | ||||
|       .left_Box { | ||||
|         margin-right: 16px; | ||||
|         flex: 1; | ||||
|       } | ||||
|       .right_Box { | ||||
|         width: 100%; | ||||
|         flex: 1; | ||||
|       } | ||||
|  | ||||
|       .left_Box, | ||||
|       .right_Box { | ||||
|         background: #F9F9F9; | ||||
|         box-shadow: 0px 4px 6px -2px rgba(15,15,21,0.1500); | ||||
|         border-radius: 4px; | ||||
|         padding: 16px; | ||||
|         box-sizing: border-box; | ||||
|         #chart1, | ||||
|         #chart2 { | ||||
|           width: 100%; | ||||
|           height: 300px; | ||||
|         } | ||||
|         p { | ||||
|           font-weight: 600; | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   // .chartCss { | ||||
|   //   position: absolute; | ||||
|   //   color: black; | ||||
|   //   background:white; | ||||
|   //   font-family: Aril; | ||||
|   //   font-size: 12px; | ||||
|   //   padding: 5px; | ||||
|   //   display: inline; | ||||
|   // } | ||||
|  | ||||
|   :deep( .el-dialog__footer ){ | ||||
|     text-align: center; | ||||
|   } | ||||
|   :deep( .el-dialog__header ){ | ||||
|     border-bottom: 1px solid #DDD; | ||||
|   } | ||||
|   :deep( .ai-detail ){ | ||||
|     background: #FFF; | ||||
|   } | ||||
|  } | ||||
| </style> | ||||
							
								
								
									
										63
									
								
								project/qujing/app/AppOrder/AppOrder.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								project/qujing/app/AppOrder/AppOrder.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,63 @@ | ||||
| <template> | ||||
|   <div class="doc-circulation"> | ||||
|     <keep-alive :include="['List']"> | ||||
|       <component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component> | ||||
|     </keep-alive> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   import List from './components/List' | ||||
|   import Detail from './components/Detail' | ||||
|  | ||||
|   export default { | ||||
|     name: 'AppOrder', | ||||
|     label: '订单管理', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         component: 'List', | ||||
|         params: {}, | ||||
|         include: [] | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     components: { | ||||
|       Detail, | ||||
|       List | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       onChange (data) { | ||||
|         if (data.type === 'Detail') { | ||||
|           this.component = 'Detail' | ||||
|           this.params = data.params | ||||
|         } | ||||
|  | ||||
|         if (data.type === 'List') { | ||||
|           this.component = 'List' | ||||
|           this.params = data.params | ||||
|  | ||||
|           this.$nextTick(() => { | ||||
|             if (data.isRefresh) { | ||||
|               this.$refs.component.getList() | ||||
|             } | ||||
|           }) | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss"> | ||||
|   .doc-circulation { | ||||
|     height: 100%; | ||||
|     background: #F3F6F9; | ||||
|     overflow: auto; | ||||
|   } | ||||
| </style> | ||||
							
								
								
									
										168
									
								
								project/qujing/app/AppOrder/components/Detail.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										168
									
								
								project/qujing/app/AppOrder/components/Detail.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,168 @@ | ||||
|  <template> | ||||
|   <ai-detail v-loading="isLoading" class="detail"> | ||||
|     <template slot="title"> | ||||
|       <ai-title title="订单详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)"> | ||||
|       </ai-title> | ||||
|     </template> | ||||
|     <template slot="content"> | ||||
|       <ai-card title="基本信息"> | ||||
|         <template #right> | ||||
|           <el-button type="primary" v-if="info.orderStatus === '0'" @click="isShow = true">订单核销</el-button> | ||||
|         </template> | ||||
|         <template #content> | ||||
|           <ai-wrapper | ||||
|             label-width="120px"> | ||||
|             <ai-info-item label="订单编号" :value="info.orderCode"></ai-info-item> | ||||
|             <ai-info-item label="订单状态" :value="dict.getLabel('merchandiseOrderStatus', info.orderStatus)"></ai-info-item> | ||||
|             <ai-info-item label="兑换人" :value="info.consumerName"></ai-info-item> | ||||
|             <ai-info-item label="兑换时间" :value="info.createTime"></ai-info-item> | ||||
|             <ai-info-item label="备注" isLine :value="info.remark"></ai-info-item> | ||||
|           </ai-wrapper> | ||||
|         </template> | ||||
|       </ai-card> | ||||
|       <ai-card title="操作信息" v-if="info.orderStatus === '1'"> | ||||
|         <template #content> | ||||
|           <ai-wrapper | ||||
|             label-width="120px"> | ||||
|             <ai-info-item label="核销人" :value="info.auditUserName"></ai-info-item> | ||||
|             <ai-info-item label="核销时间" :value="info.auditTime"></ai-info-item> | ||||
|           </ai-wrapper> | ||||
|         </template> | ||||
|       </ai-card> | ||||
|       <ai-card title="商品信息"> | ||||
|         <template #content> | ||||
|           <ai-table | ||||
|             :tableData="tableData" | ||||
|             :isShowPagination="false" | ||||
|             :col-configs="colConfigs" | ||||
|             @getList="() => {}"> | ||||
|             <el-table-column slot="goods" width="240px" label="商品" align="left"> | ||||
|               <template slot-scope="{ row }"> | ||||
|                 <div class="goods"> | ||||
|                   <img :src="row.imageUrl"> | ||||
|                   <span>{{ row.merchandiseName }}</span> | ||||
|                 </div> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|           </ai-table> | ||||
|         </template> | ||||
|       </ai-card> | ||||
|       <ai-dialog | ||||
|         :visible.sync="isShow" | ||||
|         width="590px" | ||||
|         title="订单核销" | ||||
|         @close="form.code = ''" | ||||
|         @onConfirm="onConfirm"> | ||||
|         <el-form ref="form" :model="form" label-width="110px" label-position="right"> | ||||
|           <el-form-item label="核销码" prop="code" :rules="[{required: true, message: '请输入核销码', trigger: 'blur'}]"> | ||||
|             <el-input size="small" placeholder="请输入核销码" v-model="form.code"></el-input> | ||||
|           </el-form-item> | ||||
|         </el-form> | ||||
|       </ai-dialog> | ||||
|     </template> | ||||
|   </ai-detail> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   export default { | ||||
|     name: 'Detail', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object, | ||||
|       params: Object | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         info: {}, | ||||
|         isShow: false, | ||||
|         currIndex: 0, | ||||
|         isLoading: false, | ||||
|         tableData: [], | ||||
|         form: { | ||||
|           code: '' | ||||
|         }, | ||||
|         colConfigs: [ | ||||
|           { slot: 'goods', label: '商品' }, | ||||
|           { prop: 'merchandiseIntegral', align: 'center', label: '单价' }, | ||||
|           { prop: 'merchandiseNumber', align: 'center', label: '数量' }, | ||||
|           { prop: 'merchandiseIntegral', align: 'center', label: '小计' } | ||||
|         ], | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     created () { | ||||
|       this.isLoading = true | ||||
|       if (this.params && this.params.id) { | ||||
|         this.id = this.params.id | ||||
|         this.dict.load(['merchandiseOrderStatus']).then(() => { | ||||
|           this.getInfo(this.params.id) | ||||
|         }) | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       getInfo (id) { | ||||
|         this.instance.post(`/app/appintegralmerchandiseorder/queryDetailById?id=${id}`).then(res => { | ||||
|           if (res.code === 0) { | ||||
|             this.info = res.data | ||||
|             this.tableData = [this.info] | ||||
|           } | ||||
|  | ||||
|           this.isLoading = false | ||||
|         }).catch(() => { | ||||
|           this.isLoading = false | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       onConfirm() { | ||||
|         this.$refs.form.validate((valid) => { | ||||
|           if (valid) { | ||||
|             this.instance.post(`/app/appintegralmerchandiseorder/writeOffOrder`, null, { | ||||
|               params: { | ||||
|                 code: this.form.code, | ||||
|                 id: this.params.id | ||||
|               } | ||||
|             }).then(res => { | ||||
|               if (res.code == 0) { | ||||
|                 this.isShow = false | ||||
|                 this.getInfo(this.params.id) | ||||
|                 this.$message.success('核销成功') | ||||
|               } | ||||
|             }) | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       cancel () { | ||||
|         this.$emit('change', { | ||||
|           type: 'List', | ||||
|           isRefresh: true | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style scoped lang="scss"> | ||||
|   .detail .goods { | ||||
|     display: flex; | ||||
|     align-items: center; | ||||
|  | ||||
|     img { | ||||
|       width: 80px; | ||||
|       height: 80px; | ||||
|       margin-right: 20px; | ||||
|     } | ||||
|  | ||||
|     span { | ||||
|       flex: 1; | ||||
|       display: -webkit-box; | ||||
|       overflow: hidden; | ||||
|       -webkit-line-clamp: 2; | ||||
|       -webkit-box-orient: vertical; | ||||
|     } | ||||
|   } | ||||
|  | ||||
| </style> | ||||
							
								
								
									
										300
									
								
								project/qujing/app/AppOrder/components/List.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										300
									
								
								project/qujing/app/AppOrder/components/List.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,300 @@ | ||||
| <template> | ||||
|   <ai-list class="list"> | ||||
|     <ai-title slot="title" title="订单管理" isShowBottomBorder> | ||||
|       <template #sub> | ||||
|         <span>可查看并核销网格员在积分超市中兑换的商品订单</span> | ||||
|       </template> | ||||
|     </ai-title> | ||||
|     <template slot="content"> | ||||
|       <ai-search-bar bottomBorder> | ||||
|         <template #left> | ||||
|           <ai-user-selecter v-model="user" :instance="instance" @change="onUserChange" :isMultiple="false"> | ||||
|             <div class="userSelcet"> | ||||
|               <span style="color: #606266;" v-if="search.consumerId">{{ name }}</span> | ||||
|               <span v-else>兑换人</span> | ||||
|               <i class="el-icon-arrow-up"  v-if="!search.consumerId"></i> | ||||
|               <i class="el-icon-circle-close" v-if="search.consumerId" @click.stop="user = [], search.consumerId = '', name = '', search.current = 1, getList()"></i> | ||||
|             </div> | ||||
|           </ai-user-selecter> | ||||
|           <ai-select | ||||
|             v-model="search.orderStatus" | ||||
|             clearable | ||||
|             placeholder="请选择订单状态" | ||||
|             :selectList="dict.getDict('merchandiseOrderStatus')" | ||||
|             @change="search.current = 1, getList()"> | ||||
|           </ai-select> | ||||
|           <el-date-picker | ||||
|             v-model="search.createTimeStart" | ||||
|             type="date" | ||||
|             size="small" | ||||
|             value-format="yyyy-MM-dd" | ||||
|             placeholder="选择兑换开始日期" | ||||
|             @change="search.current = 1, getList()"> | ||||
|           </el-date-picker> | ||||
|           <el-date-picker | ||||
|             v-model="search.createTimeEnd" | ||||
|             type="date" | ||||
|             size="small" | ||||
|             value-format="yyyy-MM-dd" | ||||
|             placeholder="选择兑换结束日期" | ||||
|             @change="search.current = 1, getList()"> | ||||
|           </el-date-picker> | ||||
|         </template> | ||||
|         <template #right> | ||||
|           <el-input | ||||
|             v-model="search.merchandiseName" | ||||
|             size="small" | ||||
|             placeholder="请输入商品名称" | ||||
|             clearable | ||||
|             v-throttle="() => {search.current = 1, getList()}" | ||||
|             @clear="search.current = 1, search.merchandiseName = '', getList()" | ||||
|             suffix-icon="iconfont iconSearch"> | ||||
|           </el-input> | ||||
|         </template> | ||||
|       </ai-search-bar> | ||||
|       <ai-search-bar style="margin-top: 12px" bottomBorder> | ||||
|         <template #left> | ||||
|           <!-- <el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">订单核销</el-button> --> | ||||
|           <ai-download :instance="instance" url="/app/appintegralmerchandiseorder/export" :params="search" fileName="订单" :disabled="tableData.length == 0"> | ||||
|             <el-button icon="iconfont iconExported" :disabled="tableData.length == 0">导出订单</el-button> | ||||
|           </ai-download> | ||||
|         </template> | ||||
|         <template #right> | ||||
|         </template> | ||||
|       </ai-search-bar> | ||||
|       <ai-table | ||||
|         :tableData="tableData" | ||||
|         :col-configs="colConfigs" | ||||
|         :total="total" | ||||
|         v-loading="loading" | ||||
|         style="margin-top: 16px;" | ||||
|         :current.sync="search.current" | ||||
|         :size.sync="search.size" | ||||
|         @getList="getList"> | ||||
|         <el-table-column slot="goods" width="240px" label="商品" align="left"> | ||||
|           <template slot-scope="{ row }"> | ||||
|             <div class="goods"> | ||||
|               <ai-uploader | ||||
|                 :instance="instance" | ||||
|                 disabled | ||||
|                 :value="[{url: row.imageUrl}]" | ||||
|                 :limit="1"> | ||||
|               </ai-uploader> | ||||
|               <span>{{ row.merchandiseName }}</span> | ||||
|             </div> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column slot="options" width="140px" fixed="right" label="操作" align="center"> | ||||
|           <template slot-scope="{ row }"> | ||||
|             <div class="table-options"> | ||||
|               <el-button type="text" v-if="row.orderStatus === '0'" @click="id = row.id, isShow = true">订单核销</el-button> | ||||
|               <el-button type="text" @click="toDetail(row.id)">详情</el-button> | ||||
|             </div> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </ai-table> | ||||
|       <ai-dialog | ||||
|         :visible.sync="isShow" | ||||
|         width="590px" | ||||
|         title="订单核销" | ||||
|         @close="form.code = '', id = ''" | ||||
|         @onConfirm="onConfirm"> | ||||
|         <el-form ref="form" :model="form" label-width="110px" label-position="right"> | ||||
|           <el-form-item label="核销码" prop="code" :rules="[{required: true, message: '请输入核销码', trigger: 'blur'}]"> | ||||
|             <el-input size="small" placeholder="请输入核销码" v-model="form.code"></el-input> | ||||
|           </el-form-item> | ||||
|         </el-form> | ||||
|       </ai-dialog> | ||||
|     </template> | ||||
|   </ai-list> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   export default { | ||||
|     name: 'List', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         search: { | ||||
|           current: 1, | ||||
|           size: 10, | ||||
|           merchandiseName: '', | ||||
|           orderStatus: '', | ||||
|           consumerId: '', | ||||
|           createTimeStart: '', | ||||
|           createTimeEnd: '' | ||||
|         }, | ||||
|         id: '', | ||||
|         form: { | ||||
|           code: '' | ||||
|         }, | ||||
|         isShow: false, | ||||
|         user: [], | ||||
|         name: '', | ||||
|         info: {}, | ||||
|         colConfigs: [ | ||||
|           { slot: 'goods', label: '商品' }, | ||||
|           { prop: 'merchandiseIntegral', align: 'center', label: '单价' }, | ||||
|           { prop: 'merchandiseNumber', align: 'center', label: '数量' }, | ||||
|           // { | ||||
|           //   prop: 'areaName', label: '活动地区', align: 'center' , | ||||
|           //   render: (h, params) => { | ||||
|           //     return h('span', { | ||||
|           //     }, params.row.areaName) | ||||
|           //   } | ||||
|           // }, | ||||
|           { prop: 'merchandiseIntegral', align: 'center', label: '消耗积分' }, | ||||
|           { prop: 'consumerName', align: 'center', label: '兑换人' }, | ||||
|           { | ||||
|             prop: 'createTime', | ||||
|             align: 'center', | ||||
|             label: '兑换时间' | ||||
|           }, | ||||
|           { | ||||
|             prop: 'orderStatus', | ||||
|             align: 'center', | ||||
|             label: '状态', | ||||
|             format: v => this.dict.getLabel('merchandiseOrderStatus', v) | ||||
|           } | ||||
|         ], | ||||
|         ids: [], | ||||
|         tableData: [], | ||||
|         total: 0, | ||||
|         loading: false, | ||||
|         disabledLevel: 0 | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     created () { | ||||
|       this.dict.load(['merchandiseOrderStatus']).then(() => { | ||||
|         this.getList() | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       onUserChange (e) { | ||||
|         if (e.length) { | ||||
|           this.name = e[0].name | ||||
|           this.search.consumerId = e[0].id | ||||
|         } else { | ||||
|           this.search.consumerId = '' | ||||
|         } | ||||
|         this.search.current = 1 | ||||
|  | ||||
|         this.getList() | ||||
|       }, | ||||
|  | ||||
|       onConfirm() { | ||||
|         this.$refs.form.validate((valid) => { | ||||
|           if (valid) { | ||||
|             this.instance.post(`/app/appintegralmerchandiseorder/writeOffOrder`, null, { | ||||
|               params: { | ||||
|                 code: this.form.code, | ||||
|                 id: this.id | ||||
|               } | ||||
|             }).then(res => { | ||||
|               if (res.code == 0) { | ||||
|                 this.isShow = false | ||||
|                 this.getList() | ||||
|                 this.$message.success('核销成功') | ||||
|               } | ||||
|             }) | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       getList () { | ||||
|         this.instance.post(`/app/appintegralmerchandiseorder/list`, null, { | ||||
|           params: { | ||||
|             ...this.search | ||||
|           } | ||||
|         }).then(res => { | ||||
|           if (res.code == 0) { | ||||
|             this.tableData = res.data.records | ||||
|             this.total = res.data.total | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       toDetail (id) { | ||||
|         this.$emit('change', { | ||||
|           type: 'Detail', | ||||
|           params: { | ||||
|             id: id || '' | ||||
|           } | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style scoped lang="scss"> | ||||
|   .list { | ||||
|     .goods { | ||||
|       display: flex; | ||||
|       align-items: center; | ||||
|  | ||||
|       img { | ||||
|         width: 80px; | ||||
|         height: 80px; | ||||
|         margin-right: 20px; | ||||
|       } | ||||
|  | ||||
|       span { | ||||
|         flex: 1; | ||||
|         display: -webkit-box; | ||||
|         overflow: hidden; | ||||
|         -webkit-line-clamp: 2; | ||||
|         -webkit-box-orient: vertical; | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     .userSelcet { | ||||
|       display: flex; | ||||
|       align-items: center; | ||||
|       justify-content: space-between; | ||||
|       width: 215px; | ||||
|       height: 32px; | ||||
|       line-height: 32px; | ||||
|       border-radius: 4px; | ||||
|       border: 1px solid #d0d4dc; | ||||
|       overflow: hidden; | ||||
|       cursor: pointer; | ||||
|       transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); | ||||
|  | ||||
|       &:hover { | ||||
|         border-color: $placeholderColor; | ||||
|       } | ||||
|  | ||||
|       i { | ||||
|         display: flex; | ||||
|         position: relative; | ||||
|         align-items: center; | ||||
|         justify-content: center; | ||||
|         width: 30px; | ||||
|         height: 100%; | ||||
|         line-height: 32px; | ||||
|         font-size: 14px; | ||||
|         text-align: center; | ||||
|         color: #d0d4dc; | ||||
|         transform: rotateZ(180deg); | ||||
|       } | ||||
|  | ||||
|       .el-icon-circle-close:hover { | ||||
|         opacity: 0.6; | ||||
|       } | ||||
|  | ||||
|       span { | ||||
|         flex: 1; | ||||
|         padding: 0 15px; | ||||
|         font-size: 12px; | ||||
|         color: $placeholderColor; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </style> | ||||
		Reference in New Issue
	
	Block a user