orderItem.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. <template>
  2. <view style="background-color: whitesmoke;">
  3. <view class="itemV content" v-for="(item,index) in orderList">
  4. <view class="contentInRowS">
  5. <text class="timeText">{{item.ddId}}</text>
  6. <text v-if="item.collectPayment==1" class="jiedanBtdf" style="font-size: 24rpx;">{{$t('index.huodaofukan')}}</text>
  7. </view>
  8. <view class="contentColumn">
  9. <view class="contentInRowL">
  10. <text class="titleText pnametext" style="margin-left:20rpx;">{{$t('order.peisongfei')}}: {{$formPr(item.freight)}}{{$t('api.huobidanwei')}}</text>
  11. </view>
  12. <view class="contentInRowR">
  13. <text class="priceText">{{$t('order.dingdanjin')}}: {{$formPr(item.amount)}}{{$t('api.huobidanwei')}}</text>
  14. </view>
  15. </view>
  16. <view v-if="youyouhui(item)" class="contentInRowL" style="margin-left:20rpx;">
  17. <text class="titleText pnametext">{{$t('order.youhuijine')}}:</text>
  18. <text class="titleText" style="padding-left: 20rpx;">{{getyhjr(item)}}</text>
  19. </view>
  20. <view v-if="item.pointsReduction>0" class="contentInRowL" style="margin-left:20rpx;">
  21. <text class="titleText">{{$t('jifen.jifendikou')}}:</text>
  22. <text class="titleText" style="padding-left: 20rpx;"> -{{$formPr(item.pointsReduction)}}{{$t('api.huobidanwei')}}</text>
  23. </view>
  24. <view style="width: 100%;margin-top: 20rpx;margin-left: 20rpx;" class="contentInRowL">
  25. <view style="width: 100rpx" class="contentColumn">
  26. <text class="quhuodian">{{$t('order.quhuodian')}}</text>
  27. <view class="lineimag">
  28. </view>
  29. </view>
  30. <view style="margin-left: 20rpx;width: 80%;" class="contentColumn">
  31. <view class="contentColumn">
  32. <text class="titleText pnametext">{{item.store.posName}}</text>
  33. <text class="distenText">({{$t('order.juli')}}{{item.qsjvli}}Km)</text>
  34. </view>
  35. <view>
  36. <text class="addrText">{{item.store.address}}</text>
  37. </view>
  38. <view >
  39. <text v-if="item.diningStatus==1" class="stateText">{{$t('order.shangjiayqrcc')}}</text>
  40. </view>
  41. </view>
  42. </view>
  43. <view v-if="item.shaddress!=null" style="margin-left: 20rpx;margin-top: 20rpx;" class="contentInRowL">
  44. <view style="width: 100rpx" class="contentColumn">
  45. <text class="shouhuodian">{{$t('order.shouhuodian')}}</text>
  46. </view>
  47. <view style="margin-left: 20rpx;width: 80%;" class="contentColumn" @click="openBimg(item.shaddress.annexes)">
  48. <view class="contentInRowL">
  49. <text class="titleText">{{item.shaddress.name}}</text>
  50. <text class="distenText">({{$t('order.juli')}}{{item.jvli}}Km)</text>
  51. </view>
  52. <text class="addrText">{{item.shaddress.address}}</text>
  53. <text class="addrText">{{item.shaddress.area}}</text>
  54. <text v-if="item.remarks!=''" class="noteText">{{item.remarks}}</text>
  55. </view>
  56. </view>
  57. <view v-if="youyouhui(item)" class="contentColumnC psfnote">
  58. <text class="addrText" style="color:white;padding: 6rpx;">{{$t('order.qishouyhts')}}</text>
  59. </view>
  60. <view class="contentInRowC" style="width: 100%;margin-top: 10rpx;">
  61. <view class="contentInRowC wanchengV" @click="jiedan(item)">
  62. <view class="wanchengT">{{$t('shouye.jieshoudd')}}</view>
  63. </view>
  64. </view>
  65. <view v-if="item.state==2||1" style="margin-bottom: 20rpx;margin-top: 20rpx;" class="contentInRowS">
  66. <view class="contentColumnC" style="margin:20rpx;padding-left: 10rpx;" @click="callPhone(item.shaddress.phone,item.user)">
  67. <uni-icons custom-prefix="custom-icon" color="#006AFF" type="phone-filled" size="28"></uni-icons>
  68. <text class="jiedanText">{{$t('order.lianxi')}}</text>
  69. </view>
  70. <view class="contentColumnC" style="margin:20rpx;padding-right: 10rpx;" @click="gotoNav(item.shaddress)">
  71. <uni-icons custom-prefix="custom-icon" color="#006AFF" type="navigate-filled" size="28"></uni-icons>
  72. <text class="jiedanText">Navigation</text>
  73. </view>
  74. <view class="contentColumnC" style="margin:20rpx;" @click="Exchange(item.ddId,item.user)">
  75. <uni-icons custom-prefix="custom-icon" color="#006AFF" type="chatboxes" size="28"></uni-icons>
  76. <text class="jiedanText">{{$t('exchange.xinxi')}}</text>
  77. </view>
  78. <view class="contentColumnC" style="margin:20rpx;padding-left: 10rpx;" @click="imCall(item.ddId,item.user)">
  79. <uni-icons custom-prefix="custom-icon" color="#006AFF" type="phone" size="28"></uni-icons>
  80. <text class="jiedanText">IM Call</text>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. import api from "@/pages/api/api.js"
  88. import {
  89. setorderuzt
  90. } from '@/pages/api/basic';
  91. export default {
  92. name:"orderItem",
  93. props:{
  94. orderList:'',
  95. qsId:''
  96. },
  97. data() {
  98. return {
  99. isAndroid:true
  100. };
  101. },
  102. mounted() {
  103. let systemInfo = uni.getSystemInfoSync();
  104. this.isAndroid = systemInfo.platform.toLowerCase() === 'android';
  105. },
  106. methods:{
  107. youyouhui(obj){
  108. if(obj.mdSalesReduction){
  109. return true;
  110. }
  111. if(obj.mdDiscountAmount){
  112. return true;
  113. }
  114. if(obj.discountAmount){
  115. return true;
  116. }
  117. if(obj.salesReduction){
  118. return true;
  119. }
  120. return false;
  121. },
  122. getyhjr(obj){
  123. var jinr=0;
  124. if(obj.mdSalesReduction){
  125. jinr=obj.mdSalesReduction;
  126. }
  127. if(obj.mdDiscountAmount){
  128. jinr=jinr+obj.mdDiscountAmount;
  129. }
  130. if(obj.discountAmount){
  131. jinr=jinr+obj.discountAmount;
  132. }
  133. if(obj.salesReduction){
  134. jinr=jinr+obj.salesReduction;
  135. }
  136. jinr=parseInt(jinr);
  137. return '-'+this.$formPr(jinr)+this.$t('api.huobidanwei');
  138. },
  139. openBimg(mysrc){
  140. if(!mysrc){
  141. return;
  142. }
  143. if(mysrc.length<8){
  144. return;
  145. }
  146. console.log(mysrc);
  147. uni.navigateTo({
  148. url:'/pages/index/BigimageView?mysrc='+mysrc
  149. })
  150. },
  151. jiedan(obj){
  152. var online = getApp().globalData.isOnline;
  153. if(!online){
  154. uni.showToast({
  155. title: this.$t('user.xiaxianzh'),
  156. icon: 'none',
  157. duration: 2500
  158. })
  159. return;
  160. }
  161. if(this.qsId<=0 ||''==this.qsId){
  162. uni.showToast({
  163. title: this.$t('user.denglushixiao'),
  164. icon: 'none',
  165. duration: 2500
  166. })
  167. return;
  168. }
  169. var austate = getApp().globalData.auditStatus;
  170. if(austate!=1){
  171. uni.showToast({
  172. title: this.$t('user.zhanghaowsh'),
  173. icon: 'none',
  174. duration: 2500
  175. })
  176. return;
  177. }
  178. if(obj.collectPayment==1){
  179. var that = this;
  180. uni.showModal({
  181. title:that.$t('shouye.jieshoudd'),
  182. content:that.$t('index.jiedanfengx'),
  183. confirmText:that.$t('index.queren'),
  184. cancelText:that.$t('index.quxiao'),
  185. success: function (res) {
  186. if (res.confirm) { //这里是点击了确定以后
  187. that.setorderuzt(obj,3)
  188. //向商家推送通知
  189. that.pushMsg(obj);
  190. } else { //这里是点击了取消以后
  191. console.log('点击取消')
  192. }
  193. }
  194. })
  195. }
  196. else{
  197. this.setorderuzt(obj,3)
  198. }
  199. },
  200. pushMsg(obj){//消息推送
  201. if(obj.shanghu.cid==''||obj.shanghu.cid==null||obj.shanghu.cid==undefined){
  202. return;
  203. }
  204. api('pushMsgSJ',{
  205. cid:obj.shanghu.cid,
  206. title:'新订单|Lệnh mới',
  207. content:'你有新订单了|Anh có lệnh mới.',
  208. payload:''
  209. },res=>{
  210. console.log(res)
  211. },failc=>{
  212. //console.log('getadvertis----',failc)
  213. })
  214. },
  215. callPhone(telphone,user){
  216. var that = this;
  217. uni.showModal({
  218. title: that.$t('api.message'),
  219. content:that.$t('api.nqdbddh'),
  220. confirmText:that.$t('index.queren'),
  221. cancelText:that.$t('index.quxiao'),
  222. success: function (res) {
  223. if (res.confirm) { //这里是点击了确定以后
  224. console.log('打电话')
  225. plus.device.dial(telphone, false );
  226. } else { //这里是点击了取消以后
  227. console.log('点击取消')
  228. }
  229. }
  230. })
  231. },
  232. imCall(ddid,user){
  233. var data = {
  234. ddId:ddid,
  235. userId:user.userId,
  236. nickName:user.nickName,
  237. avatar:user.avatar,
  238. cid:user.cid
  239. }
  240. uni.setStorageSync('imUser',data);
  241. uni.navigateTo({
  242. url:'/pages/imcall/audioCall?caller=1'
  243. })
  244. },
  245. Exchange(ddid,user){
  246. var data = {
  247. ddId:ddid,
  248. userId:user.userId,
  249. nickName:user.nickName,
  250. avatar:user.avatar,
  251. cid:user.cid
  252. }
  253. uni.setStorageSync('imUser',data);
  254. uni.navigateTo({
  255. url:'/pages/imcall/GoeasyExchange?caller=1'
  256. })
  257. },
  258. setorderuzt(obj,state,){
  259. var that = this;
  260. var data;
  261. if(obj.collectPayment==1){
  262. data={
  263. id:obj.id,
  264. state:state,
  265. qsId:this.qsId,
  266. collectPayment:obj.collectPayment
  267. }
  268. }
  269. else{
  270. data={
  271. id:obj.id,
  272. state:state,
  273. qsId:this.qsId
  274. }
  275. }
  276. uni.showLoading({
  277. title:'Loading...',
  278. mask:true
  279. })
  280. this.$http.post(`${setorderuzt}`,data,true)
  281. .then(r => {
  282. uni.hideLoading();
  283. console.log(r);
  284. if(r.data.code==500){
  285. uni.showToast({
  286. title: r.data.msg,
  287. icon: 'none',
  288. duration: 2500
  289. })
  290. return;
  291. }
  292. this.$emit('ErefleshList');
  293. })
  294. .catch(err => {
  295. uni.hideLoading();
  296. console.log(err)
  297. })
  298. },
  299. gotoNav(store){
  300. var navData={
  301. latitude:parseFloat(store.latitude),
  302. longitude:parseFloat(store.longitude),
  303. address:store.address
  304. }
  305. var temp = JSON.stringify(navData);
  306. uni.navigateTo({
  307. url:'/pages/map/mapboxView?navdata='+temp
  308. })
  309. },
  310. handlePosition(lat,lon,cityName) {
  311. //如果是Andrios的设备
  312. if (plus.os.name == 'Android') {
  313. console.log('Android')
  314. const hasBaiduMap = plus.runtime.isApplicationExist({
  315. pname: 'com.baidu.BaiduMap',
  316. action: 'baidumap://'
  317. });
  318. const hasAmap = plus.runtime.isApplicationExist({
  319. pname: 'com.autonavi.minimap',
  320. action: 'androidamap://'
  321. });
  322. const hasgoogle = plus.runtime.isApplicationExist({
  323. pname: 'com.google.android.apps.maps',
  324. action: 'comgooglemaps://'
  325. });
  326. //重点是下面的url要根据官方给出的api进行对应,不同的需求对应不同的api
  327. let urlBaiduMap =
  328. 'baidumap://map/direction?region=起点&destination='+lat+','+lon+'&coord_type=wgs84&mode=riding&src=andr.paotuiwang.qishou';
  329. urlBaiduMap = encodeURI(urlBaiduMap)
  330. let urlAmap =
  331. 'androidamap://viewMap?sourceApplication=appname&poiname='+cityName+'&lat='+lat+'&lon='+lon+'&dev=1';
  332. urlAmap = encodeURI(urlAmap)
  333. var buttons=[];
  334. if(hasBaiduMap){
  335. buttons.push({
  336. title: this.$t('user.baiduNav'),
  337. value:urlBaiduMap
  338. })
  339. }
  340. if(hasAmap){
  341. buttons.push({
  342. title: this.$t('user.gaodeNav'),
  343. value:urlAmap
  344. })
  345. }
  346. // if(hasgoogle){
  347. // buttons.push({title: this.$t('user.googleNav')})
  348. // }
  349. if(buttons.length==0){
  350. if(hasgoogle){
  351. var url = 'google.navigation:q=' + lat + ',' + lon; //如果是国外应用,应该优先使用这个,会启动google地图。这个接口不能统一坐标系,进入百度地图时会有偏差
  352. plus.runtime.openURL(url);
  353. return;
  354. }
  355. }
  356. plus.nativeUI.actionSheet({
  357. title: this.$t('user.xuanzedaoh'),
  358. cancel: this.$t('index.quxiao'),
  359. buttons: buttons
  360. }, function(e) {
  361. plus.runtime.openURL(buttons[e.index-1].value);
  362. });
  363. } else {
  364. // iOS上获取本机是否安装了百度高德地图,需要在manifest里配置,在manifest.json文件app-plus->distribute->apple->urlschemewhitelist节点下添加(如urlschemewhitelist:["iosamap","baidumap"])
  365. var url='';
  366. var that = this;
  367. plus.nativeUI.actionSheet({
  368. title: this.$t('user.xuanzedaoh'),
  369. cancel: this.$t('index.quxiao'),
  370. buttons: [{
  371. title: this.$t('user.baiduNav')
  372. },{
  373. title: this.$t('user.gaodeNav')
  374. },{
  375. title: this.$t('user.googleNav')
  376. },{
  377. title: this.$t('user.appleNav')
  378. }]
  379. }, function(e) {
  380. switch (e.index) {
  381. case 1:
  382. url ='baidumap://map/marker?location='+lat+','+lon+'&title='+cityName+'&content='+cityName+'&coord_type=wgs84&src=ios.baidu.openAPIdemo';
  383. break;
  384. case 2:
  385. url ='iosamap://path?sourceApplication=fuxishan_uni_client&dlat='+lat+'&dlon='+lon+'&dname='+cityName+'&dev=1&t=0';
  386. break;
  387. case 3:
  388. url='comgooglemapsurl://?daddr='+ lat + ',' + lon;
  389. break;
  390. case 4:
  391. url = 'http://maps.apple.com/?q=' +cityName + '&ll=' + lat + ',' + lon + '&spn=0.008766,0.019441';
  392. break;
  393. default:
  394. break;
  395. }
  396. if (url!='') {
  397. url = encodeURI(url)
  398. plus.runtime.openURL(url, function(e) {
  399. plus.nativeUI.alert(that.$t('user.weianzhuangapp'));
  400. });
  401. }
  402. })
  403. }
  404. },
  405. },
  406. }
  407. </script>
  408. <style>
  409. @import '@/common/common.scss';
  410. @font-face {
  411. font-family: zrht;
  412. src: url('/uni_modules/font/zrht.otf');
  413. }
  414. .itemV{
  415. margin-top: 16rpx;
  416. background-color: white;
  417. }
  418. .psfnote{
  419. width: 92%;
  420. margin-left: 4%;
  421. margin-top: 5rpx;
  422. border-radius: 10rpx;
  423. background-color: crimson;
  424. }
  425. .qiangdImg{
  426. width: 120rpx;
  427. height: 120rpx;
  428. }
  429. .quhuodian{
  430. font-size: 26rpx;
  431. padding: 8rpx;
  432. color: royalblue;
  433. border-radius: 16rpx;
  434. border: solid royalblue;
  435. }
  436. .shouhuodian{
  437. font-size: 26rpx;
  438. padding: 8rpx;
  439. color: crimson;
  440. border-radius: 16rpx;
  441. border: solid crimson;
  442. }
  443. .lineimag{
  444. display: flex;
  445. flex-direction: column;
  446. justify-content: space-between;
  447. margin-left: 45rpx;
  448. width: 4rpx;
  449. background-color: lightgray;
  450. height: 100rpx;
  451. margin-top: 4rpx;
  452. margin-bottom: 4rpx;
  453. }
  454. .yuandian{
  455. width: 16rpx;
  456. height: 16rpx;
  457. background-color: lightgray;
  458. border-radius: 8rpx;
  459. margin-left: -8rpx;
  460. }
  461. .timeText{
  462. font-size: 32rpx;
  463. color: #006AFF;
  464. padding-left: 20rpx;
  465. font-weight: bold;
  466. }
  467. .priceText{
  468. font-size: 30rpx;
  469. color: crimson;
  470. padding-right: 20rpx;
  471. }
  472. .titleText{
  473. font-size: 28rpx;
  474. /* font-family: zrht; */
  475. }
  476. .pnametext{
  477. overflow: hidden;
  478. text-overflow: ellipsis;
  479. display: -webkit-box;
  480. -webkit-line-clamp: 1;
  481. -webkit-box-orient: vertical;
  482. }
  483. .distenText{
  484. font-size: 30rpx;
  485. color: darkgray;
  486. }
  487. .addrText{
  488. font-size: 28rpx;
  489. color: dimgray;
  490. }
  491. .stateText{
  492. font-size: 28rpx;
  493. color: darkgray;
  494. margin-top: 6rpx;
  495. padding-left: 8rpx;
  496. padding-right: 8rpx;
  497. padding-top: 2rpx;
  498. padding-bottom: 2rpx;
  499. border: 2rpx solid darkgray;
  500. border-radius: 8rpx;
  501. }
  502. .noteText{
  503. margin-top: 16rpx;
  504. font-size: 28rpx;
  505. color: dimgray;
  506. padding: 8rpx;
  507. background-color: whitesmoke;
  508. border-radius: 8rpx;
  509. }
  510. .connectText{
  511. font-size: 28rpx;
  512. color: black;
  513. margin-top: 6rpx;
  514. padding-left: 8rpx;
  515. padding-right: 8rpx;
  516. padding-top: 2rpx;
  517. padding-bottom: 2rpx;
  518. border: 2rpx solid darkgray;
  519. border-radius: 8rpx;
  520. }
  521. .setImg{
  522. width: 30rpx;
  523. height: 30rpx;
  524. }
  525. .setImgB{
  526. width: 40rpx;
  527. height: 40rpx;
  528. }
  529. .jiedanText{
  530. font-size: 24rpx;
  531. color: black;
  532. }
  533. .jiedanTextS{
  534. font-size: 20rpx;
  535. color: black;
  536. }
  537. .wanchengV{
  538. width: 80%;
  539. height: 68rpx;
  540. border-radius: 10rpx;
  541. margin-top: 40rpx;
  542. margin-bottom: 20rpx;
  543. background-color: #006AFF;
  544. }
  545. .shuaxinBT{
  546. font-weight: bold;
  547. font-size: 30rpx;
  548. color: black;
  549. border-radius: 8rpx;
  550. padding: 6rpx;
  551. margin-right: 30rpx;
  552. }
  553. .wanchengT{
  554. width: 100%;
  555. font-weight: bold;
  556. font-size: 26rpx;
  557. color: white;
  558. border-radius: 8rpx;
  559. text-align: center;
  560. }
  561. .jiedanBt{
  562. padding: 10rpx;
  563. color:white;
  564. background-color: #00A6FF;
  565. border-radius: 8rpx;
  566. box-shadow: 0rpx 0rpx 10rpx 0rpx #00A6FF;
  567. }
  568. .jiedanBtdf{
  569. padding: 10rpx;
  570. color:white;
  571. background-color: #1A1A1A;
  572. border-radius: 8rpx;
  573. box-shadow: 0rpx 0rpx 2rpx 0rpx #1A1A1A;
  574. }
  575. </style>