|
@@ -7,13 +7,14 @@
|
|
|
<li class="predetermineLi2" style="border-bottom: none">
|
|
|
<div class="liName">标题</div>
|
|
|
<van-field
|
|
|
- :value="postData.constant"
|
|
|
+ :value="postData.businessName"
|
|
|
autosize
|
|
|
type="textarea"
|
|
|
placeholder="请输入"
|
|
|
class="myField"
|
|
|
maxlength="50"
|
|
|
show-word-limit
|
|
|
+ @change="changeTitle"
|
|
|
/>
|
|
|
</li>
|
|
|
</ul>
|
|
@@ -31,14 +32,14 @@
|
|
|
<li class="detailLi">
|
|
|
<span class="liName">地址</span>
|
|
|
<span >
|
|
|
- <input class="liInfo" placeholder="选择地址" disabled>
|
|
|
+ <input class="liInfo" placeholder="选择地址" v-model="postData.businessAddress" disabled @tap="showMap">
|
|
|
<van-icon name="location" style="color: rgba(51, 51, 51, 0.90)"/>
|
|
|
</span>
|
|
|
</li>
|
|
|
<li class="detailLi" style="border-bottom: none">
|
|
|
<span class="liName">电话</span>
|
|
|
<span >
|
|
|
- <input class="liInfo" placeholder="请填写">
|
|
|
+ <input class="liInfo" placeholder="请填写" v-model="postData.businessPhone">
|
|
|
</span>
|
|
|
</li>
|
|
|
</ul>
|
|
@@ -49,31 +50,32 @@
|
|
|
<span class="tips">(支持图片上传限20M内,最多1张)</span>
|
|
|
</div>
|
|
|
<van-uploader
|
|
|
- :max-count="12"
|
|
|
+ :max-count="1"
|
|
|
@delete="deleteRYXXZP"
|
|
|
:file-list="fileList"
|
|
|
@after-read="uploadRYXXZP"
|
|
|
:show-upload="true"
|
|
|
/>
|
|
|
<van-field
|
|
|
- :value="postData.constant"
|
|
|
+ :value="postData.introduction"
|
|
|
autosize
|
|
|
type="textarea"
|
|
|
placeholder="请输入"
|
|
|
class="myField"
|
|
|
maxlength="2000"
|
|
|
show-word-limit
|
|
|
+ @change="changeIntro"
|
|
|
/>
|
|
|
</li>
|
|
|
</ul>
|
|
|
<div class="buttonBox">
|
|
|
- <button class="btn zcBtn">暂存</button>
|
|
|
- <button class="btn tjBtn">发布</button>
|
|
|
+ <button class="btn zcBtn" @tap="addSurr('unpublished')">暂存</button>
|
|
|
+ <button class="btn tjBtn" @tap="addSurr('published')">发布</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</van-tab>
|
|
|
<van-tab title="发布记录" :name="1">
|
|
|
- <releaseRecord_com/>
|
|
|
+ <releaseRecord_com ref="releaseRecord"/>
|
|
|
</van-tab>
|
|
|
</van-tabs>
|
|
|
</div>
|
|
@@ -81,6 +83,8 @@
|
|
|
|
|
|
<script>
|
|
|
import releaseRecord_com from "./components/releaseRecord_com.vue";
|
|
|
+import { getByCodes,peripheryAdd,getUserLocalStorageInfo } from "@/js_sdk/http";
|
|
|
+import dayjs from "dayjs";
|
|
|
export default {
|
|
|
name: "index",
|
|
|
components:{
|
|
@@ -92,14 +96,38 @@ export default {
|
|
|
dc_key: ['periphery_type'],
|
|
|
fileList:[],
|
|
|
checkList:[],
|
|
|
- postData:{},
|
|
|
- checkedName:'干洗'
|
|
|
+ postData:{
|
|
|
+ createdBy:getUserLocalStorageInfo().userId,
|
|
|
+ status:'',
|
|
|
+ businessName:'',
|
|
|
+ type:'',
|
|
|
+ businessAddress:'',
|
|
|
+ longitude:'',
|
|
|
+ latitude:'',
|
|
|
+ businessPhone:'',
|
|
|
+ fileUrl:'',
|
|
|
+ introduction:'',
|
|
|
+ releaseType:'periphery'
|
|
|
+ },
|
|
|
+ checkedName:'干洗',
|
|
|
}
|
|
|
},
|
|
|
+ onPullDownRefresh() {
|
|
|
+ this.$refs.releaseRecord.getByCodes()
|
|
|
+ setTimeout(function () {
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
+ }, 1000);
|
|
|
+ },
|
|
|
created(){
|
|
|
this.getByCodes()
|
|
|
},
|
|
|
methods:{
|
|
|
+ changeTitle(e){
|
|
|
+ this.postData.businessName = e.detail
|
|
|
+ },
|
|
|
+ changeIntro(e){
|
|
|
+ this.postData.introduction = e.detail
|
|
|
+ },
|
|
|
async getByCodes() {
|
|
|
let data = await getByCodes(JSON.stringify(this.dc_key));
|
|
|
this.dic_SelectList = this.$common.handleDicList(data);
|
|
@@ -107,7 +135,73 @@ export default {
|
|
|
console.log('checkList',this.checkList)
|
|
|
},
|
|
|
clickCheck(item){
|
|
|
+ // console.log(item)
|
|
|
this.checkedName = item.label
|
|
|
+ this.postData.type = item.value
|
|
|
+ },
|
|
|
+ showMap(){
|
|
|
+ const _this = this
|
|
|
+ uni.chooseLocation({
|
|
|
+ success: function (res) {
|
|
|
+ console.log('选择的位置:', res.name);
|
|
|
+ _this.postData.businessAddress = res.name
|
|
|
+ console.log('纬度:' + res.latitude + ',经度:' + res.longitude);
|
|
|
+ _this.postData.latitude = res.latitude
|
|
|
+ _this.postData.longitude = res.longitude
|
|
|
+ // 其他业务逻辑
|
|
|
+ },
|
|
|
+ fail: function (error) {
|
|
|
+ console.error('Choose location failed: ' + JSON.stringify(error));
|
|
|
+ },
|
|
|
+ complete: function () {
|
|
|
+ console.log('chooseLocation operation is complete');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ addSurr(e){
|
|
|
+ const dayjs = require('dayjs')
|
|
|
+ const fileArr = []
|
|
|
+ this.fileList.forEach(file=>{
|
|
|
+ fileArr.push(file.id)
|
|
|
+ })
|
|
|
+ this.postData.fileUrl = fileArr.toString()
|
|
|
+ this.postData.status = e
|
|
|
+ let toastMsg = ''
|
|
|
+ if (e==='published'){
|
|
|
+ this.postData.publisherUserId = getUserLocalStorageInfo().userId
|
|
|
+ this.postData.releaseTime = dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
|
+ toastMsg = '发布成功'
|
|
|
+ }else{
|
|
|
+ toastMsg = '暂存成功'
|
|
|
+ }
|
|
|
+ // console.log(this.postData)
|
|
|
+ peripheryAdd(this.postData).then(res=>{
|
|
|
+ if (res.code=='200'){
|
|
|
+ uni.showToast({
|
|
|
+ title: toastMsg,
|
|
|
+ duration: 500
|
|
|
+ });
|
|
|
+ this.postData = {
|
|
|
+ createdBy:getUserLocalStorageInfo().userId,
|
|
|
+ status:'',
|
|
|
+ businessName:'',
|
|
|
+ type:'',
|
|
|
+ businessAddress:'',
|
|
|
+ longitude:'',
|
|
|
+ latitude:'',
|
|
|
+ businessPhone:'',
|
|
|
+ fileUrl:'',
|
|
|
+ introduction:'',
|
|
|
+ releaseType:'periphery'
|
|
|
+ }
|
|
|
+ this.active = 1
|
|
|
+ }else{
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ duration: 500
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
onChange(e){
|
|
|
|
|
@@ -190,7 +284,8 @@ export default {
|
|
|
.liInfo{
|
|
|
display: inline-block;
|
|
|
text-align: right;
|
|
|
- max-width: 428rpx;
|
|
|
+ min-width: 528rpx;
|
|
|
+ max-width: 528rpx;
|
|
|
color: rgba(102, 102, 102, 1);
|
|
|
font-size: 32rpx;
|
|
|
line-height: 38rpx;
|