Browse Source

始宁农业小程序:农户管理

panyong 2 years ago
parent
commit
b74c18bbe0

+ 46 - 18
htmldev/shiningManage/src/views/businessManage/business/details.vue

@@ -104,13 +104,33 @@
           </el-upload>
         </el-form-item>
         <el-form-item
-          prop="shop_address"
-          :rules="formRules.required"
-          label="详细地址:">
+          size="small"
+          prop="shop_address">
+          <template #label>
+            地址:
+            <el-button type="text" @click="jumpQQLBS">(获取维度经度)</el-button>
+          </template>
+          <el-input
+            v-model="form.shop_address.address_name"
+            placeholder="详细地址"
+            clearable></el-input>
           <el-input
-            v-model="form.shop_address"
-            placeholder="请输入详细地址"
+            style="margin-top: 10px;"
+            v-model="form.shop_address.name"
+            placeholder="位置名称"
             clearable></el-input>
+          <div class="lon-lat">
+            <el-input
+              style="width: 48%;"
+              v-model.trim="form.shop_address.latitude"
+              placeholder="纬度"
+              clearable></el-input>
+            <el-input
+              style="width: 48%;"
+              v-model.trim="form.shop_address.longitude"
+              placeholder="经度"
+              clearable></el-input>
+          </div>
         </el-form-item>
         <el-form-item
           label="备注:"
@@ -164,7 +184,7 @@ export default {
         'country_msg': '', // 村信息
         'user_wechat_code': '', // 微信号
         'user_code_url': [], // 微信二维码
-        'shop_address': '', // 地址
+        'shop_address': {}, // 地址
         'shop_remark': '' // 备注
       },
       shop_img_url: [],
@@ -211,6 +231,18 @@ export default {
             user_code_url: formData.user_code_url[0],
             shop_img_url: formData.shop_img_url[0]
           }
+          if (!formData.shop_address.address_name) {
+            this.$message.warning('请输入详细地址')
+            return
+          }
+          if (!formData.shop_address.latitude) {
+            this.$message.warning('请输入纬度')
+            return
+          }
+          if (!formData.shop_address.longitude) {
+            this.$message.warning('请输入经度')
+            return
+          }
           this.booLock = true
           const data = await this.$fetch(url, postData)
           this.booLock = false
@@ -221,6 +253,9 @@ export default {
           }
         }
       })
+    },
+    jumpQQLBS() {
+      window.open('https://lbs.qq.com/getPoint/', '_blank')
     }
   },
   mounted() {
@@ -248,8 +283,8 @@ export default {
             if (key === 'sort_id') {
               value = value.toString()
             }
-            if (key === 'shop_address' && Object.prototype.toString.call(value) === '[object Object]') {
-              value = value.address_name + value.name
+            if (key === 'shop_address' && Object.prototype.toString.call(value) !== '[object Object]') {
+              value = {}
             }
             this.$set(this.form, key, value)
           }
@@ -271,17 +306,10 @@ export default {
   margin-bottom: 20px;
 }
 
-.af-put-line-radio {
+.lon-lat {
   display: flex;
+  justify-content: space-between;
   align-items: center;
-
-  p.lalel {
-    padding: 0 10px;
-  }
-
-  p {
-    padding: 0;
-    margin: 0;
-  }
+  margin-top: 10px;
 }
 </style>

+ 2 - 0
htmldev/shiningWxMini/README.md

@@ -1,5 +1,7 @@
 ### todo List
 
+* 首页
+  - [ ] 优秀产品:批发价、零售价、标签
 * 农事天地
   - [ ] 评论:回复、删除
   - [ ] 关注:取消关注

+ 5 - 3
htmldev/shiningWxMini/components/business-detail-large/index.js

@@ -111,11 +111,13 @@ Component({
 
       try {
         await wx.openLocation({
-          latitude: shop_address.latitude,
-          longitude: shop_address.longitude,
+          latitude: shop_address.latitude * 1,
+          longitude: shop_address.longitude * 1,
           name: shop_address.address_name
         })
-      } catch (err) {}
+      } catch (err) {
+        console.log(err)
+      }
     }
   }
 })

+ 13 - 1
htmldev/shiningWxMini/project.private.config.json

@@ -3,7 +3,19 @@
     "urlCheck": true,
     "compileHotReLoad": true
   },
-  "condition": {},
+  "condition": {
+    "miniprogram": {
+      "list": [
+        {
+          "name": "",
+          "pathName": "pages/businessDetail/businessDetail",
+          "query": "shop_id=3",
+          "launchMode": "default",
+          "scene": null
+        }
+      ]
+    }
+  },
   "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
   "libVersion": "2.13.2",
   "projectname": "%E5%A7%8B%E5%AE%81%E5%86%9C%E4%B8%9A"