Browse Source

提交自提点管理代码

pangqijun 1 year ago
parent
commit
3357a0b4cf
4 changed files with 117 additions and 50 deletions
  1. 7 2
      public/index.html
  2. 27 9
      src/views/groupon/groupon.vue
  3. 62 33
      src/views/groupon/selftake.vue
  4. 21 6
      src/views/mall/goodsinfo.vue

+ 7 - 2
public/index.html

@@ -19,8 +19,13 @@
   <script src="<%= BASE_URL %>cdn/xlsx/FileSaver.min.js"></script>
   <script src="<%= BASE_URL %>cdn/xlsx/xlsx.full.min.js"></script>
   <script src="https://cdn.staticfile.org/Sortable/1.10.0-rc2/Sortable.min.js"></script>
-  <script src='http://webapi.amap.com/maps?v=1.4.11&key=7ab53b28352e55dc5754699add0ad862&plugin=AMap.PlaceSearch'></script>
-  <script src="http://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
+  <script>
+    window._AMapSecurityConfig = {
+      securityJsCode: 'c5c2dcfea06bf0b83818cc98f5d0a421',
+    }
+  </script>
+  <script type="text/javascript" src='https://webapi.amap.com/maps?v=1.4.11&key=ca90d6d51568d1d5fb77238fb2d888d2&plugin=AMap.PlaceSearch'></script>
+  <script src="https://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
   <link rel="icon" href="<%= BASE_URL %>favicon.png">
   <title>Saber企业级开发平台</title>
   <style>

+ 27 - 9
src/views/groupon/groupon.vue

@@ -495,16 +495,34 @@
         };
       },
       modifyState(row, status) {
-        row.status = status;
-        modifyStatus(row).then(() => {
-          this.onLoad(this.page);
-          this.$message({
-            type: "success",
-            message: "操作成功!"
+
+
+        let title = status === 0 ? '确定禁用?' : '确定启用?';
+        this.$confirm(title, {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          const loading = this.$loading({
+            lock: true,
+            text: '修改中,请稍等...',
+            spinner: 'el-icon-loading',
+            background: 'rgba(0, 0, 0, 0.7)'
           });
-        }, error => {
-          console.log(error);
-        });
+          row.status = status;
+          modifyStatus(row).then(() => {
+            loading.close();
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+          }, error => {
+            loading.close();
+            console.log(error);
+          });
+        })
+
       },
       uploadError(error, column) {
         this.$message.success('上传失败:' + error)

+ 62 - 33
src/views/groupon/selftake.vue

@@ -26,8 +26,18 @@
         <el-tag v-if="scope.row.status === 0" type="danger">{{scope.row.$status}}</el-tag>
       </template>
 
-      <template slot="menuLeft">
-
+      <template slot="menu" slot-scope="scope">
+        <el-button v-if="scope.row.status == 0"
+                   type="text"
+                   size="small"
+                   @click="modifyState(scope.row, 1)"
+        >启用</el-button>
+        <el-button v-if="scope.row.status == 1"
+                   type="text"
+                   size="small"
+                   @click="modifyState(scope.row, 0)"
+        >禁用
+        </el-button>
       </template>
     </avue-crud>
   </basic-container>
@@ -36,16 +46,14 @@
 <script>
   import {getList, getDetail, add, update, remove} from "@/api/groupon/selftake";
   import {mapGetters} from "vuex";
+  import {getUsualLogs} from "../../api/logs";
 
   export default {
     data() {
       return {
-        //初始化坐标
-        lnglat: {
-          P: 36.71292016263102,
-          R: 119.05866949215533
-        },
-        text:{},
+        lo: 0.0,
+        la: 0.0,
+        address: '',
         form: {},
         query: {},
         loading: true,
@@ -68,14 +76,10 @@
           selection: true,
           dialogClickModal: false,
           column: [
-            {
-              label:'test',
-              prop:'test',
-              component: "avueMap"
-            },
             {
               label: "名称",
               prop: "name",
+              search: true,
               labelWidth: 120,
               rules: [{
                 required: true,
@@ -85,37 +89,27 @@
             },
             {
               label: "地址",
-              prop: "address",
+              prop: "addressTemp",
               labelWidth: 120,
+              type: 'map',
+              hide: true,
               rules: [{
                 required: true,
                 message: "请输入自提点地址",
                 trigger: "blur"
-              }]
+              }],
             },
             {
-              label: "经度",
-              prop: "longitude",
+              label: "地址",
+              prop: "address",
+              addDisplay: false,
+              editDisplay: false,
               labelWidth: 120,
-              rules: [{
-                required: true,
-                message: "请输入经度",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "纬度",
-              labelWidth: 120,
-              prop: "latitude",
-              rules: [{
-                required: true,
-                message: "请输入纬度",
-                trigger: "blur"
-              }]
             },
             {
               label: "营业开始时间",
               prop: "busStartTime",
+              valueFormat: 'HH:mm:ss',
               labelWidth: 120,
               type: "time",
               pickerOptions:{
@@ -132,6 +126,7 @@
             {
               label: "营业结束时间",
               prop: "busEndTime",
+              valueFormat: 'HH:mm:ss',
               labelWidth: 120,
               type: "time",
               pickerOptions:{
@@ -189,6 +184,10 @@
     },
     methods: {
       rowSave(row, done, loading) {
+        row.longitude = row.addressTemp[0];
+        row.latitude = row.addressTemp[1];
+        row.address = row.addressTemp[2];
+        console.log(row)
         add(row).then(() => {
           this.onLoad(this.page);
           this.$message({
@@ -202,6 +201,9 @@
         });
       },
       rowUpdate(row, index, done, loading) {
+        row.longitude = row.addressTemp[0];
+        row.latitude = row.addressTemp[1];
+        row.address = row.addressTemp[2];
         update(row).then(() => {
           this.onLoad(this.page);
           this.$message({
@@ -296,7 +298,34 @@
           this.loading = false;
           this.selectionClear();
         });
-      }
+      },
+      modifyState(row, status) {
+        let title = status === 0 ? '确定禁用?' : '确定启用?';
+        this.$confirm(title, {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          const loading = this.$loading({
+            lock: true,
+            text: '修改中,请稍等...',
+            spinner: 'el-icon-loading',
+            background: 'rgba(0, 0, 0, 0.7)'
+          });
+          row.status = status;
+          update(row).then(() => {
+            loading.close();
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+          }, error => {
+            loading.close();
+            console.log(error);
+          });
+        })
+      },
     }
   };
 </script>

+ 21 - 6
src/views/mall/goodsinfo.vue

@@ -689,13 +689,28 @@
           })
       },
       modifyGoodsState(id, state) {
-        modifyState(id, state).then(() => {
-          this.onLoad(this.page, this.query);
-          this.$message({
-            type: "success",
-            message: "操作成功!"
+        let title = state === 0 ? '确定下架?' : '确定上架?';
+        this.$confirm(title, {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          const loading = this.$loading({
+            lock: true,
+            text: '修改中,请稍等...',
+            spinner: 'el-icon-loading',
+            background: 'rgba(0, 0, 0, 0.7)'
           });
-        });
+          modifyState(id, state).then(() => {
+            loading.close();
+            this.onLoad(this.page, this.query);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.selectionClear()
+          });
+        })
       },
       openAuditBox(id) {
         this.auditBox = true;