orderItemA.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. <template>
  2. <view style="background-color: whitesmoke;">
  3. <view v-if="orderList!=''">
  4. <view class="itemV content" v-for="(item,index) in orderList">
  5. <view class="contentInRowS">
  6. <text class="timeText">{{item.ddId}}</text>
  7. <text v-if="item.collectPayment==1" class="jiedanBtdf" style="font-size: 24rpx;">{{$t('index.huodaofukan')}}</text>
  8. </view>
  9. <view class="contentColumn">
  10. <view class="contentInRowL">
  11. <text class="titleText pnametext" style="margin-left:20rpx;">{{$t('order.peisongfei')}}: {{$formPr(item.freight)}}{{$t('api.huobidanwei')}}</text>
  12. </view>
  13. <view class="contentInRowR">
  14. <text class="priceText">{{$t('order.shangpinxj')}}: {{shphj(item)}}</text>
  15. </view>
  16. </view>
  17. <view v-if="youyouhui(item)" class="contentInRowL" style="margin-left:20rpx;">
  18. <text class="titleText">{{$t('order.youhuijine')}}:</text>
  19. <text class="titleText" style="padding-left: 20rpx;">{{getyhjr(item)}}</text>
  20. </view>
  21. <view style="width: 100%;margin-top: 20rpx;margin-left: 20rpx;" class="contentInRowL">
  22. <view style="width: 100rpx" class="contentColumn">
  23. <text class="quhuodian">{{$t('order.quhuodian')}}</text>
  24. </view>
  25. <view style="margin-left: 20rpx;width: 100%;" class="contentColumn">
  26. <view v-if="item.store" class="" @click="gotoNav(item.store)">
  27. <view class="contentColumn">
  28. <text class="titleText">{{item.store.posName}}</text>
  29. <!-- <text class="distenText">({{$t('order.juli')}}{{item.qsjvli}})</text> -->
  30. </view>
  31. <view style="width: 94%;">
  32. <text class="addrText">{{item.store.address}}</text>
  33. </view>
  34. <view>
  35. <text v-if="item.diningStatus==1" class="stateText">{{$t('order.shangjiayqrcc')}}</text>
  36. </view>
  37. </view>
  38. <view v-for="(itemf,index) in item.food" style="width: 100%;">
  39. <view class="contentInRowL" style="margin-top: 12rpx;width: 90%;">
  40. <myImage class="spIcon" :mysrc="itemf.image" mymode="scaleToFill" ></myImage>
  41. <view class="contentColumn" style="margin-left: 10rpx;width: 78%;">
  42. <text class="addrText">{{itemf.name}}</text>
  43. <view class="contentInRowS">
  44. <view class="contentInRowL ">
  45. <text class="kouweisku" v-for="sku in itemf.ask">{{sku}}</text>
  46. </view>
  47. <text class="addrText">{{itemf.number}}</text>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view v-if="youyouhui(item)" class="contentColumnC psfnote">
  55. <text class="addrText" style="color:white;padding: 6rpx;">{{$t('order.qishouyhts')}}</text>
  56. </view>
  57. <view v-if="item.collectPayment==1" class="contentColumnC psfnote" style="background-color: darkgreen;">
  58. <text class="addrText" style="color:white;padding: 6rpx;">{{$t('order.qiszhifts')}}</text>
  59. </view>
  60. <view class="contentInRowS" style="margin-top: 10rpx;">
  61. <view class="contentColumnC" style="margin:20rpx;padding-left: 10rpx;" @click="callPhone(item.store.telephone,item.store)">
  62. <uni-icons custom-prefix="custom-icon" color="#006AFF" type="phone-filled" size="28"></uni-icons>
  63. <label class="jiedanText">{{$t('order.lianxi')}}</label>
  64. </view>
  65. <view class="contentColumnC" style="margin:20rpx;padding-right: 10rpx;" @click="gotoNav(item.store)">
  66. <uni-icons custom-prefix="custom-icon" color="#006AFF" type="navigate-filled" size="28"></uni-icons>
  67. <label class="jiedanText">Navigation</label>
  68. </view>
  69. <view class="contentColumnC" style="margin:20rpx;padding-left: 10rpx;" @click="qucanshibai(item)">
  70. <uni-icons custom-prefix="custom-icon" color="crimson" type="closeempty" size="28"></uni-icons>
  71. <label class="jiedanText">{{$t('order.qucanshib')}}</label>
  72. </view>
  73. <view class="contentColumnC" style="margin:20rpx;padding-left: 10rpx;" @click="quchan(item)">
  74. <uni-icons custom-prefix="custom-icon" color="#006AFF" type="checkmarkempty" size="28"></uni-icons>
  75. <label class="jiedanText">{{$t('order.wanchengquhuo')}}</label>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <uni-popup style="z-index: 9999;" ref="popqc" type="center" :isMaskClick="true" :safeArea="true">
  81. <view class="contentColumn" style="width:600rpx;background-color: whitesmoke;border-radius: 10rpx;">
  82. <view class="item_list">
  83. <view class="item_content" v-for="(itemi,indexi) in annexList" @click="imagesel(indexi)">
  84. <netImage v-if="itemi!=''" width="180" height="180" bradius="4" :mysrc="itemi" mymode="scaleToFill" ></netImage>
  85. </view>
  86. <view class="item_content" @click="updataImage">
  87. <image class="upimagV" src="/static/imags/shangctp.png" mode="scaleToFill"></image>
  88. </view>
  89. </view>
  90. <view class="contentInRowC">
  91. <text class="actbttext" style="background-color:rosybrown;" @click="quxiaoqc">{{$t('index.quxiao')}}</text>
  92. <text class="actbttext" style="background-color:#006Aff;" @click="querenqucan">{{$t('order.wanchengquhuo')}}</text>
  93. </view>
  94. </view>
  95. </uni-popup>
  96. </view>
  97. </template>
  98. <script>
  99. import {
  100. UploadImage,
  101. setorderuzt
  102. } from '@/pages/api/basic';
  103. export default {
  104. name:"orderItem",
  105. props:{
  106. orderList:'',
  107. qsId:''
  108. },
  109. data() {
  110. return {
  111. isAndroid:true,
  112. annexList:[],
  113. actId:''
  114. };
  115. },
  116. mounted() {
  117. let systemInfo = uni.getSystemInfoSync();
  118. this.isAndroid = systemInfo.platform.toLowerCase() === 'android';
  119. },
  120. methods:{
  121. shphj(obj){
  122. var yhjinr=0;
  123. if(obj.mdSalesReduction){
  124. yhjinr=obj.mdSalesReduction;
  125. }
  126. if(obj.mdDiscountAmount){
  127. yhjinr=yhjinr+obj.mdDiscountAmount;
  128. }
  129. yhjinr=parseInt(yhjinr);
  130. var spxj=0;
  131. for(var i=0;i<obj.food.length;i++){
  132. spxj=spxj+(obj.food[i].price+obj.food[i].otherPrice)*obj.food[i].number;
  133. }
  134. var jinr=spxj-yhjinr;
  135. if(jinr>0){
  136. jinr=parseInt(jinr);
  137. }
  138. else{
  139. jinr=0;
  140. }
  141. jinr=parseInt(jinr);
  142. return this.$formPr(jinr)+this.$t('api.huobidanwei');
  143. },
  144. youyouhui(obj){
  145. if(obj.mdSalesReduction){
  146. return true;
  147. }
  148. if(obj.mdDiscountAmount){
  149. return true;
  150. }
  151. if(obj.discountAmount){
  152. return true;
  153. }
  154. if(obj.salesReduction){
  155. return true;
  156. }
  157. return false;
  158. },
  159. getyhjr(obj){
  160. var jinr=0;
  161. if(obj.mdSalesReduction){
  162. jinr=obj.mdSalesReduction;
  163. }
  164. if(obj.mdDiscountAmount){
  165. jinr=jinr+obj.mdDiscountAmount;
  166. }
  167. if(obj.discountAmount){
  168. jinr=jinr+obj.discountAmount;
  169. }
  170. if(obj.salesReduction){
  171. jinr=jinr+obj.salesReduction;
  172. }
  173. jinr=parseInt(jinr);
  174. return '-'+this.$formPr(jinr)+this.$t('api.huobidanwei');
  175. },
  176. qucanshibai(obj){
  177. var that = this;
  178. uni.showModal({
  179. title: that.$t('api.message'),
  180. content:that.$t('order.qrqucanshib'),
  181. confirmText:that.$t('index.queren'),
  182. cancelText:that.$t('index.quxiao'),
  183. success: function (res) {
  184. if (res.confirm) { //这里是点击了确定以后
  185. that.setorderuzt(obj.id,9)
  186. } else { //这里是点击了取消以后
  187. console.log('点击取消')
  188. }
  189. }
  190. })
  191. },
  192. quchan(obj){
  193. console.log('quchan');
  194. this.actId=obj.id;
  195. if(obj.sqImg){
  196. this.annexList=JSON.parse(obj.sqImg);
  197. }
  198. else{
  199. this.annexList=[];
  200. }
  201. this.$refs.popqc.open('center');
  202. },
  203. querenqucan(){
  204. //还要同步上传图片
  205. if(this.annexList.length==0){
  206. uni.showToast({
  207. title:this.$t('order.qingxiansctp'),
  208. icon: 'none',
  209. duration: 2500
  210. })
  211. return;
  212. }
  213. this.$refs.popqc.close();
  214. var data={
  215. id:this.actId,
  216. state:4,
  217. //qsId:this.qsId,
  218. diningStatus:1,
  219. qsImg:JSON.stringify(this.annexList)
  220. }
  221. console.log(data)
  222. this.$http.post(`${setorderuzt}`,data,true)
  223. .then(r => {
  224. console.log(r);
  225. this.$emit('ErefleshList');
  226. })
  227. .catch(err => {
  228. console.log(err)
  229. })
  230. },
  231. quxiaoqc(){
  232. this.$refs.popqc.close();
  233. },
  234. imagesel(index){
  235. },
  236. updataImage(){
  237. var that = this;
  238. uni.showModal({
  239. title: that.$t('api.message'),
  240. content:that.$t('order.qingxuanz'),
  241. confirmText:that.$t('order.qupaishe'),
  242. cancelText:that.$t('order.qushangc'),
  243. success: function (res) {
  244. if (res.confirm) { //这里是点击了确定以后
  245. that.getimage(2);
  246. } else { //这里是点击了取消以后
  247. console.log('点击取消')
  248. that.getimage(1)
  249. }
  250. }
  251. })
  252. },
  253. getimage(state){
  254. var sourceType=[];
  255. if(state==1){
  256. sourceType=['album']
  257. }
  258. else{
  259. sourceType=['camera']
  260. }
  261. var that = this;
  262. uni.chooseImage({
  263. count: 1, // 图片数量
  264. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  265. sourceType:sourceType, //从相册选择或者拍照
  266. success: (res) => {
  267. const tempFilePaths = res.tempFilePaths;
  268. uni.uploadFile({
  269. url: that.$baseurl+UploadImage, //上传图片api
  270. filePath: tempFilePaths[0],
  271. name: 'file',
  272. header:{
  273. //"Authorization": userinfo.token
  274. },
  275. success: (res) => {
  276. // console.log(res)
  277. let group = JSON.parse(res.data);
  278. var l = that.annexList.length;
  279. var temp = that.annexList;
  280. temp.push(group.data);
  281. that.annexList=temp;
  282. }
  283. });
  284. }
  285. });
  286. },
  287. callPhone(telphone,user){
  288. var that = this;
  289. uni.showModal({
  290. title: that.$t('api.message'),
  291. content:that.$t('api.nqdbddh'),
  292. confirmText:that.$t('index.queren'),
  293. cancelText:that.$t('index.quxiao'),
  294. success: function (res) {
  295. if (res.confirm) { //这里是点击了确定以后
  296. console.log('打电话')
  297. plus.device.dial(telphone, false );
  298. } else { //这里是点击了取消以后
  299. console.log('点击取消')
  300. }
  301. }
  302. })
  303. },
  304. async setorderuzt(rId,state){
  305. var that = this;
  306. var data;
  307. if(state==3){
  308. data={
  309. id:rId,
  310. state:state,
  311. qsId:this.qsId
  312. }
  313. }
  314. else{
  315. data={
  316. id:rId,
  317. state:state,
  318. qsId:this.qsId,
  319. diningStatus:1
  320. }
  321. }
  322. await this.$http.post(`${setorderuzt}`,data,true)
  323. .then(async r => {
  324. console.log(r);
  325. this.$emit('ErefleshList');
  326. })
  327. .catch(err => {
  328. console.log(err)
  329. })
  330. },
  331. gotoNav(store){
  332. var navData={
  333. latitude:store.latitude,
  334. longitude:store.longitude,
  335. address:store.posName
  336. }
  337. var temp = JSON.stringify(navData);
  338. uni.navigateTo({
  339. url:'/pages/map/mapboxView?navdata='+temp
  340. })
  341. },
  342. },
  343. }
  344. </script>
  345. <style lang="scss">
  346. @import '@/common/common.scss';
  347. @font-face {
  348. font-family: zrht;
  349. src: url('/uni_modules/font/zrht.otf');
  350. }
  351. .itemV{
  352. margin-top: 16rpx;
  353. background-color: white;
  354. }
  355. .psfnote{
  356. width: 92%;
  357. margin-left: 4%;
  358. margin-top: 5rpx;
  359. border-radius: 10rpx;
  360. background-color: crimson;
  361. }
  362. .spIcon{
  363. width: 90rpx;
  364. height: 90rpx;
  365. }
  366. .kouweisku{
  367. color:chocolate;
  368. padding-right: 12rpx;
  369. font-size: 28rpx;
  370. }
  371. .qiangdImg{
  372. width: 120rpx;
  373. height: 120rpx;
  374. }
  375. .quhuodian{
  376. font-size: 26rpx;
  377. padding: 8rpx;
  378. color: royalblue;
  379. border-radius: 16rpx;
  380. border: solid royalblue;
  381. }
  382. .shouhuodian{
  383. font-size: 26rpx;
  384. padding: 8rpx;
  385. color: crimson;
  386. border-radius: 16rpx;
  387. border: solid crimson;
  388. }
  389. .lineimag{
  390. display: flex;
  391. flex-direction: column;
  392. justify-content: space-between;
  393. margin-left: 45rpx;
  394. width: 4rpx;
  395. background-color: lightgray;
  396. height: 100rpx;
  397. margin-top: 4rpx;
  398. margin-bottom: 4rpx;
  399. }
  400. .yuandian{
  401. width: 16rpx;
  402. height: 16rpx;
  403. background-color: lightgray;
  404. border-radius: 8rpx;
  405. margin-left: -8rpx;
  406. }
  407. .timeText{
  408. font-size: 32rpx;
  409. color: #006AFF;
  410. padding-left: 20rpx;
  411. font-weight: bold;
  412. }
  413. .priceText{
  414. font-size: 30rpx;
  415. color: crimson;
  416. padding-right: 20rpx;
  417. text-align: right;
  418. }
  419. .titleText{
  420. font-size: 28rpx;
  421. /* font-family: zrht; */
  422. }
  423. .distenText{
  424. font-size: 26rpx;
  425. color: darkgray;
  426. }
  427. .addrText{
  428. font-size: 28rpx;
  429. color: dimgray;
  430. }
  431. .stateText{
  432. font-size: 28rpx;
  433. color: darkgray;
  434. margin-top: 6rpx;
  435. padding-left: 8rpx;
  436. padding-right: 8rpx;
  437. padding-top: 2rpx;
  438. padding-bottom: 2rpx;
  439. border: 2rpx solid darkgray;
  440. border-radius: 8rpx;
  441. }
  442. .noteText{
  443. margin-top: 16rpx;
  444. font-size: 28rpx;
  445. color: dimgray;
  446. padding: 8rpx;
  447. background-color: whitesmoke;
  448. border-radius: 8rpx;
  449. }
  450. .connectText{
  451. font-size: 28rpx;
  452. color: black;
  453. padding: 8rpx;
  454. border: solid darkgray;
  455. border-radius: 8rpx;
  456. }
  457. .setImg{
  458. width: 30rpx;
  459. height: 30rpx;
  460. }
  461. .setImgB{
  462. width: 40rpx;
  463. height: 40rpx;
  464. }
  465. .jiedanText{
  466. font-size: 24rpx;
  467. color: black;
  468. }
  469. .jiedanTextS{
  470. font-size: 20rpx;
  471. color: black;
  472. }
  473. .wanchengV{
  474. width: 80%;
  475. height: 68rpx;
  476. border-radius: 10rpx;
  477. margin-left: 10%;
  478. margin-top: 40rpx;
  479. margin-bottom: 20rpx;
  480. background-color: #006AFF;
  481. }
  482. .wanchengT{
  483. font-weight: bold;
  484. font-size: 30rpx;
  485. color: black;
  486. border-radius: 8rpx;
  487. padding: 6rpx;
  488. margin-right: 30rpx;
  489. }
  490. .jiedanBtdf{
  491. padding: 10rpx;
  492. color:white;
  493. background-color: #1A1A1A;
  494. border-radius: 8rpx;
  495. box-shadow: 0rpx 0rpx 2rpx 0rpx #1A1A1A;
  496. }
  497. .item_list{
  498. display: flex;
  499. flex-wrap: wrap;
  500. justify-content: flex-start;
  501. .item_content{
  502. width:180rpx;
  503. height:180rpx;
  504. margin: 10rpx;
  505. box-sizing: border-box;
  506. }
  507. }
  508. .upimagV{
  509. width: 180rpx;
  510. height:180rpx;
  511. }
  512. .actbttext{
  513. width: 50%;
  514. line-height: 66rpx;
  515. font-size: 28rpx;
  516. color: white;
  517. text-align: center;
  518. }
  519. </style>