|
@@ -26,13 +26,8 @@
|
|
|
</u-form-item>
|
|
|
<u-form-item labelPosition="left" required label="商品分类" prop="categoryId" borderBottom ref="item1">
|
|
|
<u-radio-group v-model="form.categoryId" placement="column">
|
|
|
- <u-radio
|
|
|
- v-for="(v, i) in categoryList"
|
|
|
- :key="i"
|
|
|
- :customStyle="{ marginBottom: '8px' }"
|
|
|
- :label="v.categoryName"
|
|
|
- :name="v.categoryId"
|
|
|
- >
|
|
|
+ <u-radio v-for="(v, i) in categoryList" :key="i" :customStyle="{ marginBottom: '8px' }"
|
|
|
+ :label="v.categoryName" :name="v.categoryId">
|
|
|
</u-radio>
|
|
|
</u-radio-group>
|
|
|
</u-form-item>
|
|
@@ -50,25 +45,15 @@
|
|
|
<u--input v-model="form.num" inputAlign="right" placeholder="请输入" border="none"></u--input>
|
|
|
</u-form-item>
|
|
|
<u-form-item label="商品品牌" labelPosition="left" prop="brand" borderBottom ref="item1">
|
|
|
- <u--input
|
|
|
- v-model="form.brand"
|
|
|
- inputAlign="right"
|
|
|
- placeholder="请输入(如格力、美的)"
|
|
|
- border="none"
|
|
|
- ></u--input>
|
|
|
+ <u--input v-model="form.brand" inputAlign="right" placeholder="请输入(如格力、美的)" border="none"></u--input>
|
|
|
</u-form-item>
|
|
|
<u-form-item label="功率(W)" labelPosition="left" prop="power" borderBottom ref="item1">
|
|
|
<u--input v-model="form.power" inputAlign="right" placeholder="请输入" border="none"></u--input>
|
|
|
</u-form-item>
|
|
|
<u-form-item labelPosition="left" label="能效标识" prop="energy" borderBottom ref="item1">
|
|
|
<u-radio-group v-model="form.energy" placement="column">
|
|
|
- <u-radio
|
|
|
- v-for="(v, i) in dictList"
|
|
|
- :key="i"
|
|
|
- :customStyle="{ marginBottom: '8px' }"
|
|
|
- :label="v.dictValue"
|
|
|
- :name="v.dictValue"
|
|
|
- >
|
|
|
+ <u-radio v-for="(v, i) in dictList" :key="i" :customStyle="{ marginBottom: '8px' }" :label="v.dictValue"
|
|
|
+ :name="v.dictValue">
|
|
|
</u-radio>
|
|
|
</u-radio-group>
|
|
|
</u-form-item>
|
|
@@ -87,409 +72,403 @@
|
|
|
<u-button :disabled="disabled" @click="submin" text="发布" color="#5298ff" shape="circle"></u-button>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <u-datetime-picker
|
|
|
- @cancel="handleCancelTime"
|
|
|
- @confirm="handleConfirmTime"
|
|
|
- :show="showTime"
|
|
|
- v-model="time"
|
|
|
- mode="year-month"
|
|
|
- ></u-datetime-picker>
|
|
|
+ <u-datetime-picker @cancel="handleCancelTime" @confirm="handleConfirmTime" :show="showTime" v-model="time"
|
|
|
+ mode="year-month"></u-datetime-picker>
|
|
|
</view>
|
|
|
<!-- #endif -->
|
|
|
<!-- #ifndef H5 -->
|
|
|
<view>
|
|
|
- <web-view v-if="isShow" :src="webViewHref('/pages/issue/index', pam)" @message="crossPage.$listener"></web-view>
|
|
|
+ <web-view v-if="isShow" :src="webViewHref('/pages/issue/index', pam,crossPagePam)"
|
|
|
+ @message="crossPage.$listener"></web-view>
|
|
|
</view>
|
|
|
<!-- #endif -->
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import zjUpload from '@/components/zj-upload/index.vue'
|
|
|
-export default {
|
|
|
- // #ifndef H5
|
|
|
- data(){
|
|
|
- return {
|
|
|
- isShow:false,
|
|
|
- pam:{},
|
|
|
- init:true
|
|
|
- }
|
|
|
- },
|
|
|
+ import zjUpload from '@/components/zj-upload/index.vue'
|
|
|
+ export default {
|
|
|
+ // #ifndef H5
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ isShow: false,
|
|
|
+ pam: {},
|
|
|
+ init: true
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- onShow(){
|
|
|
- this.pam = uni.getStorageSync('issuePageParam')
|
|
|
- uni.removeStorageSync('issuePageParam');
|
|
|
+ onShow() {
|
|
|
+ this.pam = uni.getStorageSync('issuePageParam')
|
|
|
+ uni.removeStorageSync('issuePageParam');
|
|
|
+
|
|
|
+ if (this.pam.isLoad || this.init) {
|
|
|
+ this.init = false
|
|
|
+ delete this.pam.isLoad
|
|
|
+ this.isShow = false
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.isShow = true
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
- if(this.pam.isLoad || this.init){
|
|
|
- this.init=false
|
|
|
- delete this.pam.isLoad
|
|
|
- this.isShow = false
|
|
|
- this.$nextTick(()=>{
|
|
|
- this.isShow = true
|
|
|
- })
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
- // #endif
|
|
|
+ // #endif
|
|
|
|
|
|
|
|
|
- // #ifdef H5
|
|
|
- components: { zjUpload },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- disabled: false,
|
|
|
- showTime: false,
|
|
|
- show: true,
|
|
|
- form: {
|
|
|
- title: '',
|
|
|
- content: '',
|
|
|
- categoryName: '',
|
|
|
- categoryId: '',
|
|
|
- lng: '',
|
|
|
- lat: '',
|
|
|
- address: '',
|
|
|
- amount: '',
|
|
|
- num: '',
|
|
|
- brand: '',
|
|
|
- power: '',
|
|
|
- energy: '',
|
|
|
- province: '',
|
|
|
- city: '',
|
|
|
- area: '',
|
|
|
- street: '',
|
|
|
- goodsCreateTime: ''
|
|
|
- },
|
|
|
- rules: {
|
|
|
- title: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '必传',
|
|
|
- trigger: ['change', 'blur']
|
|
|
- }
|
|
|
- ],
|
|
|
- content: [
|
|
|
- {
|
|
|
+ // #ifdef H5
|
|
|
+ components: {
|
|
|
+ zjUpload
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ disabled: false,
|
|
|
+ showTime: false,
|
|
|
+ show: true,
|
|
|
+ form: {
|
|
|
+ title: '',
|
|
|
+ content: '',
|
|
|
+ categoryName: '',
|
|
|
+ categoryId: '',
|
|
|
+ lng: '',
|
|
|
+ lat: '',
|
|
|
+ address: '',
|
|
|
+ amount: '',
|
|
|
+ num: '',
|
|
|
+ brand: '',
|
|
|
+ power: '',
|
|
|
+ energy: '',
|
|
|
+ province: '',
|
|
|
+ city: '',
|
|
|
+ area: '',
|
|
|
+ street: '',
|
|
|
+ goodsCreateTime: ''
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ title: [{
|
|
|
required: true,
|
|
|
message: '必传',
|
|
|
trigger: ['change', 'blur']
|
|
|
- }
|
|
|
- ],
|
|
|
- categoryId: [
|
|
|
- {
|
|
|
+ }],
|
|
|
+ content: [{
|
|
|
required: true,
|
|
|
message: '必传',
|
|
|
trigger: ['change', 'blur']
|
|
|
- }
|
|
|
- ],
|
|
|
- address: [
|
|
|
- {
|
|
|
+ }],
|
|
|
+ categoryId: [{
|
|
|
required: true,
|
|
|
message: '必传',
|
|
|
trigger: ['change', 'blur']
|
|
|
- }
|
|
|
- ],
|
|
|
- amount: [
|
|
|
- {
|
|
|
+ }],
|
|
|
+ address: [{
|
|
|
required: true,
|
|
|
message: '必传',
|
|
|
trigger: ['change', 'blur']
|
|
|
- },
|
|
|
- {
|
|
|
- pattern: /^\d+\.?\d*$/g,
|
|
|
- // 正则检验前先将值转为字符串
|
|
|
- transform(value) {
|
|
|
- return String(value)
|
|
|
+ }],
|
|
|
+ amount: [{
|
|
|
+ required: true,
|
|
|
+ message: '必传',
|
|
|
+ trigger: ['change', 'blur']
|
|
|
},
|
|
|
- message: '格式不正确',
|
|
|
- trigger: ['change', 'blur']
|
|
|
- }
|
|
|
- ],
|
|
|
- num: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '必传',
|
|
|
- trigger: ['change', 'blur']
|
|
|
- },
|
|
|
- {
|
|
|
- pattern: /^\d+$/g,
|
|
|
- // 正则检验前先将值转为字符串
|
|
|
- transform(value) {
|
|
|
- return String(value)
|
|
|
+ {
|
|
|
+ pattern: /^\d+\.?\d*$/g,
|
|
|
+ // 正则检验前先将值转为字符串
|
|
|
+ transform(value) {
|
|
|
+ return String(value)
|
|
|
+ },
|
|
|
+ message: '格式不正确',
|
|
|
+ trigger: ['change', 'blur']
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ num: [{
|
|
|
+ required: true,
|
|
|
+ message: '必传',
|
|
|
+ trigger: ['change', 'blur']
|
|
|
},
|
|
|
- message: '格式不正确',
|
|
|
- trigger: ['change', 'blur']
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
- time: Number(new Date()),
|
|
|
- categoryList: [],
|
|
|
- dictList: [],
|
|
|
- fileList: [],
|
|
|
- fileurl: [],
|
|
|
- content: '',
|
|
|
- type: '',
|
|
|
- goodsId: ''
|
|
|
- }
|
|
|
- },
|
|
|
- onReady() {
|
|
|
- //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
|
|
|
- // this.$refs.form.setRules(this.rules)
|
|
|
- },
|
|
|
- onLoad({ type, goodsId }) {
|
|
|
- console.log(type, goodsId)
|
|
|
- this.type = type
|
|
|
- this.goodsId = goodsId
|
|
|
- if (goodsId) {
|
|
|
- this.show = false
|
|
|
- this.getDetail()
|
|
|
- }
|
|
|
- },
|
|
|
- onShow() {
|
|
|
- // const value = uni.getStorageSync('issuePageParam')
|
|
|
- // if (value) {
|
|
|
- // this.type = value.type
|
|
|
- // this.goodsId = value.goodsId
|
|
|
- // this.show = false
|
|
|
- // this.getDetail()
|
|
|
- // uni.removeStorageSync('issuePageParam');
|
|
|
- // }
|
|
|
- this.getConfig()
|
|
|
- this.getList()
|
|
|
- this.getDictList()
|
|
|
- },
|
|
|
- watch: {
|
|
|
- 'form.address': {
|
|
|
- handler(nl) {
|
|
|
- this.$refs.form.clearValidate('address')
|
|
|
+ {
|
|
|
+ pattern: /^\d+$/g,
|
|
|
+ // 正则检验前先将值转为字符串
|
|
|
+ transform(value) {
|
|
|
+ return String(value)
|
|
|
+ },
|
|
|
+ message: '格式不正确',
|
|
|
+ trigger: ['change', 'blur']
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ time: Number(new Date()),
|
|
|
+ categoryList: [],
|
|
|
+ dictList: [],
|
|
|
+ fileList: [],
|
|
|
+ fileurl: [],
|
|
|
+ content: '',
|
|
|
+ type: '',
|
|
|
+ goodsId: ''
|
|
|
}
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- //
|
|
|
- getDetail() {
|
|
|
- this.$api
|
|
|
- .postJson('/goods/detail', {
|
|
|
- id: this.goodsId
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- console.log(res)
|
|
|
- this.form = {
|
|
|
- title: res.data.title,
|
|
|
- content: res.data.content,
|
|
|
- categoryName: res.data.categoryName,
|
|
|
- categoryId: res.data.categoryId,
|
|
|
- lng: res.data.lng,
|
|
|
- lat: res.data.lat,
|
|
|
- address: res.data.address,
|
|
|
- amount: String(res.data.amount),
|
|
|
- num: String(res.data.num),
|
|
|
- brand: res.data.brand,
|
|
|
- power: res.data.power,
|
|
|
- energy: res.data.energy,
|
|
|
- province: res.data.province,
|
|
|
- city: res.data.city,
|
|
|
- area: res.data.area,
|
|
|
- street: res.data.street,
|
|
|
- goodsCreateTime: res.data.goodsCreateTime
|
|
|
- }
|
|
|
- this.fileList = res.data.goodsFiles.map(v => v.imgUrl)
|
|
|
- this.fileurl = []
|
|
|
- res.data.goodsFiles.forEach(v => {
|
|
|
- this.fileurl.push({
|
|
|
- imgUrl: v.imgUrl
|
|
|
- })
|
|
|
- })
|
|
|
- })
|
|
|
- .catch(() => {})
|
|
|
},
|
|
|
- getConfig() {
|
|
|
- this.$api
|
|
|
- .get('/app/config/detail-by-type', {
|
|
|
- configType: '4'
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- this.content = res.data.content
|
|
|
- })
|
|
|
- .catch(() => {})
|
|
|
+ onReady() {
|
|
|
+ //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
|
|
|
+ // this.$refs.form.setRules(this.rules)
|
|
|
},
|
|
|
- getFiles(value) {
|
|
|
- this.fileurl = []
|
|
|
- value.forEach(v => {
|
|
|
- this.fileurl.push({
|
|
|
- imgUrl: v
|
|
|
- })
|
|
|
- })
|
|
|
+ onLoad({
|
|
|
+ type,
|
|
|
+ goodsId
|
|
|
+ }) {
|
|
|
+ console.log(type, goodsId)
|
|
|
+ this.type = type
|
|
|
+ this.goodsId = goodsId
|
|
|
+ if (goodsId) {
|
|
|
+ this.show = false
|
|
|
+ this.getDetail()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onShow() {
|
|
|
+ // const value = uni.getStorageSync('issuePageParam')
|
|
|
+ // if (value) {
|
|
|
+ // this.type = value.type
|
|
|
+ // this.goodsId = value.goodsId
|
|
|
+ // this.show = false
|
|
|
+ // this.getDetail()
|
|
|
+ // uni.removeStorageSync('issuePageParam');
|
|
|
+ // }
|
|
|
+ this.getConfig()
|
|
|
+ this.getList()
|
|
|
+ this.getDictList()
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ 'form.address': {
|
|
|
+ handler(nl) {
|
|
|
+ this.$refs.form.clearValidate('address')
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
- submin() {
|
|
|
- this.$refs.form
|
|
|
- .validate()
|
|
|
- .then(valid => {
|
|
|
- if (valid) {
|
|
|
- this.disabled = true
|
|
|
- this.form.categoryName =
|
|
|
- this.categoryList.find(v => v.categoryId === this.form.categoryId)?.categoryName ?? ''
|
|
|
- let params = {
|
|
|
- ...this.form,
|
|
|
- goodsFiles: this.fileurl
|
|
|
+ methods: {
|
|
|
+ //
|
|
|
+ getDetail() {
|
|
|
+ this.$api
|
|
|
+ .postJson('/goods/detail', {
|
|
|
+ id: this.goodsId
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ console.log(res)
|
|
|
+ this.form = {
|
|
|
+ title: res.data.title,
|
|
|
+ content: res.data.content,
|
|
|
+ categoryName: res.data.categoryName,
|
|
|
+ categoryId: res.data.categoryId,
|
|
|
+ lng: res.data.lng,
|
|
|
+ lat: res.data.lat,
|
|
|
+ address: res.data.address,
|
|
|
+ amount: String(res.data.amount),
|
|
|
+ num: String(res.data.num),
|
|
|
+ brand: res.data.brand,
|
|
|
+ power: res.data.power,
|
|
|
+ energy: res.data.energy,
|
|
|
+ province: res.data.province,
|
|
|
+ city: res.data.city,
|
|
|
+ area: res.data.area,
|
|
|
+ street: res.data.street,
|
|
|
+ goodsCreateTime: res.data.goodsCreateTime
|
|
|
}
|
|
|
- this.$toast('正在发布中,请稍后')
|
|
|
- setTimeout(() => {
|
|
|
- let path = '/goods/add'
|
|
|
- if (this.goodsId && this.type == 1) {
|
|
|
- path = '/goods/updateUp'
|
|
|
- params.id = this.goodsId
|
|
|
- }
|
|
|
- if (this.goodsId && this.type == 2) {
|
|
|
- path = '/goods/update'
|
|
|
- params.id = this.goodsId
|
|
|
+ this.fileList = res.data.goodsFiles.map(v => v.imgUrl)
|
|
|
+ this.fileurl = []
|
|
|
+ res.data.goodsFiles.forEach(v => {
|
|
|
+ this.fileurl.push({
|
|
|
+ imgUrl: v.imgUrl
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ },
|
|
|
+ getConfig() {
|
|
|
+ this.$api
|
|
|
+ .get('/app/config/detail-by-type', {
|
|
|
+ configType: '4'
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.content = res.data.content
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ },
|
|
|
+ getFiles(value) {
|
|
|
+ this.fileurl = []
|
|
|
+ value.forEach(v => {
|
|
|
+ this.fileurl.push({
|
|
|
+ imgUrl: v
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ submin() {
|
|
|
+ this.$refs.form
|
|
|
+ .validate()
|
|
|
+ .then(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.disabled = true
|
|
|
+ this.form.categoryName =
|
|
|
+ this.categoryList.find(v => v.categoryId === this.form.categoryId)?.categoryName ?? ''
|
|
|
+ let params = {
|
|
|
+ ...this.form,
|
|
|
+ goodsFiles: this.fileurl
|
|
|
}
|
|
|
- this.$api
|
|
|
- .post(path, params)
|
|
|
- .then(res => {
|
|
|
- this.form = {
|
|
|
- title: '',
|
|
|
- content: '',
|
|
|
- categoryName: '',
|
|
|
- categoryId: '',
|
|
|
- lng: '',
|
|
|
- lat: '',
|
|
|
- address: '',
|
|
|
- amount: '',
|
|
|
- num: '',
|
|
|
- brand: '',
|
|
|
- power: '',
|
|
|
- province: '',
|
|
|
- city: '',
|
|
|
- area: '',
|
|
|
- street: '',
|
|
|
- energy: '',
|
|
|
- goodsCreateTime: ''
|
|
|
- }
|
|
|
- this.$refs.form.clearValidate()
|
|
|
- this.disabled = false
|
|
|
- this.show = true
|
|
|
- this.$navToPage(
|
|
|
- {
|
|
|
- url: '/pages/index/index'
|
|
|
- },
|
|
|
- 'switchTab'
|
|
|
- )
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
+ this.$toast('正在发布中,请稍后')
|
|
|
+ setTimeout(() => {
|
|
|
+ let path = '/goods/add'
|
|
|
+ if (this.goodsId && this.type == 1) {
|
|
|
+ path = '/goods/updateUp'
|
|
|
+ params.id = this.goodsId
|
|
|
+ }
|
|
|
+ if (this.goodsId && this.type == 2) {
|
|
|
+ path = '/goods/update'
|
|
|
+ params.id = this.goodsId
|
|
|
+ }
|
|
|
+ this.$api
|
|
|
+ .post(path, params)
|
|
|
+ .then(res => {
|
|
|
+ this.form = {
|
|
|
+ title: '',
|
|
|
+ content: '',
|
|
|
+ categoryName: '',
|
|
|
+ categoryId: '',
|
|
|
+ lng: '',
|
|
|
+ lat: '',
|
|
|
+ address: '',
|
|
|
+ amount: '',
|
|
|
+ num: '',
|
|
|
+ brand: '',
|
|
|
+ power: '',
|
|
|
+ province: '',
|
|
|
+ city: '',
|
|
|
+ area: '',
|
|
|
+ street: '',
|
|
|
+ energy: '',
|
|
|
+ goodsCreateTime: ''
|
|
|
+ }
|
|
|
+ this.$refs.form.clearValidate()
|
|
|
this.disabled = false
|
|
|
- // this.$toast(err)
|
|
|
- })
|
|
|
- }, 1000)
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- this.$toast('缺少必要参数,请检查')
|
|
|
- })
|
|
|
+ this.show = true
|
|
|
+ this.$navToPage({
|
|
|
+ url: '/pages/index/index'
|
|
|
+ },
|
|
|
+ 'switchTab'
|
|
|
+ )
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ this.disabled = false
|
|
|
+ // this.$toast(err)
|
|
|
+ })
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ this.$toast('缺少必要参数,请检查')
|
|
|
+ })
|
|
|
|
|
|
- return
|
|
|
- },
|
|
|
- //获取商品分类数据
|
|
|
- async getList() {
|
|
|
- this.$api
|
|
|
- .get('/goods/category/list')
|
|
|
- .then(res => {
|
|
|
- this.categoryList = res.data
|
|
|
- })
|
|
|
- .catch(() => {})
|
|
|
- },
|
|
|
- //获取能效数据
|
|
|
- async getDictList() {
|
|
|
- this.$api
|
|
|
- .get('/goods/dict', {
|
|
|
- dictCode: '能效'
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- this.dictList = res.data
|
|
|
+ return
|
|
|
+ },
|
|
|
+ //获取商品分类数据
|
|
|
+ async getList() {
|
|
|
+ this.$api
|
|
|
+ .get('/goods/category/list')
|
|
|
+ .then(res => {
|
|
|
+ this.categoryList = res.data
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ },
|
|
|
+ //获取能效数据
|
|
|
+ async getDictList() {
|
|
|
+ this.$api
|
|
|
+ .get('/goods/dict', {
|
|
|
+ dictCode: '能效'
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.dictList = res.data
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ },
|
|
|
+ handleDW() {
|
|
|
+ uni.chooseLocation({
|
|
|
+ success: res => {
|
|
|
+ this.form.lng = res.longitude
|
|
|
+ this.form.lat = res.latitude
|
|
|
+ this.form.address = res.address
|
|
|
+ this.$api
|
|
|
+ .post(`/lbs/amap/region/query?lng=${res.longitude}&lat=${res.latitude}`)
|
|
|
+ .then(res => {
|
|
|
+ console.log(res)
|
|
|
+ this.form.province = res.data.provinceName
|
|
|
+ this.form.city = res.data.cityName
|
|
|
+ this.form.area = res.data.areaName
|
|
|
+ this.form.street = res.data.name
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ }
|
|
|
})
|
|
|
- .catch(() => {})
|
|
|
- },
|
|
|
- handleDW() {
|
|
|
- uni.chooseLocation({
|
|
|
- success: res => {
|
|
|
- this.form.lng = res.longitude
|
|
|
- this.form.lat = res.latitude
|
|
|
- this.form.address = res.address
|
|
|
- this.$api
|
|
|
- .post(`/lbs/amap/region/query?lng=${res.longitude}&lat=${res.latitude}`)
|
|
|
- .then(res => {
|
|
|
- console.log(res)
|
|
|
- this.form.province = res.data.provinceName
|
|
|
- this.form.city = res.data.cityName
|
|
|
- this.form.area = res.data.areaName
|
|
|
- this.form.street = res.data.name
|
|
|
- })
|
|
|
- .catch(() => {})
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- handleConfirmTime(value) {
|
|
|
- const date = new Date(value.value) // JavaScript的Date对象使用的是毫秒时间戳,因此需要将Unix时间戳乘以1000
|
|
|
- const year = date.getFullYear()
|
|
|
- const month = String(date.getMonth() + 1).padStart(2, '0') // getMonth()返回的月份是从0开始的,因此需要加1,然后使用padStart()添加前导零
|
|
|
- const day = String(date.getDate()).padStart(2, '0')
|
|
|
- const hours = String(date.getHours()).padStart(2, '0')
|
|
|
- const minutes = String(date.getMinutes()).padStart(2, '0')
|
|
|
- const seconds = String(date.getSeconds()).padStart(2, '0')
|
|
|
+ },
|
|
|
+ handleConfirmTime(value) {
|
|
|
+ const date = new Date(value.value) // JavaScript的Date对象使用的是毫秒时间戳,因此需要将Unix时间戳乘以1000
|
|
|
+ const year = date.getFullYear()
|
|
|
+ const month = String(date.getMonth() + 1).padStart(2, '0') // getMonth()返回的月份是从0开始的,因此需要加1,然后使用padStart()添加前导零
|
|
|
+ const day = String(date.getDate()).padStart(2, '0')
|
|
|
+ const hours = String(date.getHours()).padStart(2, '0')
|
|
|
+ const minutes = String(date.getMinutes()).padStart(2, '0')
|
|
|
+ const seconds = String(date.getSeconds()).padStart(2, '0')
|
|
|
|
|
|
- let res = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
|
|
- let res2 = `${year}-${month}`
|
|
|
- this.form.goodsCreateTime = res
|
|
|
- this.time = res2
|
|
|
- this.showTime = false
|
|
|
- },
|
|
|
- handleCancelTime() {
|
|
|
- this.showTime = false
|
|
|
- },
|
|
|
- handleTime() {
|
|
|
- this.showTime = true
|
|
|
- },
|
|
|
- handleAgree() {
|
|
|
- this.show = false
|
|
|
+ let res = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
|
|
+ let res2 = `${year}-${month}`
|
|
|
+ this.form.goodsCreateTime = res
|
|
|
+ this.time = res2
|
|
|
+ this.showTime = false
|
|
|
+ },
|
|
|
+ handleCancelTime() {
|
|
|
+ this.showTime = false
|
|
|
+ },
|
|
|
+ handleTime() {
|
|
|
+ this.showTime = true
|
|
|
+ },
|
|
|
+ handleAgree() {
|
|
|
+ this.show = false
|
|
|
+ }
|
|
|
}
|
|
|
+ // #endif
|
|
|
}
|
|
|
- // #endif
|
|
|
-}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.contentXZ {
|
|
|
- padding: 20px;
|
|
|
-}
|
|
|
-.pop {
|
|
|
- overflow: auto;
|
|
|
- // padding: 0 20rpx;
|
|
|
- /* #ifdef H5 */
|
|
|
- // height: calc(100vh - 44px);
|
|
|
- height: 100vh;
|
|
|
- /* #endif */
|
|
|
- /* #ifndef H5 */
|
|
|
- height: 100vh;
|
|
|
- /* #endif */
|
|
|
-}
|
|
|
+ .contentXZ {
|
|
|
+ padding: 20px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .pop {
|
|
|
+ overflow: auto;
|
|
|
+ // padding: 0 20rpx;
|
|
|
+ /* #ifdef H5 */
|
|
|
+ // height: calc(100vh - 44px);
|
|
|
+ height: 100vh;
|
|
|
+ /* #endif */
|
|
|
+ /* #ifndef H5 */
|
|
|
+ height: 100vh;
|
|
|
+ /* #endif */
|
|
|
+ }
|
|
|
+
|
|
|
+ .content {
|
|
|
+ padding: 0 40rpx;
|
|
|
+ margin: 20rpx 0;
|
|
|
+ // height: calc(100vh - 44px);
|
|
|
+ background-color: #fff;
|
|
|
+ }
|
|
|
|
|
|
-.content {
|
|
|
- padding: 0 40rpx;
|
|
|
- margin: 20rpx 0;
|
|
|
- // height: calc(100vh - 44px);
|
|
|
- background-color: #fff;
|
|
|
-}
|
|
|
-.bottom-container {
|
|
|
- position: fixed;
|
|
|
- bottom: 0;
|
|
|
- width: 100%;
|
|
|
- background-color: #f1f1f1;
|
|
|
- padding: 18px 0;
|
|
|
-}
|
|
|
-.letText {
|
|
|
- width: 100%;
|
|
|
- display: flex;
|
|
|
- justify-content: flex-end;
|
|
|
-}
|
|
|
-::v-deep .u-radio-label--undefined {
|
|
|
- justify-content: flex-end;
|
|
|
-}
|
|
|
-</style>
|
|
|
+ .bottom-container {
|
|
|
+ position: fixed;
|
|
|
+ bottom: 0;
|
|
|
+ width: 100%;
|
|
|
+ background-color: #f1f1f1;
|
|
|
+ padding: 18px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .letText {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ }
|
|
|
+
|
|
|
+ ::v-deep .u-radio-label--undefined {
|
|
|
+ justify-content: flex-end;
|
|
|
+ }
|
|
|
+</style>
|