123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- <template>
- <view class="content">
- <view class="box">
- <view class="item">
- <view class="item-tit">店铺名称:</view>
- <input type="text" v-model="storeName" placeholder="请输入店铺名称" />
- </view>
- <view class="item">
- <view class="item-tit">店铺简介:</view>
- <input type="text" v-model="storeinfo" placeholder="请输入店铺简介" />
- </view>
- </view>
- <view class="box">
- <view class="item">
- <view class="item-tit">姓名:</view>
- <input type="text" v-model="name" placeholder="请输入姓名" />
- </view>
- <view class="item">
- <view class="item-tit">手机号:</view>
- <input type="text" v-model="phone" placeholder="请输入手机号" />
- </view>
- <view class="item">
- <view class="item-tit">地址:</view>
- <pickerAddress class="input" @change="onCityClick">{{ addressDetail || '请选择地址' }}</pickerAddress>
- <!-- <text class="iconfont iconlocation"></text> -->
- </view>
- <view class="item">
- <view class="item-tit">详细地址:</view>
- <input type="text" v-model="detailed_address" placeholder="请输入详细地址" />
- </view>
- </view>
- <view class="sub" @click="sub" v-if="type == 'edit'">确认修改</view>
- <view class="sub" @click="add" v-if="type == 'add'">提交</view>
- </view>
- </template>
- <script>
- import { editStore } from '@/api/user.js';
- import { upload } from '@/api/order.js';
- import pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
- export default {
- components: {
- pickerAddress
- },
- data() {
- return {
- type: 'add',
- storeName: '',
- storeinfo: '',
- name: '',
- phone: '',
- addressDetail: '',
- detailed_address: '',
- address: {
- province: '',
- city: '',
- district: ''
- }
- };
- },
- onLoad(opt) {},
- methods: {
- onCityClick({ data }) {
- let address = this.address;
- address.province = data[0];
- address.city = data[1];
- address.district = data[2];
- this.addressDetail = data.join('');
- },
- //提交
- sub() {
- let obj = this;
- if (obj.storeName == '') {
- obj.$api.msg('请输入店铺姓名');
- return;
- }
- if (obj.storeinfo == '') {
- obj.$api.msg('请输入店铺简介');
- return;
- }
- if (obj.name == '') {
- obj.$api.msg('请输入姓名');
- return;
- }
- if (obj.phone == '') {
- obj.$api.msg('请输入手机号');
- return;
- }
- if (obj.addressDetail == '') {
- obj.$api.msg('请选择地址');
- return;
- }
- if (obj.detailed_address == '') {
- obj.$api.msg('请输入详细地址');
- return;
- }
- uni.showLoading({
- title: '提交中...',
- mask: true
- });
- editStore({
- shop_name: obj.storeName,
- shop_introduce: obj.storeinfo,
- name: obj.name,
- phone: obj.phone,
- province: obj.address.province,
- city: obj.address.city,
- district: obj.address.district,
- detail: obj.detailed_address,
- type: 2
- })
- .then(res => {
- uni.hideLoading();
- uni.showToast({
- title: '提交成功',
- duration: 2000
- });
- setTimeout(function() {
- uni.navigateBack();
- }, 800);
- })
- .catch(err => {
- uni.hideLoading();
- console.log(err);
- });
- },
- add() {
- let obj = this;
- if (obj.storeName == '') {
- obj.$api.msg('请输入店铺姓名');
- return;
- }
- if (obj.storeinfo == '') {
- obj.$api.msg('请输入店铺简介');
- return;
- }
- if (obj.name == '') {
- obj.$api.msg('请输入姓名');
- return;
- }
- if (obj.phone == '') {
- obj.$api.msg('请输入手机号');
- return;
- }
- if (obj.addressDetail == '') {
- obj.$api.msg('请选择地址');
- return;
- }
- if (obj.detailed_address == '') {
- obj.$api.msg('请输入详细地址');
- return;
- }
- uni.showLoading({
- title: '提交中...',
- mask: true
- });
- editStore({
- shop_name: obj.storeName,
- shop_introduce: obj.storeinfo,
- name: obj.name,
- phone: obj.phone,
- province: obj.address.province,
- city: obj.address.city,
- district: obj.address.district,
- detail: obj.detailed_address,
- type: 2
- })
- .then(res => {
- uni.hideLoading();
- uni.showToast({
- title: '提交成功',
- duration: 2000
- });
- setTimeout(function() {
- uni.navigateBack();
- }, 800);
- })
- .catch(err => {
- uni.hideLoading();
- console.log(err);
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- page {
- height: 100%;
- background-color: #f8f6f6;
- }
- .box {
- margin-top: 20rpx;
- }
- .item {
- background-color: #fff !important;
- min-height: 100rpx;
- display: flex;
- width: 690rpx;
- margin: 0 auto;
- .line {
- display: inline-block;
- line-height: 100rpx;
- }
- .item-tit {
- height: 100rpx;
- line-height: 100rpx;
- padding-left: 30rpx;
- width: 200rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- flex-shrink: 0;
- }
- input {
- width: 550rpx;
- height: 100rpx;
- line-height: 100rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #333333;
- }
- .input {
- width: 550rpx;
- height: 100rpx;
- line-height: 100rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #333333;
- }
- .up-wrapper {
- height: 352rpx;
- width: 550rpx;
- position: relative;
- image {
- position: absolute;
- height: 160rpx;
- width: 160rpx;
- top: 0;
- bottom: 0;
- left: 94rpx;
- margin: auto;
- }
- }
- }
- .sub {
- width: 100%;
- height: 88rpx;
- background: #ff4c4c;
- line-height: 88rpx;
- text-align: center;
- font-size: 36rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #ffffff;
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- }
- .picker {
- display: inline-block;
- padding-right: 40rpx;
- height: 100rpx;
- line-height: 100rpx;
- }
- .prcker-t {
- padding-left: 40rpx;
- }
- </style>
|