| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164 |
- <template>
- <view class="contentV">
- <customNav :shownav="true" :title="$t('index.xiadanzhifu')" titledetl=""></customNav>
-
- <view class="ctinrow">
- <view class="topSwichV" :style="{backgroundColor:Bcolor}" @click="peisong">
- <view class="topSwichV">
- <image class="toppz" :src="peisongimg" mode="widthFix"></image>
- <text class="toppztext" :style="{color:Tcolor}">{{$t('order.peisong')}}</text>
- </view>
- </view>
- <view class="topSwichVL" :style="{backgroundColor:Bcolorr}" @click="ziqu">
- <view class="topSwichVL">
- <image class="toppz" :src="ziquimg" mode="widthFix"></image>
- <text class="toppztext" :style="{color:Tcolorr}">{{$t('order.ziqu')}}</text>
- </view>
- </view>
- <!-- <view class="topSwichVL" :style="{backgroundColor:Bcolorrr}" @click="tangshi">
- <view class="topSwichVL">
- <image class="toppz" :src="tangshiimg" mode="widthFix"></image>
- <text class="toppztext" :style="{color:Tcolorrr}">{{$t('shouye.tangshi')}}</text>
- </view>
- </view> -->
- </view>
- <label class="linesp"></label>
- <uni-list v-if="showAdrr==0">
- <uni-list-item :title="dizhiID.address" :note="dizhiID.phone" :rightText="dizhiID.name" thumb="/static/images/dizhil@3x.png"
- thumb-size="sm" @click="changaddr" link></uni-list-item>
- </uni-list>
- <uni-list>
- <uni-list-item :title="delryTime.length>0?$t('order.yuyueshijian'):$t('order.jinkuaisd')" :note="delryTime.length>0?delryTime:('10~20 '+$t('order.Xfenzhongsd'))" :rightText="$t('order.yuyueshijian')" thumb="/static/images/time@3x.png"
- thumb-size="sm" @click="yuyueshijian" link></uni-list-item>
- </uni-list>
- <label class="linesp"></label>
- <label class="linesp"></label>
- <uni-list>
- <uni-list-item :title="$t('index.goodslist')"></uni-list-item>
- </uni-list>
-
- <view v-for="(items,indexs) in gouwuche">
- <view class="contentInRowL">
- <netImage style="margin-left: 12rpx;margin-top: 10rpx;" width="60" height="60" bradius="30" :mysrc="items.logo" mymode="scaleToFill"></netImage>
- <text>{{items.posName}}</text>
- </view>
- <view v-for="(item,findex) in items.food">
- <view class="spnodetail">
- <view class="">
- <myImage class="spIcon" :mysrc="item.image" mymode="scaleToFill"></myImage>
- </view>
- <view style="width: 82%;">
- <view class="actBTV">
- <view style="font-size: 30rpx;width: 100%;">
- <text class="text2row" style="width: 100%;">{{item.name}}</text>
- </view>
- <view class="contentInRowL">
- <image v-if="item.number>0" class="imageRJ" src="/static/meishi/jianh.png" mode="aspectFit" @click="jiajian(findex,-1)"></image>
- <text v-if="item.number>0" class="textR">{{item.number}}</text>
- <image class="imageR" src="/static/meishi/jiah.png" mode="aspectFit" @click="jiajian(findex,1)"></image>
- </view>
- </view>
- <view class="actBTV">
- <view style="font-size: 26rpx;color: blueviolet;">{{$t('shangpin.shoujia')}}: {{$formPr(item.price+item.otherPrice)}}{{$t('locale.huobidw')}}</view>
- <view class="xiaoji" style="font-size: 28rpx;color: brown;">{{$t('shangpin.xiaoji')}}: {{$formPr((item.price+item.otherPrice)*item.number)}}{{$t('locale.huobidw')}}</view>
- </view>
- <view class="viewinrow" >
- <text class="kouweisku">{{arraytoStr(item.ask)}}</text>
- </view>
- <view v-if="item.beizhu" class="">
- <text style="font-size: 30rpx;color:#00A6FF;">{{item.beizhu}}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
-
-
-
- <!-- <label class="linesp"></label>
- <label class="linesp"></label>
- <uni-list style="color: darkgreen;">
- <uni-list-item :title="$t('index.hongbaokq')" :note="yhhd" thumb="/static/images/hongbkqh@3x.png"
- thumb-size="sm" @click="xuanzcux" link></uni-list-item>
- </uni-list> -->
- <label class="linesp"></label>
- <label class="linesp"></label>
-
- <view class="contentInRowS shifdf" @click="shifodaofu">
- <view class="contentInRowC">
- <image style="width: 50rpx;height: 50rpx;" src="/static/images/payflact@3x.png" mode="scaleToFill"></image>
- <text class="shifdftext" :style="shifoudf==0?'color:darkgray;':'color:fuchsia;'">{{$t('index.huodaofukan')}}</text>
- </view>
- <image v-if="shifoudf==1" style="width: 50rpx;height: 50rpx;" src="/static/images/dagoul.png" mode="scaleToFill"></image>
- </view>
- <label class="linesp"></label>
- <label class="linesp"></label>
- <uni-list>
- <uni-list-item :title="$t('order.beizhu')"></uni-list-item>
- </uni-list>
- <textarea class="pinglun" :placeholder="$t('order.srddbz')" :value="remarks" @input="sumfontnum"></textarea>
- <label class="linesp"></label>
- <label class="linesp"></label>
- <view v-if="showAdrr==0">
- <uni-list>
- <uni-list-item :title="$t('order.menpaizp')"></uni-list-item>
- </uni-list>
- <view class="contentColumnC" style="margin-top: 30rpx;" @click="selectImage">
- <netImage width="640" height="640" :mysrc="mpImage" mymode="scaleToFill" ></netImage>
- </view>
- <view class="linesp" style="margin-top: 20rpx;"></view>
- <label class="linesp"></label>
- </view>
-
- <uni-list>
- <uni-list-item :title="$t('order.shangpinxj')" :rightText="$formPr(spxj)+$t('locale.huobidw')" />
- <uni-list-item :title="$t('order.peisongfei')" :rightText="$formPr(psf)+$t('locale.huobidw')"/>
- <uni-list-item :title="$t('order.youhuijine')" :rightText="$formPr(hyyh)+$t('locale.huobidw')"/>
- </uni-list>
- <label class="linesp"></label>
- <label class="linesp"></label>
- <uni-list>
- <uni-list-item :title="$t('order.zhifujine')" :rightText="$formPr(zje)+$t('locale.huobidw')"/>
- </uni-list>
- <label class="linesp"></label>
- <label class="linesp"></label>
- <view class="delbtct">
- <view class="delbt" @click="qufukuan">
- <label >{{actTitle}}</label>
- </view>
- </view>
-
- <label class="linesp"></label>
- <liu-delivery-time @change="changeTime" @close="deliveryclose" ref="chooseTime" :title="$t('order.yuyueshijian')"></liu-delivery-time>
- <yhdslCropper ref="yhdslCropper" :quality="1" mode="scale" @uploadImg="uploadImg" :scale="scale"></yhdslCropper>
- <popViewGG :tips="$t('index.hongbaokq')" :show="showpop" :acttips="$t('order.queding')" :maskClosable="true" :isCancel="true" @chooseCancel="chooseCancel">
- <picker-view :indicator-style="indicatorStyle" @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>
- <popViewGG :tips="$t('order.zhifufangshi')" :show="zffsS" :showbotom="false" :maskClosable="true" :isCancel="true" @chooseCancel="chooseCancel">
- <view class="contentColumnC" style="width: 100%;background-color: whitesmoke;">
- <view class="zhifbut" style="background-color: deeppink;" @click="huodaofukuan">{{$t('index.huodaofukan')}}</view>
- <!-- <view class="zhifbut" style="background-color:#00A6FF;" @click="getVNPay">VNPAY</view> -->
- </view>
- </popViewGG>
- </view>
- </template>
- <script>
- // import uniList from '@/uni_modules/uni-list/uni-list.vue';
- // import uniListItem from '@/uni_modules/uni-list-item/uni-list-item.vue';
- // import uniAd from '@/uni_modules/uni-list-ad/uni-list-ad.vue';
- // import uniChat from '@/uni_modules/uni-list-chat/uni-list-chat.vue';
- import yhdslCropper from '@/components/yhdsl-cropper/yhdsl-cropper.vue';
- import api from "@/pages/api/api.js"
- export default {
- components:{
- yhdslCropper//,uniList,uniListItem
- },
- data() {
- return {
- mendid:0,
- userid:0,
- ddId:'',
- rId:'',
- showAdrr:0,
- gouwuche:[],
- Bcolor:'whitesmoke',
- Bcolorr:'lightgray',
- Bcolorrr:'lightgray',
- Tcolor:'black',
- Tcolorr:'darkgray',
- Tcolorrr:'darkgray',
- peisongimg:'/static/images/peisongh@3x.png',
- ziquimg:'/static/images/ziqu@3x.png',
- tangshiimg:'/static/images/tangshih.png',
- actTitle:this.$t('order.querendd'),
- actType:0,
- remarks:'',
- spxj:0.00,
- psf:0.00,
- freight:0.00,
- hyyh:0.00,
- zje:0.00,
- jvli:0.00,
- dizhiID:'',
- addrList:[],
- peisongdizhiaddress:'',
- peisongdizhiname:'',
- peisongdizhiphone:'',
- zfindex:0,
- delryTime:'',
- isGetyunfei:false,
- mendianMs:'',
- cid:'',
- orderDetl:'',
- shifouzhifu:false,
- zhifuUrl:'',
- shifoudf:0,
- scale:1,
- baseUrl:this.$baseImagurl,
- mpImage:'',
- cxList:'',
- yhhd:'',
- range: [],
- youhuiindex:-1,
- showpop:false,
- indicatorStyle: 'height: 50px;',
- zffsS:false,
- keyixd:true
- }
- },
- onLoad(option) {
-
- var gwc = uni.getStorageSync('gouwuche');
- if(''==gwc||null==gwc||undefined==gwc){
- this.gouwuche=[];
- return
- }
- else{
- this.gouwuche = JSON.parse(gwc);
- }
-
- this.mendid=option.mendid;
- this.userid=option.userid;
- this.cuxiaoList();
- this.cid = uni.getStorageSync("cid");
- //console.log(this.cid);
-
- },
- onShow() {
- var temp=uni.getStorageSync("peisongdizhi");
- if(undefined==temp||null==temp||''==temp ){
- this.dizhiID='';
- this.getaddressList();
- }
- else{
- this.dizhiID= temp;
- this.mpImage=this.dizhiID.annexes;
- }
- this.isGetyunfei = false;
- if(this.mendianMs==''){
- this.getmendianDetail(this.mendid);
- }
- else{
- if(this.dizhiID==''){
- this.getaddressList();
- }
- else{
- console.log('4444')
- this.getyunfei(this.dizhiID.latitude,this.dizhiID.longitude);
- }
- }
- //this.getorderDetl();
-
- if(this.shifouzhifu){
- this.shifouzhifu=false;
- this.getorderDetl();
- }
- },
- methods: {
- //促销
- cuxiaoList(){
- var price=0;
- for(var i=0;i<this.foodlist.length;i++){
- price=price+(this.foodlist[i].price+this.foodlist[i].otherPrice)*this.foodlist[i].number;
- }
- api('cuxiaoList',{
- mdId:this.mendid,
- price:price
- },r=>{
- console.log('-----------',r)
- if(r.data.code==200){
- this.cxList=r.data.data;
- this.range=[];
- if(this.cxList.length>0){
- this.yhhd=this.$t('order.qingxzyhkq');
- for(var i=0;i<this.cxList.length;i++){
- var obj=this.cxList[i];
- this.range.push(obj.salesName);
- }
- }
- else{
- this.yhhd=this.$t('order.zanwuyhkq');
- }
- }
- this.jisuanjiner();
- },failc=>{
- //console.log('getadvertis----',failc)
- })
- },
-
- jiajian(index,state){
- if(this.actType>0){
- return;
- }
- var tempList = this.foodlist;
- if(state>0){
- var temp = tempList[index];
- temp.number=temp.number+1;
- tempList[index]=temp;
- }
- else{
- var temp = tempList[index];
- if(temp.number>1){
- temp.number=temp.number-1;
- tempList[index]=temp;
- }
- else{
- tempList.splice(index,1);
- }
- }
- this.foodlist=tempList;
- this.cuxiaoList();
- if(this.foodlist.length==0){
- uni.showToast({
- title: that.$t('comp.qingxzsp'),
- icon: 'none',
- duration: 2500
- })
- }
- },
-
- xuanzcux(){
- if(this.youhuiindex<0&&this.cxList.length>0){
- this.youhuiindex=0;
- this.yhhd=this.cxList[this.youhuiindex].salesName;
- this.jisuanjiner();
- }
- this.showpop=true;
- },
- bindChange (e) {
- var val = e.detail.value[0];
- this.youhuiindex=val;
- this.yhhd=this.cxList[this.youhuiindex].salesName;
- console.log(val)
- this.jisuanjiner();
- },
- chooseCancel(){
- this.showpop=false;
- this.zffsS=false;
- console.log('chooseCancel');
- },
- //--------------------------------------------------------
-
- arraytoStr(arry){
- var str='';
- if(arry.length>0){
- for(var i=0;i<arry.length;i++){
- str=str+arry[i]+'; ';
- }
-
- }
- return str;
- },
- jisuanjiner(){
- this.spxj=0;
- this.hyyh=0;
- this.zje=0;
- for(var i=0;i<this.foodlist.length;i++){
- this.spxj=this.spxj+(this.foodlist[i].price+this.foodlist[i].otherPrice)*this.foodlist[i].number;
- }
- this.hyyh=this.jisuanyouhuijiner(this.spxj);
- this.hyyh=parseInt(this.hyyh);
- this.zje=(this.spxj+this.psf)-this.hyyh;
- this.zje=parseInt(this.zje);
- },
- jisuanyouhuijiner(price){
- var zongyouhui=0;
- if(this.cxList.length>0&&this.youhuiindex>=0){
- var obj=this.cxList[this.youhuiindex];
- if(obj.salesType=="0"){
- zongyouhui=zongyouhui+this.psf;
- if(obj.salesReduction<1){
- zongyouhui=this.psf*(100-obj.salesReduction*100)/100;
- }
- else if(obj.salesReduction>1){
- if(obj.salesReduction>this.psf){
- zongyouhui=this.psf;
- }
- else{
- zongyouhui=obj.salesReduction;
- }
- }
- }
- if(obj.salesType=="1"){
- zongyouhui=zongyouhui+price*(100-obj.salesReduction*100)/100;
- console.log(price,obj.salesReduction,price*(1-obj.salesReduction))
- }
- if(obj.salesType=="2"){
- zongyouhui=zongyouhui+obj.salesReduction;
- }
- }
- return zongyouhui;
- },
- sumfontnum(e){
- this.remarks=e.target.value;
- },
- shifodaofu(){
- if(this.actType>1){
- return;
- }
- if(this.shifoudf==0){
- this.shifoudf=1;
- }
- else{
- this.shifoudf=0;
- }
- if(this.actType==1&&this.shifoudf==1){
- this.actTitle = this.$t('index.huodaofukan');
- uni.showToast({
- title: this.$t('order.xuanzezhif'),
- icon: 'none',
- duration: 2500
- })
- }
- else if(this.actType==1&&this.shifoudf==0){
- this.actTitle = this.$t('order.quzhifu');
- }
- console.log(this.shifoudf)
- },
- changaddr(){
- uni.navigateTo({
- url:'/pages/UserCenter/dizhi/dizhilist'
- })
- },
- yuyueshijian(){
- this.$refs.chooseTime.open()
- },
- changeTime(e) {
- //选择的时间
- console.log('选择的时间',e.value);
- this.delryTime = e.value;
- },
- deliveryclose(){
- this.delryTime='';
- },
- peisong(){
- if(this.actType>0){
- return;
- }
- this.showAdrr=0;
- this.peisongimg='/static/images/peisongh@3x.png';
- this.ziquimg='/static/images/ziqu@3x.png';
- this.tangshiimg='/static/images/tangshih.png';
- this.Bcolor='whitesmoke';
- this.Bcolorr='lightgray';
- this.Bcolorrr='lightgray';
- this.Tcolor='black';
- this.Tcolorr='darkgray';
- this.Tcolorrr='darkgray';
- this.psf=parseFloat(this.freight);
-
- this.jisuanjiner();
- },
- ziqu(){
- if(this.actType>0){
- return;
- }
- this.showAdrr=1;
- this.peisongimg='/static/images/peisong@3x.png';
- this.ziquimg='/static/images/ziquh@3x.png';
- this.tangshiimg='/static/images/tangshih.png';
- this.Bcolor='lightgray';
- this.Bcolorr='whitesmoke';
- this.Bcolorrr='lightgray';
- this.Tcolor='darkgray';
- this.Tcolorr='black';
- this.Tcolorrr='darkgray';
- this.psf=0;
- this.jisuanjiner();
- },
- tangshi(){
- this.showAdrr=2;
- this.peisongimg='/static/images/peisong@3x.png';
- this.ziquimg='/static/images/ziqu@3x.png';
- this.tangshiimg='/static/images/tangshi.png';
- this.Bcolor='lightgray';
- this.Bcolorr='lightgray';
- this.Bcolorrr='whitesmoke';
- this.Tcolor='darkgray';
- this.Tcolorr='darkgray';
- this.Tcolorrr='black';
- this.psf=0;
- this.jisuanjiner();
- },
- qufukuan(){
- if(this.foodlist.length==0){
- uni.showToast({
- title: that.$t('comp.qingxzsp'),
- icon: 'none',
- duration: 2500
- })
- return;
- }
- if(this.keyixd==false){
- uni.showToast({
- title: this.$t('mend.dianjiastatedy'),
- icon: 'none',
- duration: 2500
- })
- return;
- }
- if(this.actType==2){//已经支付过了!!
- // uni.showToast({
- // title: '已经支付过了!!',
- // icon: 'none',
- // duration: 2500
- // })
- return;
- }
- if(this.actType==1){//未支付,跳转支付
- this.zffsS=true;
- return;
- }
- var data;
- if(this.ddId.length>0){
- console.log('已经生成订单,不能重复提交');
- }
- else{
- this.ddId='99'+ new Date().valueOf();
- }
- var yhid='';
- if(this.cxList.length>0&&this.youhuiindex>=0){
- var obj=this.cxList[this.youhuiindex];
- yhid=obj.id;
- }
- var cretim=getApp().globalData.sj();
- // console.log(cretim);
- // return;
- if(this.showAdrr==0){
- if(this.dizhiID==''){
- uni.showToast({
- title: this.$t('order.shdz'),
- icon: 'none',
- duration: 3500
- })
- return;
- }
- if(!this.isGetyunfei){
- uni.showToast({
- title: this.$t('order.hqyfsb'),
- icon: 'none',
- duration: 3500
- })
- return;
- }
-
- data={
- "ddId": this.ddId,
- "shId": this.userid,
- "mdId": this.mendid,
- "activity":yhid,
- "shdzId": this.dizhiID.id,
- "amount":this.zje,
- "discountAmount":this.hyyh,
- "remarks": this.remarks,
- "type": 0,
- "delryTime": this.delryTime,//new Date().toISOString(),
- "foodlist": this.foodlist,
- "freight": this.psf,
- "jvli": this.jvli,
- "longitude": this.mendianMs.longitude,
- "latitude":this.mendianMs.latitude,
- "collectPayment":this.shifoudf,
- "cretim":cretim
- }
- }
- else{
- data={
- "ddId": this.ddId,
- "shId": this.userid,
- "mdId": this.mendid,
- "activity":yhid,
- "shdzId": '',
- "amount":this.zje,
- "discountAmount":this.hyyh,
- "remarks": this.remarks,
- "type": this.showAdrr,
- "delryTime":this.delryTime,// new Date().toISOString(),
- "foodlist": this.foodlist,
- "freight": this.psf,
- "jvli": this.jvli,
- "longitude": this.mendianMs.longitude,
- "latitude":this.mendianMs.latitude,
- "collectPayment":this.shifoudf,
- "cretim":cretim
- }
- }
- this.zhifuUrl='';
- this.addorder(data);
-
- },
- getaddressList(){
- api('getaddressList',{
- },r=>{
- this.addrList=r.data.data;
- if(this.dizhiID!=''){
- console.log('3333')
- this.getyunfei(this.dizhiID.latitude,this.dizhiID.longitude);
- }
- else{
- if(this.addrList.length>0){
- console.log('2222')
- this.dizhiID=this.addrList[0];
- this.mpImage=this.dizhiID.annexes;
- this.getyunfei(this.dizhiID.latitude,this.dizhiID.longitude);
- }
- }
- },failc=>{
- //console.log('getadvertis----',failc)
- })
- },
- getmendianDetail(id){
- api('getmendianDetail',{
- id:id
- },r=>{
- this.mendianMs=r.data.data;
- console.log('getmendianDetail',this.mendianMs);
- if(this.mendianMs){
- if(this.mendianMs.state==1){
- this.keyixd=false;
- }
- }
- if(this.dizhiID==''){
- this.getaddressList();
- }
- else{
- console.log('111')
- this.getyunfei(this.dizhiID.latitude,this.dizhiID.longitude);
- }
- this.cuxiaoList();
- },failc=>{
- //console.log('getadvertis----',failc)
- })
- },
- getyunfei(lat,lng){
- var that = this;
- if(this.mendianMs==''){
- return;
- }
- //this.getjuliForyunfei(lat,lng);//前端请求
- this.getjuliForyunfeiHT(lat,lng);//后端请求
- },
- //通过坐标直线计算运费
- zhixianyuanfei(lat,lng){
- var that = this;
- api('getyunfei',{
- lat1:lng,
- lng1:lat,
- lat2:this.mendianMs.longitude,
- lng2:this.mendianMs.latitude
- },r=>{
- console.log('直线运费');
- console.log(r);
- if(r.data.code!=200){
- return;
- }
- that.psf = parseInt(r.data.data.freight);
- if(that.psf>0){
- }
- else{
- that.psf=0;
- }
- that.freight = that.psf;
- that.jvli = r.data.data.jvli;
- that.isGetyunfei=true;
- console.log('直线运费');
- if(this.showAdrr==0){
- that.jisuanjiner();
- }
- },failc=>{
- //console.log('getadvertis----',failc)
- })
- },
- getjuliForyunfei(lat,lng){//前端
- var data={
- "origin":{
- "location":{
- "latLng":{
- "latitude":lat,
- "longitude":lng
- }
- }
- },
- "destination":{
- "location":{
- "latLng":{
- "latitude":this.mendianMs.latitude,
- "longitude":this.mendianMs.longitude
- }
- }
- },
- "travelMode": "DRIVE",
- "units": "METRIC"//米
- };
- console.log(data);
- api('getdistense',data,r=>{
- console.log('getadvertis----',r);
- if(r.statusCode==200){
- var dist = r.data.routes[0].distanceMeters;
- console.log(dist/1000);
- this.getyunfeiWithJuli(dist/1000);
- console.log('路径运费');
- }
- else{
- this.zhixianyuanfei(lat,lng);
- console.log('路径计算距离失败!');
- uni.showToast({
- title:'计算距离失败!',
- icon: 'none',
- duration: 3500
- })
- }
- },failc=>{
- console.log('getadvertis----',failc)
- })
- },
- getjuliForyunfeiHT(lat,lng){
- var that = this;
- var latlng1=''+lat+','+lng;
- var latlng2=''+this.mendianMs.latitude+','+this.mendianMs.longitude;
- // var latlng1='10.715641,106.73932';//''+lat+','+lng;
- // var latlng2='10.754999,106.735601';//''+this.mendianMs.latitude+','+this.mendianMs.longitude;
- api('getluxianjvli',{
- latlng1:latlng1,
- latlng2:latlng2,
- id:this.userid
- },r=>{
- console.log('getjuliForyunfeiHT',r);
- if(r.data.code==200){
- if(r.data.data[0]){
- var legs =r.data.data[0].legs;
- if(legs[0]){
- var juli = legs[0].distance.value;
- // uni.showToast({
- // title:'通过轨迹计算运费',
- // icon: 'none',
- // duration: 3500
- // })
- this.getyunfeiWithJuli(juli/1000);
- return;
- }
- }
- }
- // uni.showToast({
- // title:'直线距离计算运费',
- // icon: 'none',
- // duration: 3500
- // })
- this.zhixianyuanfei(lat,lng);
- },failc=>{
- //console.log('getadvertis----',failc)
- })
- },
-
-
- getyunfeiWithJuli(distence){
- var that = this;
- api('getZuiyyfei',{
- quli:JSON.stringify(distence)
- },r=>{
- console.log(r);
- if(r.data.code!=200){
- return;
- }
- that.psf = parseInt(r.data.data.freight);
- if(that.psf>0){
- }
- else{
- that.psf=0;
- }
- that.freight = that.psf;
- that.jvli = r.data.data.jvli;
- that.isGetyunfei=true;
- if(this.showAdrr==0){
- that.jisuanjiner();
- }
- },failc=>{
- //console.log('getadvertis----',failc)
- })
- },
-
- addorder(data){
- var that = this;
- uni.showLoading({
- title:'Loading...',
- mask:true
- })
- console.log('addorder',data);
- api('addorder',data,
- r=>{
- console.log(r);
- uni.hideLoading();
- if(r.data.code==200){
- this.qingkonggouwuche();
- this.ddId=data.ddId;
- this.rId=r.data.data.id;
- this.orderDetl=r.data.data;
- if(this.shifoudf==0){
- this.actType = 1;
- this.actTitle = that.$t('order.quzhifu');
- uni.showToast({
- title: that.$t('order.xuanzezhif'),
- icon: 'none',
- duration: 2500
- })
- }
- else{
- this.actType = 1;
- this.actTitle = that.$t('index.huodaofukan');
- //到付订单,直接更新支付状态
- this.huodaofukuan();
- }
-
- }
- else{
- uni.showToast({
- title: r.data.msg,
- icon: 'none',
- duration: 2000
- })
- }
- },failc=>{
- uni.hideLoading();
- //console.log('getadvertis----',failc)
- })
- },
-
- getVNPay(){
- api('setorderuzt',{
- id:this.rId,
- "collectPayment":0
- },res=>{
- if(res.data.code!=200){
- return;
- }
- },failc=>{
- return;
- })
- this.zffsS=false;
- var language = uni.getStorageSync('language');
- var lg;
- if(language=='yuenan'){
- lg='vi';
- }
- else{
- lg='en';
- }
- uni.showLoading({
- title:'Loading...',
- mask:true
- })
- api('VNPay',{
- orderid:this.ddId,
- amount:parseInt(this.zje),
- language:lg
- },r=>{
- uni.hideLoading();
- if(r.data.code!=200){
- uni.showToast({
- title: r.data.msg,
- icon: 'none',
- duration: 3500
- })
- return;
- }
- this.shifouzhifu=true;
- this.zhifuUrl='/pages/OrderList/buy/Zhifuyemian?url='+ encodeURIComponent(JSON.stringify(r.data.data))+'&ddid='+this.ddId;
- uni.navigateTo({
- url:'/pages/OrderList/buy/Zhifuyemian?url='+ encodeURIComponent(JSON.stringify(r.data.data))+'&ddid='+this.ddId
- })
- },failc=>{
- uni.hideLoading();
- //console.log('getadvertis----',failc)
- })
- },
- huodaofukuan(){
- this.shifoudf=1;
- this.zffsS=false;
- uni.showLoading({
- title:'Loading...',
- mask:true
- })
- var that = this;
- api('setorderuzt',{
- id:this.rId,
- "collectPayment":this.shifoudf
- },res=>{
- console.log('setorderuzt:',res)
- uni.hideLoading();
- if(res.data.code==200){
- this.actType = 2;
- this.actTitle = that.$t('order.yizhifu');
- uni.redirectTo({
- url:'/pages/OrderList/OrderDetail?ddid='+this.ddId+'&isShangjia=0'
- })
- }
- else{
- if(res.data.msg){
- uni.showToast({
- title: res.data.msg,
- icon: 'none',
- duration: 2000
- })
- }
- }
- },failc=>{
- uni.hideLoading();
- //console.log('getadvertis----',failc)
- })
- },
- setorderuzt(){
- var that = this;
- api('setorderuzt',{
- id:this.rId,
- state:1
- },res=>{
- this.actType = 2;
- this.actTitle = that.$t('order.yizhifu');
- uni.redirectTo({
- url:'/pages/OrderList/OrderDetail?ddid='+this.ddId+'&isShangjia=0'
- })
- },failc=>{
- //console.log('getadvertis----',failc)
- })
- },
- getorderDetl(){
- var that = this;
- api('getorderxq',{
- ddid:this.ddId
- },r=>{
- this.orderDetl=r.data.data;
- if(this.orderDetl.state==1){
- that.actType = 2;
- that.actTitle = that.$t('order.yizhifu');
- uni.redirectTo({
- url:'/pages/OrderList/OrderDetail?ddid='+this.ddId+'&isShangjia=0'
- })
- }
- },failc=>{
- //console.log('getadvertis----',failc)
- })
- },
- qingkonggouwuche(){
- uni.setStorageSync('gouwuche','');
- return;
- },
- pushMsg(cid,orderId){//消息推送
- api('pushMsgSJ',{
- cid:cid,
- title:'您有新订单了',
- content:orderId,
- payload:''
- },res=>{
- console.log(res)
- },failc=>{
- //console.log('getadvertis----',failc)
- })
- },
- selectImage(){
- console.log('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)
- api('ADDaddress',{
- id:that.dizhiID.id,
- annexes:that.mpImage
- },
- res=>{
- if(res.data.code==200){
- that.dizhiID.annexes=that.mpImage;
- uni.setStorageSync("peisongdizhi",that.dizhiID);
- }
- console.log('getGoodsDetail:',res);
- },failc=>{
- //console.log('getadvertis----',failc)
- })
- uni.showToast({
- title:that.$t('mend.shangccg'),
- icon:"success"
- })
-
- }
- });
- },
- }
- }
- </script>
- <style lang="scss">
- page{
- background-color: #F2F3F7;
- }
- .contentV{
- width:100%;
- position: relative;
-
- }
- .linesp{
- width:100%;
- height: 8rpx;
- background-color: aliceblue;
- }
- .pinglun{
- margin: 16rpx;
- padding: 10rpx;
- width:92%;
- height: 100rpx;
- border-radius: 15rpx;
- border: 2rpx solid lightgray;
- }
- .ctinrow{
- margin-top: 20rpx;
- width:100%;
- height: 80rpx;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- }
-
-
- .delbtct{
- margin-left: 10%;
- margin-top: 20rpx;
- padding-bottom: 30rpx;
- width:80%;
- }
- .delbt{
- text-align: center;
- font-size: 36rpx;
- width:100%;
- height: 80rpx;
- line-height: 80rpx;
- color: white;
- background-color: goldenrod;
- border-radius: 10rpx;
- }
- .topSwichV{
- height: 70rpx;
- width: 280rpx;
- border-radius: 35rpx;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- }
- .topSwichVL{
- margin-left: -40rpx;
- height: 70rpx;
- width: 200rpx;
- border-radius: 35rpx;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- }
- .toppz{
- width: 50rpx;
- }
- .toppztext{
- font-size: 30rpx;
- }
- .spnodetail{
- display: flex;
- flex-direction: row;
- align-items: center;
- background-color: white;
- margin-top: 20rpx;
- margin-bottom: 20rpx;
- }
- .spIcon{
- margin: 20rpx;
- width: 90rpx;
- height: 90rpx;
- }
- .xiaoji{
- margin-left: auto;
- margin-right: 30rpx;
- }
- .actBTV{
- width: 100%;
- display: flex;
- flex-direction: row;
- justify-content:space-between;
- align-items: center;
- }
- .viewinrow{
- display: flex;
- flex-direction: row;
- align-items: center;
- width: 100%;
- }
- .kouweisku{
- padding-right: 10rpx;
- color: chocolate;
- font-size: 26rpx;
- }
- .shifdf{
- height: 90rpx;
- width: 90%;
- margin-left: 5%;
- align-items: center;
- }
- .shifdftext{
- margin-left: 30rpx;
- font-size: 30rpx;
- }
- .picker-view {
- width: 750rpx;
- height: 300rpx;
- margin-top: 10rpx;
- }
- .item {
- line-height: 100rpx;
- text-align: center;
- }
- .zhifbut{
- text-align:center;
- margin-top: 12rpx;
- margin-bottom: 12rpx;
- width: 80%;
- border-radius: 10rpx;
- color: white;
- line-height: 70rpx;
- }
- .imageRJ{
- width: 40rpx;
- height: 40rpx;
- margin-right: 8rpx;
- }
- .imageR{
- width: 40rpx;
- height: 40rpx;
- margin-right: 30rpx;
- }
- .textR{
- font-size: 26rpx;
- margin-left: 6rpx;
- margin-right: 6rpx;
- }
- </style>
|