| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445 |
- <template>
- <view class="contentV">
- <customNav :shownav="true" :title="$t('index.shouhuodz')" titledetl=""></customNav>
- <view class="topaddrCTV bottomline">
- <view class="contentInRowS" @click="selectDizhi">
- <view class="contentColumn">
- <text class="areaT textfontB4">{{area}}</text>
- <text class="addressT textfontB5">{{xingzhengqw}}</text>
- </view>
- <image class="slot-image" src="/static/images/dizhil@3x.png" mode="widthFix"></image>
- </view>
- </view>
- <text class="linesp"></text>
- <view class="inputctV">
- <text>{{$t('index.xiangxidz')}}</text>
- <input class="inputV" type="text" :disabled="jinzhishur" :value="address" :placeholder="$t('index.qsrxiangxidz')" @input="addressinput">
- </view>
- <text class="linesp"></text>
- <view class="inputctV">
- <text>{{$t('index.lianxiren')}}</text>
- <view class="ctinrow">
- <input class="inputV" type="text" :disabled="jinzhishur" :value="name" :placeholder="$t('index.qsrlianxiren')" @input="nameinput">
- <!-- <radio-group @change="radioChange">
- <radio value="y" />
- {{$t('index.xiansheng')}}
- <radio value="x"/>
- {{$t('index.nvshi')}}
- </radio-group> -->
- </view>
-
- </view>
- <text class="linesp"></text>
- <view class="inputctV">
- <text>{{$t('order.lianxidianhua')}}</text>
- <view class="ctinrow">
- <!-- <view class="xialakuang" @click="popgjm">
- <text>{{guojiadaima}}</text>
- <image style="width: 36rpx;height: 36rpx;padding-right: 16rpx;" src="/static/images/xiala@3x.png" mode="scaleToFill"></image>
- </view> -->
- <input class="inputphone" type="number" :disabled="jinzhishur" :value="phone" :placeholder="$t('index.shoujihao')" @input="phoneinput">
- </view>
-
- </view>
- <view class="contentInRowL" style="margin-left: 5%;margin-top: 50rpx;">
- <text>{{$t('order.menpaizp')}}</text>
- </view>
- <view class="contentColumnC" style="margin-top: 30rpx;">
- <yhdslCropper ref="yhdslCropper" :quality="1" mode="scale" @uploadImg="uploadImg" :scale="scale"></yhdslCropper>
- <image class="imagV" :src="baseUrl+mpImage" mode="scaleToFill" @click="selectImage"></image>
- </view>
- <view class="contentColumnC" style="margin-top: 50rpx;">
- <text class="savebt" @click="updataAddr">{{$t('index.tijiao')}}</text>
- <text v-if="id>=0" class="delbt" @click="deleteAddr">{{$t('index.sanchu')}}</text>
- </view>
- <view style="height: 60rpx;"></view>
- <popViewGG :tips="$t('index.gjqhxz')" :show="showpop" :acttips="$t('order.queding')" :maskClosable="true" :isCancel="true" @chooseCancel="chooseCancel">
- <picker-view :indicator-style="indicatorStyle" :value="pvalue" @change="bindChange" class="picker-view">
- <picker-view-column>
- <view class="item" v-for="(item,index) in range" :key="index">{{item}}</view>
- </picker-view-column>
- </picker-view>
- </popViewGG>
- </view>
- </template>
- <script>
- import yhdslCropper from '@/components/yhdsl-cropper/yhdsl-cropper.vue';
- import api from "@/pages/api/api.js"
- export default {
- components: {
- yhdslCropper
- },
- data() {
- return {
- pvalue: [0],
- indicatorStyle: `height: 50px;`,
- range: ["+86","+84","+886"],
- showpop:false,
- guojiadaima:'+86',
- latitude: 0,
- longitude: 0,
- country:'',
- province:'',
- city: "",
- area: '',
- address: "",
- phone:'',
- name:'',
- annexes:'',
- id:-1,
- xingzhengqw:this.$t('mend.qingxzdz'),
- jinzhishur:false,
- scale:1,
- baseUrl:this.$baseImagurl,
- mpImage:''
- }
- },
- onLoad(option) {
- this.id = option.id;
- if(this.id>=0){
- this.getaddressxq(this.id);
- }
- },
- onShow() {
- this.gettempLocate();
- if(this.latitude==0||this.longitude==0){
- this.jinzhishur=true;
- }
- else{
- this.jinzhishur=false;
- }
- },
- methods: {
- radioChange(e){
- console.log(e.detail.value)
- },
- bindChange (e) {
- var val = e.detail.value[0];
- this.guojiadaima=this.range[val];
- },
- popgjm(){
- this.showpop=true;
- },
- chooseCancel(){
- this.showpop=false;
- },
- addressinput(event){
- this.address = event.target.value;
- },
- nameinput(event){
- this.name = event.target.value;
- },
- phoneinput(event){
- this.phone = event.target.value;
- },
- selectDizhi(){
- // uni.navigateTo({
- // url:'/pages/UserCenter/map/mapN?state=2'
- // })
- uni.navigateTo({
- url:'/pages/UserCenter/map/Chazhaodizhi'
- })
- },
- gettempLocate(){
- try {//读取
- var data = uni.getStorageSync("tempLocation");
- if(''==data || undefined==data || null==data){
- return;
- }
- else{
- this.latitude=data.latitude;
- this.longitude=data.longitude;
- this.address=data.address;
- this.xingzhengqw=data.address;
- this.area=data.name;
- uni.setStorageSync('userAddrLocation',"");
- uni.setStorageSync('tempLocation',"");
- return;
- }
- } catch(e){//错误
- return;
- }
- },
- selectImage(){
- this.$refs.yhdslCropper.chooseImage();
- },
- uploadImg(e) {
- console.log('------------uploadImg:',e)
- this.spImage = e;
- var that = this;
- uni.uploadFile({
- url: this.$upImagurl, //上传图片api
- filePath: e,
- name: 'file',
- header:{
- //"Authorization": userinfo.token
- },
- success: (res) => {
- let group = JSON.parse(res.data);
- that.mpImage=group.data;
- console.log(group)
- uni.showToast({
- title:that.$t('mend.shangccg'),
- icon:"success"
- })
- }
- });
- },
- getaddressxq(id){
-
- api('getaddressxq',{
- id: id
- },r=>{
- console.log('getaddressxq:',r);
- this.latitude=r.data.data.latitude;
- this.longitude=r.data.data.longitude;
- this.address=r.data.data.address;
- this.xingzhengqw=r.data.data.address;
- this.phone=r.data.data.phone;
- this.area=r.data.data.area;
- this.name=r.data.data.name;
- this.mpImage=r.data.data.annexes;
- this.jinzhishur=false;
- },failc=>{
- //console.log('getadvertis----',failc)
- })
- },
-
- updataAddr(){
- if(this.address.length<1){
- uni.showToast({
- title:this.$t('index.qsrxiangxidz'),
- icon:"none"
- })
- return;
- }
-
- if(this.name.length<1){
- uni.showToast({
- title:this.$t('index.qsrlianxiren'),
- icon:"none"
- })
- return;
- }
-
- if(this.phone.length<1){
- uni.showToast({
- title:this.$t('index.shoujihao'),
- icon:"none"
- })
- return;
- }
-
- this.postaddress();
- },
- deleteAddr(){
- if(this.id<0){
- console.log('未提交的新地址');
- }
- else{
- var that = this;
- uni.showModal({
- cancelText:that.$t('order.quxiao'),
- confirmText:that.$t('comp.queren'),
- title: that.$t('api.message'),
- content:that.$t('index.shanchuAddr'),
- success: function (res) {
- if (res.confirm) { //这里是点击了确定以后
- that.deleaddress();
- } else { //这里是点击了取消以后
- console.log('点击取消')
- }
- }
- })
- }
- },
-
- deleaddress(){
-
- api('deleaddress',{
- id:this.id
- },res=>{
- console.log('deleaddress:',res);
- uni.navigateBack();
- },failc=>{
- //console.log('getadvertis----',failc)
- })
- },
-
- postaddress(){
- var addr;
- if(this.id<0){
- addr={
- name:this.name,
- phone:this.phone,
- address: this.address,
- longitude:this.longitude,
- latitude: this.latitude,
- country:'',
- province:'',
- city:'',
- area:this.area,
- annexes:this.mpImage
- }
- }
- else{
- addr={
- id:this.id,
- name:this.name,
- phone:this.phone,
- address: this.address,
- longitude:this.longitude,
- latitude: this.latitude,
- country:'',
- province:'',
- city:'',
- area:this.area,
- annexes:this.mpImage
- }
- }
- console.log('addr:',addr);
-
- api('ADDaddress',addr,
- res=>{
- console.log('getGoodsDetail:',res);
- uni.navigateBack();
- },failc=>{
- //console.log('getadvertis----',failc)
- })
- },
-
- }
- }
- </script>
- <style>
- .contentV{
- width: 100%;
- position: relative;
- height: 94vh;
- }
- .linesp{
- width: 100%;
- height: 8rpx;
- background-color: aliceblue;
- }
- .topaddrCTV{
- margin-top: 60rpx;
- padding-bottom: 20rpx;
- width: 90%;
- margin-left: 5%;
- }
- .bottomline{
- border: solid lightgray;
- border-width: 0px 0px 2rpx 0px;
- }
- .areaT{
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- .addressT{
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- .slot-image {
- /* #ifndef APP-NVUE */
- display: block;
- /* #endif */
- margin-right: 10px;
- width: 30px;
- height: 30px;
- }
- .xialakuang{
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content:space-between;
- padding-left: 10rpx;
- width: 140rpx;
- height: 60rpx;
- margin-right: 20rpx;
- border-radius: 10rpx;
- border: 2rpx solid darkgray;
- }
- .inputctV{
- width: 90%;
- height: 120rpx;
- margin-left: 5%;
- margin-top: 30rpx;
- }
- .ctinrow{
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: left;
- }
- .inputV{
- margin-top: 8rpx;
- width: 100%;
- height: 60rpx;
- font-size: 28rpx;
- border-radius: 8rpx;
- border: 2rpx solid darkgray;
-
- }
- .inputphone{
- margin-top: 8rpx;
- width: 100%;
- height: 60rpx;
- font-size: 28rpx;
- border-radius: 8rpx;
- border: 2rpx solid darkgray;
-
- }
- .savebt{
- text-align: center;
- font-size: 36rpx;
- width: 80%;
- height: 80rpx;
- line-height: 80rpx;
- color: white;
- background-color: green;
- border-radius: 10rpx;
- }
- .delbt{
- margin-top: 50rpx;
- text-align: center;
- font-size: 36rpx;
- width: 80%;
- height: 80rpx;
- line-height: 80rpx;
- color: white;
- background-color: darkgray;
- border-radius: 10rpx;
- }
- .imagV{
- width: 640rpx;
- height: 640rpx;
- background-color: antiquewhite;
- }
- .picker-view {
- width: 750rpx;
- height: 300rpx;
- margin-top: 10rpx;
- }
- .item {
- line-height: 100rpx;
- text-align: center;
- }
- </style>
|