index.vue 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="all-products-body" v-for="(item, index) in grouponOrderData.goodsInfos" :key="index">
  4. <view class="all-products-item">
  5. <image
  6. :src="item.goodsCover"
  7. mode="scaleToFill" />
  8. <view class="all-products-item-content">
  9. <view class="all-products-item-content-t">
  10. {{item.goodsName}}
  11. </view>
  12. <view class="all-products-item-content-b">
  13. <view style="display:flex;">
  14. <text class="red"> ¥{{item.discountPrice}}</text>
  15. </view>
  16. <view>
  17. <u-number-box :min="1" v-model="grouponOrderData.goodsInfos[index].num" @change="valChange"></u-number-box>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class='order-submission'>
  24. <view>
  25. <view class="nav acea-row">
  26. <view class="item font-num" :class="shippingType == 0 ? 'on' : 'on2'" @tap="addressType(0)"
  27. v-if='store_self_mention && is_shipping'></view>
  28. <view class="item font-num" :class="shippingType == 1 ? 'on' : 'on2'" @tap="addressType(1)"
  29. v-if='store_self_mention && is_shipping'></view>
  30. </view>
  31. <view class='address-info' @tap='onAddress'>
  32. <block>
  33. <view class="a-t">
  34. <view class="t1">
  35. 自提门店
  36. </view>
  37. <view class="t2">
  38. 更换自提网点
  39. <image src="http://www.gzzzyd.com/groupon/order_details/切换_面24@2x.png" mode="scaleToFill" />
  40. </view>
  41. </view>
  42. <view class="a-m">
  43. <view class="am1">
  44. <view class="am1-1">
  45. {{grouponOrderData.selfTake.name}}
  46. </view>
  47. <view class="am1-2">
  48. 距您{{grouponOrderData.selfTake.distanceDesc}}
  49. <image src="http://www.gzzzyd.com/groupon/order_details/距离@2x.png" mode="scaleToFill" />
  50. </view>
  51. </view>
  52. <view class="am2">
  53. {{grouponOrderData.selfTake.address}}
  54. </view>
  55. <view class="am3">
  56. 营业时间 {{grouponOrderData.selfTake.busStartTime}}-{{grouponOrderData.selfTake.busEndTime}}
  57. </view>
  58. </view>
  59. <view class="a-b">
  60. <view class="a-b1">
  61. 对接团长:
  62. <text class="red">
  63. {{grouponOrderData.username}}
  64. </text>
  65. </view>
  66. <view class="a-b2">
  67. <image src="http://www.gzzzyd.com/groupon/order_details/微信@2x.png" mode="scaleToFill" />
  68. <image src="http://www.gzzzyd.com/groupon/order_details/电话键盘_填充@2x.png" mode="scaleToFill" />
  69. </view>
  70. </view>
  71. </block>
  72. </view>
  73. <view class="payment-details">
  74. <blok>
  75. <view class="p-t">
  76. 付款明细
  77. </view>
  78. <view class="p-b-item">
  79. <view class="item-lable">商品金额</view>
  80. <view class="item-value">¥48</view>
  81. </view>
  82. <view class="p-b-item">
  83. <view class="item-lable">积分抵扣</view>
  84. <view class="item-value">¥0</view>
  85. </view>
  86. <view class="p-b-item">
  87. <view class="item-lable">总计金额</view>
  88. <view class="item-value">¥48</view>
  89. </view>
  90. </blok>
  91. </view>
  92. <productConSwiperGroupbuying class="skeleton-rect" ></productConSwiperGroupbuying>
  93. </view>
  94. <orderGoods :cartInfo="cartInfo" :is_confirm='true' :shipping_type="shippingType"></orderGoods>
  95. <view class='moneyList'>
  96. <view class='item acea-row row-between-wrapper' v-if="priceGroup.storePostage > 0">
  97. <view>{{ $t(`配送运费`) }}:</view>
  98. <view class='money'>
  99. {{ $t(`¥`) }}{{ (parseFloat(priceGroup.storePostage) + parseFloat(priceGroup.storePostageDiscount)).toFixed(2)
  100. }}
  101. </view>
  102. </view>
  103. <view class='item acea-row row-between-wrapper'
  104. v-if="priceGroup.vipPrice > 0 && userInfo.vip && !pinkId && !BargainId && !combinationId && !seckillId && !discountId">
  105. <view>{{ $t(`会员商品优惠`) }}:</view>
  106. <view class='money'>-{{ $t(`¥`) }}{{ parseFloat(priceGroup.vipPrice).toFixed(2) }}</view>
  107. </view>
  108. <view class='item acea-row row-between-wrapper' v-if="priceGroup.storePostageDiscount > 0">
  109. <view>{{ $t(`会员运费优惠`) }}:</view>
  110. <view class='money'>-{{ $t(`¥`) }}{{ parseFloat(priceGroup.storePostageDiscount).toFixed(2) }}</view>
  111. </view>
  112. <view class='item acea-row row-between-wrapper' v-if="coupon_price > 0">
  113. <view>{{ $t(`优惠券抵扣`) }}:</view>
  114. <view class='money'>-{{ $t(`¥`) }}{{ parseFloat(coupon_price).toFixed(2) }}</view>
  115. </view>
  116. <view class='item acea-row row-between-wrapper' v-if="integral_price > 0">
  117. <view>{{ $t(`积分抵扣`) }}:</view>
  118. <view class='money'>-{{ $t(`¥`) }}{{ parseFloat(integral_price).toFixed(2) }}</view>
  119. </view>
  120. </view>
  121. <view style='height:120rpx;'></view>
  122. <view class='footer acea-row row-between-wrapper'>
  123. <view>{{ $t(`合计`) }}:
  124. <text class='font-color'>{{ $t(`¥`) }}{{ parseFloat(totalPrice).toFixed(2) || 0 }}</text>
  125. </view>
  126. <view class='settlement' style='z-index:100' @tap.stop="goPay" v-if="totalPrice > 0">立即支付
  127. </view>
  128. <view class='settlement bg-color-hui' style='z-index:100' v-else>立即支付</view>
  129. </view>
  130. </view>
  131. <view class="alipaysubmit" v-html="formContent"></view>
  132. <!-- <couponListWindow :coupon='coupon' @ChangCouponsClone="ChangCouponsClone" :openType='openType' :cartId='cartId'
  133. @ChangCoupons="ChangCoupons"></couponListWindow> -->
  134. <!-- <addressWindow ref="addressWindow" @changeTextareaStatus="changeTextareaStatus" :news='news' :address='address'
  135. :pagesUrl="pagesUrl" @OnChangeAddress="OnChangeAddress" @changeClose="changeClose"></addressWindow>
  136. --><!-- #ifdef MP -->
  137. <!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
  138. <!-- #endif -->
  139. <!-- <home v-show="!invShow"></home> -->
  140. <invoice-picker :inv-show="invShow" :inv-list="invList" :inv-checked="invChecked" :is-special="special_invoice"
  141. :url-query="urlQuery" @inv-close="invClose" @inv-change="invChange" @inv-cancel="invCancel">
  142. </invoice-picker>
  143. <payment :payMode="cartArr" :pay_close="pay_close" :isCall="false" :totalPrice="parseFloat(totalPrice).toFixed(2)"
  144. @changePayType="changePayType" @onChangeFun="onChangeFun" :order_id="orderKey"></payment>
  145. <canvas canvas-id="canvas" v-if="canvasStatus"
  146. :style="{ width: canvasWidth + 'px', height: canvasHeight + 'px', position: 'absolute', left: '-100000px', top: '-100000px' }"></canvas>
  147. </view>
  148. </template>
  149. <script>
  150. import {
  151. getGoodsDetail, postOrderSubmit, postBeforeCheck, getUserAddressByIdAndFreight
  152. } from "@/api/home.js";
  153. import {
  154. orderConfirm,
  155. getCouponsOrderPrice,
  156. orderCreate,
  157. postOrderComputed,
  158. checkShipping,
  159. getGroupOrderData
  160. } from '@/api/order.js';
  161. import {
  162. getAddressDefault,
  163. getAddressDetail,
  164. invoiceList,
  165. invoiceOrder
  166. } from '@/api/user.js';
  167. import {
  168. openPaySubscribe
  169. } from '@/utils/SubscribeMessage.js';
  170. import {
  171. storeListApi
  172. } from '@/api/store.js';
  173. import {
  174. CACHE_LONGITUDE,
  175. CACHE_LATITUDE
  176. } from '@/config/cache.js';
  177. import couponListWindow from '@/components/couponListWindow';
  178. import addressWindow from '@/components/addressWindow';
  179. import orderGoods from '@/pages/goods/orderGoods/index_mall';
  180. import home from '@/components/home';
  181. import {
  182. toLogin
  183. } from '@/libs/login.js';
  184. import {
  185. mapGetters
  186. } from "vuex";
  187. // #ifdef MP
  188. import authorize from '@/components/Authorize';
  189. // #endif
  190. import payment from '@/components/payment';
  191. import colors from "@/mixins/color";
  192. import productConSwiperGroupbuying from "@/components/productConSwiperGroupbuying";
  193. export default {
  194. components: {
  195. payment,
  196. couponListWindow,
  197. productConSwiperGroupbuying,
  198. addressWindow,
  199. orderGoods,
  200. home,
  201. // #ifdef MP
  202. authorize
  203. // #endif
  204. },
  205. mixins: [colors],
  206. data () {
  207. const currentDate = this.getDate({
  208. format: true
  209. })
  210. return {
  211. confirm: '', //自定义留言
  212. date: this.$t(`请选择`),
  213. time: this.$t(`请选择`),
  214. canvasWidth: "",
  215. canvasHeight: "",
  216. canvasStatus: false,
  217. newImg: [],
  218. textareaStatus: true,
  219. //支付方式
  220. cartArr: [{
  221. "name": this.$t(`微信支付`),
  222. "icon": "icon-weixin2",
  223. value: 'weixin',
  224. title: this.$t(`使用微信快捷支付`),
  225. payStatus: 1,
  226. },
  227. ],
  228. virtual_type: 0,
  229. formContent: '',
  230. payType: 'weixin', //支付方式
  231. openType: 1, //优惠券打开方式 1=使用
  232. active: 0, //支付方式切换
  233. coupon: {
  234. coupon: false,
  235. list: [],
  236. statusTile: this.$t(`立即使用`)
  237. }, //优惠券组件
  238. address: {
  239. address: false
  240. }, //地址组件
  241. addressInfo: {}, //地址信息
  242. pinkId: 0, //拼团id
  243. addressId: 0, //地址id
  244. couponId: 0, //优惠券id
  245. cartId: '', //购物车id
  246. BargainId: 0,
  247. combinationId: 0,
  248. seckillId: 0,
  249. discountId: 0,
  250. userInfo: {}, //用户信息
  251. mark: '', //备注信息
  252. couponTitle: this.$t(`请选择`), //优惠券
  253. coupon_price: 0, //优惠券抵扣金额
  254. useIntegral: false, //是否使用积分
  255. integral_price: 0, //积分抵扣金额
  256. integral: 0,
  257. usable_integral: 0,
  258. ChangePrice: 0, //使用积分抵扣变动后的金额
  259. formIds: [], //收集formid
  260. status: 0,
  261. is_address: false,
  262. toPay: false, //修复进入支付时页面隐藏从新刷新页面
  263. shippingType: 0,
  264. system_store: {},
  265. storePostage: 0,
  266. advanceId: 0,
  267. contacts: '',
  268. contactsTel: '',
  269. mydata: {},
  270. storeList: [],
  271. store_self_mention: 0,
  272. cartInfo: [],
  273. priceGroup: {},
  274. animated: false,
  275. totalPrice: 1,
  276. integralRatio: "0",
  277. pagesUrl: "",
  278. orderKey: "",
  279. // usableCoupon: {},
  280. offlinePostage: "",
  281. isAuto: false, //没有授权的不会自动授权
  282. isShowAuth: false, //是否隐藏授权
  283. from: '',
  284. news: 1,
  285. num: 0,
  286. // invTitle: '不开发票',
  287. invTitle: this.$t(`不开发票`),
  288. special_invoice: false,
  289. invoice_func: false,
  290. header_type: '',
  291. invShow: false,
  292. invList: [],
  293. invChecked: '',
  294. urlQuery: '',
  295. pay_close: false,
  296. noCoupon: 0,
  297. valid_count: 0,
  298. discount_id: 0,
  299. is_shipping: true,
  300. inputTrip: false,
  301. focus: true,
  302. goodsSpecId: 0,
  303. freight: 0,
  304. zoneType: 0,
  305. goods: [],
  306. organizerUserId: '',
  307. selfTakeId: '',
  308. grouponOrderData: {}
  309. };
  310. },
  311. computed: mapGetters(['isLogin']),
  312. // watch: {
  313. // startDate() {
  314. // return this.getDate('start');
  315. // },
  316. // endDate() {
  317. // return this.getDate('end');
  318. // }
  319. // },
  320. onLoad (options) {
  321. const goods = JSON.parse(decodeURIComponent(options.goods));
  322. this.goods = goods;
  323. this.organizerUserId = options.organizerUserId;
  324. this.selfTakeId = options.selfTakeId;
  325. this.from = 'routine'
  326. // if (!options.productId) return this.$util.Tips({
  327. // title: this.$t(`请选择要购买的商品`)
  328. // }, {
  329. // tab: 3,
  330. // url: 1
  331. // });
  332. if (this.isLogin && this.toPay == false) {
  333. this.getOrderData();
  334. // this.checkShipping();
  335. // this.getaddressInfo();
  336. // this.getConfirm();
  337. // this.$nextTick(function() {
  338. // this.$refs.addressWindow.getAddressList();
  339. // })
  340. } else {
  341. toLogin();
  342. }
  343. },
  344. /**
  345. * 生命周期函数--监听页面显示
  346. */
  347. onShow: function () {
  348. let _this = this
  349. uni.$on("handClick", res => {
  350. if (res) {
  351. _this.system_store = res.address
  352. }
  353. // 清除监听
  354. uni.$off('handClick');
  355. })
  356. },
  357. methods: {
  358. getOrderData() {
  359. let longitude = uni.getStorageSync("user_longitude"); //经度
  360. let latitude = uni.getStorageSync("user_latitude"); //纬度
  361. getGroupOrderData({
  362. goods: this.goods,
  363. organizerUserId: this.organizerUserId,
  364. selfTakeId: this.selfTakeId,
  365. longitude: longitude,
  366. latitude: latitude
  367. }).then(res => {
  368. this.grouponOrderData = res.data;
  369. }).catch(err => {
  370. uni.showToast({
  371. title: err,
  372. icon: 'none'
  373. });
  374. });
  375. },
  376. checkShipping () {
  377. let that = this;
  378. this.getConfirm();
  379. // this.getaddressInfo();
  380. },
  381. // 不开发票
  382. invCancel () {
  383. this.invChecked = '';
  384. this.invTitle = this.$t(`不开发票`)
  385. this.invShow = false;
  386. },
  387. // 选择发票
  388. invChange (id) {
  389. this.invChecked = id;
  390. this.invShow = false;
  391. const result = this.invList.find(item => item.id === id);
  392. let name = '';
  393. name += result.header_type === 1 ? this.$t(`个人`) : this.$t(`企业`);
  394. name += result.type === 1 ? this.$t(`普通`) : this.$t(`专用`);
  395. name += this.$t(`发票`);
  396. this.invTitle = name;
  397. },
  398. // 关闭发票
  399. invClose () {
  400. this.invShow = false;
  401. this.getInvoiceList()
  402. },
  403. getInvoiceList () {
  404. uni.showLoading({
  405. title: this.$t(`正在加载中`)
  406. })
  407. invoiceList().then(res => {
  408. uni.hideLoading();
  409. this.invList = res.data.map(item => {
  410. item.id = item.id.toString();
  411. return item;
  412. });
  413. const result = this.invList.find(item => item.id == this.invChecked);
  414. if (result) {
  415. let name = '';
  416. name += result.header_type === 1 ? this.$t(`个人`) : this.$t(`企业`);
  417. name += result.type === 1 ? this.$t(`普通`) : this.$t(`专用`);
  418. name += this.$t(`发票`);
  419. this.invTitle = name;
  420. }
  421. }).catch(err => {
  422. uni.showToast({
  423. title: err,
  424. icon: 'none'
  425. });
  426. });
  427. },
  428. /**
  429. * 开发票
  430. */
  431. goInvoice: function () {
  432. this.getInvoiceList()
  433. this.invShow = true;
  434. this.urlQuery =
  435. `new=${this.news}&cartId=${this.cartId}&pinkId=${this.pinkId}&couponId=${this.couponId}&addressId=${this.addressId}&specialInvoice=${this.special_invoice}&couponTitle=${this.couponTitle}`;
  436. },
  437. /**
  438. * 授权回调事件
  439. *
  440. */
  441. onLoadFun: function () {
  442. // this.getaddressInfo();
  443. this.getConfirm();
  444. //调用子页面方法授权后执行获取地址列表
  445. // this.$scope.selectComponent('#address-window').getAddressList();
  446. },
  447. /**
  448. * 事件回调
  449. *
  450. */
  451. onChangeFun: function (e) {
  452. let opt = e;
  453. let action = opt.action || null;
  454. let value = opt.value != undefined ? opt.value : null;
  455. action && this[action] && this[action](value);
  456. },
  457. payClose: function () {
  458. this.pay_close = false;
  459. },
  460. goPay () {
  461. let that = this
  462. uni.showLoading({
  463. title: that.$t(`下单中`)
  464. });
  465. that.orderCreate()
  466. },
  467. orderCreate () {
  468. let that = this
  469. postOrderSubmit({
  470. distributeMode: 1,
  471. orderType: 1,
  472. orderSource: 1,
  473. grouponId: '1664886578504519681',
  474. selfTakeId: '1664586279807877110',
  475. goodsInfos: [{
  476. goodsId: '1657937702030471169',
  477. num: 1
  478. },{
  479. goodsId: '1630247403610845188',
  480. num: 1
  481. }]
  482. }).then(res => {
  483. that.orderKey = res.data.orderNo,
  484. uni.showLoading({
  485. title: that.$t(`下单成功`)
  486. });
  487. setTimeout(res => {
  488. uni.hideLoading();
  489. that.pay_close = true;
  490. }, 500)
  491. }).catch(err => {
  492. uni.hideLoading();
  493. return that.$util.Tips({
  494. title: err
  495. });
  496. });
  497. },
  498. pay_complete (type) {
  499. let that = this
  500. this.payType = type;
  501. // let url = '/pages/goods/order_pay_status/index?order_id=' + this.orderKey + '&msg=' + "支付成功" +
  502. // '&type=3' + '&totalPrice=' + this.totalPrice
  503. uni.showToast({
  504. title: that.$t(`支付成功`)
  505. })
  506. that.pay_close = false
  507. setTimeout(res => {
  508. uni.navigateBack({
  509. delta: 1
  510. })
  511. }, 1000)
  512. // this.SubOrder();
  513. },
  514. payCheck (type) {
  515. this.payType = type;
  516. // console.log(this.payType);
  517. // let url = '/pages/goods/order_pay_status/index?order_id=' + this.orderKey + '&msg=' + "支付成功" +
  518. // '&type=3' + '&totalPrice=' + this.totalPrice
  519. // uni.showToast({
  520. // title: that.$t(`支付成功`)
  521. // })
  522. // setTimeout(res => {
  523. // uni.redirectTo({
  524. // url: url
  525. // })
  526. // }, 1000)
  527. // this.SubOrder();
  528. },
  529. /**
  530. * 获取门店列表数据
  531. */
  532. getList: function () {
  533. let longitude = uni.getStorageSync("user_longitude"); //经度
  534. let latitude = uni.getStorageSync("user_latitude"); //纬度
  535. let data = {
  536. latitude: latitude, //纬度
  537. longitude: longitude, //经度
  538. page: 1,
  539. limit: 10
  540. }
  541. storeListApi(data).then(res => {
  542. let list = res.data.list.list || [];
  543. this.$set(this, 'storeList', list);
  544. this.$set(this, 'system_store', list[0]);
  545. }).catch(err => { })
  546. },
  547. // 关闭地址弹窗;
  548. changeClose: function () {
  549. this.$set(this.address, 'address', false);
  550. },
  551. /*
  552. * 跳转门店列表
  553. */
  554. showStoreList: function () {
  555. let _this = this
  556. if (this.storeList.length > 0) {
  557. uni.navigateTo({
  558. url: '/pages/goods/goods_details_store/index'
  559. })
  560. }
  561. },
  562. changePayType (type) {
  563. this.payType = type
  564. // this.computedPrice()
  565. },
  566. computedPrice: function () {
  567. let that = this
  568. // postBeforeCheck({
  569. // goodsSpecId: this.goodsSpecId,
  570. // num: this.num,
  571. // userAddressId: this.addressId
  572. // }).then(function (res) {
  573. // //验证是否可下单
  574. // if (res.code == 200) {
  575. // that.freight = res.data.freight - 0
  576. // that.totalPrice = res.data.freight - 0
  577. // that.cartInfo.forEach(e => {
  578. // that.totalPrice += e.salePrice - 0
  579. // })
  580. // } else {
  581. // this.totalPrice = 0
  582. // that.$util.Tips({
  583. // title: that.$t(`所选商品属性不支持下单`),
  584. // success: () => {
  585. // // that.getCartCount(true);
  586. // },
  587. // });
  588. // }
  589. // })
  590. },
  591. addressType (e) {
  592. let index = e;
  593. let that = this;
  594. if (this.shippingType == parseInt(index)) return
  595. this.shippingType = parseInt(index);
  596. if (index == 1) {
  597. // #ifdef H5
  598. if (that.$wechat.isWeixin()) {
  599. that.$wechat.location().then(res => {
  600. uni.setStorageSync('user_latitude', res.latitude);
  601. uni.setStorageSync('user_longitude', res.longitude);
  602. this.getList()
  603. }).catch(err => {
  604. this.getList()
  605. })
  606. } else {
  607. // #endif
  608. uni.getLocation({
  609. type: 'wgs84',
  610. success: (res) => {
  611. uni.setStorageSync('user_latitude', res.latitude);
  612. uni.setStorageSync('user_longitude', res.longitude);
  613. this.getList()
  614. },
  615. complete: () => {
  616. this.getList()
  617. }
  618. });
  619. // #ifdef H5
  620. }
  621. // #endif
  622. };
  623. this.$nextTick(e => {
  624. this.getConfirm();
  625. this.computedPrice();
  626. })
  627. },
  628. bindPickerChange: function (e) {
  629. let value = e.detail.value;
  630. this.shippingType = value;
  631. this.computedPrice();
  632. },
  633. ChangCouponsClone: function () {
  634. this.$set(this.coupon, 'coupon', false);
  635. },
  636. changeTextareaStatus: function () {
  637. for (let i = 0, len = this.coupon.list.length; i < len; i++) {
  638. this.coupon.list[i].use_title = '';
  639. this.coupon.list[i].is_use = 0;
  640. }
  641. this.textareaStatus = true;
  642. this.status = 0;
  643. this.$set(this.coupon, 'list', this.coupon.list);
  644. },
  645. /**
  646. * 处理点击优惠券后的事件
  647. *
  648. */
  649. ChangCoupons: function (e) {
  650. // this.usableCoupon = e
  651. // this.coupon.coupon = false
  652. let index = e,
  653. list = this.coupon.list,
  654. couponTitle = this.$t(`请选择`),
  655. couponId = 0;
  656. for (let i = 0, len = list.length; i < len; i++) {
  657. if (i != index) {
  658. list[i].use_title = '';
  659. list[i].is_use = 0;
  660. }
  661. }
  662. if (list[index].is_use) {
  663. //不使用优惠券
  664. list[index].use_title = '';
  665. list[index].is_use = 0;
  666. } else {
  667. //使用优惠券
  668. list[index].use_title = this.$t(`不使用`);
  669. list[index].is_use = 1;
  670. couponTitle = list[index].coupon_title;
  671. couponId = list[index].id;
  672. }
  673. this.couponTitle = couponTitle;
  674. this.couponId = couponId;
  675. this.$set(this.coupon, 'coupon', false);
  676. this.$set(this.coupon, 'list', list);
  677. this.computedPrice();
  678. },
  679. /**
  680. * 使用积分抵扣
  681. */
  682. ChangeIntegral: function () {
  683. this.useIntegral = !this.useIntegral;
  684. this.computedPrice();
  685. },
  686. /**
  687. * 选择地址后改变事件
  688. * @param object e
  689. */
  690. OnChangeAddress: function (e) {
  691. this.textareaStatus = true;
  692. this.addressId = e;
  693. this.address.address = false;
  694. this.getConfirm()
  695. // this.getaddressInfo();
  696. this.computedPrice();
  697. },
  698. bindHideKeyboard: function (e) {
  699. this.mark = e.detail.value;
  700. },
  701. /**
  702. * 获取当前订单详细信息
  703. *
  704. */
  705. getConfirm: function () {
  706. let that = this;
  707. // uni.showLoading({
  708. // title: that.$t(`正在加载中`),
  709. // mask: true
  710. // });
  711. // getGoodsDetail({ id: that.cartId })
  712. // .then((res) => {
  713. // that.cartInfo = []
  714. // let porject = res.data
  715. // that.zoneType = porject.zoneType
  716. // //找出选择的规格
  717. // porject.goodsSpecList.forEach(element => {
  718. // if (that.goodsSpecId == element.id) {
  719. // porject.unit = element.spceName
  720. // }
  721. // });
  722. // porject.totalSales = that.num
  723. // // 计算总价
  724. // that.totalPrice = (that.num - 0) * (porject.salePrice - 0) + that.freight - 0
  725. // that.cartInfo.push(porject)
  726. // uni.hideLoading()
  727. // })
  728. // .catch((err) => {
  729. // uni.hideLoading()
  730. // return this.$util.Tips({
  731. // title: err
  732. // });
  733. // });
  734. },
  735. /*
  736. * 提取砍价和拼团id
  737. */
  738. getBargainId: function () {
  739. let that = this;
  740. let cartINfo = that.cartInfo;
  741. let BargainId = 0;
  742. let combinationId = 0;
  743. let discountId = 0;
  744. let advanceId = 0;
  745. cartINfo.forEach(function (value, index, cartINfo) {
  746. BargainId = cartINfo[index].bargain_id,
  747. combinationId = cartINfo[index].combination_id,
  748. discountId = cartINfo[index].discount_id,
  749. advanceId = cartINfo[index].advance_id
  750. })
  751. that.$set(that, 'BargainId', parseInt(BargainId));
  752. that.$set(that, 'combinationId', parseInt(combinationId));
  753. that.$set(that, 'discountId', parseInt(discountId));
  754. that.$set(that, 'advanceId', parseInt(advanceId));
  755. if (that.cartArr.length == 3 && (BargainId || combinationId || that.seckillId || discountId)) {
  756. that.cartArr[2].payStatus = 0;
  757. that.$set(that, 'cartArr', that.cartArr);
  758. }
  759. },
  760. /**
  761. * 获取当前金额可用优惠券
  762. *
  763. */
  764. getCouponList: function () {
  765. let that = this;
  766. let data = {
  767. cartId: this.cartId,
  768. 'new': this.news
  769. }
  770. getCouponsOrderPrice(this.totalPrice, data).then(res => {
  771. that.$set(that.coupon, 'list', res.data);
  772. that.openType = 1;
  773. });
  774. },
  775. /*
  776. * 获取默认收货地址或者获取某条地址信息
  777. */
  778. getaddressInfo: function () {
  779. let that = this;
  780. // if (that.addressId) {
  781. // getUserAddressByIdAndFreight({ id: that.addressId }).then(res => {
  782. // res.data.is_default = parseInt(res.data.is_default);
  783. // that.addressInfo = res.data || {};
  784. // that.addressId = res.data.id || 0;
  785. // that.address.addressId = res.data.id || 0;
  786. // })
  787. // } else {
  788. // getAddressDefault().then(res => {
  789. // res.data.is_default = parseInt(res.data.is_default);
  790. // that.addressInfo = res.data || {};
  791. // that.addressId = res.data.id || 0;
  792. // that.address.addressId = res.data.id || 0;
  793. // })
  794. // }
  795. },
  796. payItem: function (e) {
  797. let that = this;
  798. let active = e;
  799. that.active = active;
  800. that.animated = true;
  801. that.payType = that.cartArr[active].value;
  802. that.computedPrice();
  803. setTimeout(function () {
  804. that.car();
  805. }, 500);
  806. },
  807. couponTap: function () {
  808. this.coupon.coupon = true;
  809. this.coupon.list.forEach((item, index) => {
  810. if (item.id == this.couponId) {
  811. item.is_use = 1
  812. } else {
  813. item.is_use = 0
  814. }
  815. })
  816. this.$set(this.coupon, 'list', this.coupon.list);
  817. },
  818. car: function () {
  819. let that = this;
  820. that.animated = false;
  821. },
  822. onAddress: function () {
  823. let that = this;
  824. that.textareaStatus = false;
  825. that.address.address = true;
  826. that.pagesUrl = '/pages/users/user_address_list/index?news=' + this.news + '&cartId=' + this.cartId +
  827. '&pinkId=' +
  828. this.pinkId +
  829. '&couponId=' +
  830. this.couponId;
  831. },
  832. payment (data) {
  833. let that = this;
  834. // postOrderSubmit({
  835. // distributeMode: 1,
  836. // goodsList: [{
  837. // goodsId: that.cartId,
  838. // goodsNum: that.num,
  839. // goodsSpecIds: that.goodsSpecId
  840. // }],
  841. // payType: 1,
  842. // remark: that.remark,
  843. // settleType: 1,
  844. // userAddressId: that.addressInfo.id,
  845. // wlPrice: that.freight
  846. // }).then(res => {
  847. // let status = "",
  848. // orderId = res.data.orderNo,
  849. // jsConfig = {},
  850. // goPages = '/pages/goods/order_pay_status/index?order_id=' + orderId + '&msg=' + "支付成功" +
  851. // '&type=3' + '&totalPrice=' + this.totalPrice
  852. // that.toPay = true;
  853. // uni.requestPayment({
  854. // provider: 'wxpay',
  855. // orderInfo: jsConfig,
  856. // success: (e) => {
  857. // let url = goPages;
  858. // uni.showToast({
  859. // title: that.$t(`支付成功`)
  860. // })
  861. // setTimeout(res => {
  862. // uni.redirectTo({
  863. // url: url
  864. // })
  865. // }, 2000)
  866. // },
  867. // fail: (e) => {
  868. // let url = '/pages/goods/order_pay_status/index?order_id=' +
  869. // orderId +
  870. // '&msg=' + that.$t(`支付失败`);
  871. // uni.showModal({
  872. // content: that.$t(`支付失败`),
  873. // showCancel: false,
  874. // success: function (res) {
  875. // if (res.confirm) {
  876. // uni.redirectTo({
  877. // url: url
  878. // })
  879. // } else if (res.cancel) { }
  880. // }
  881. // })
  882. // },
  883. // complete: () => {
  884. // uni.hideLoading();
  885. // },
  886. // });
  887. // switch (status) {
  888. // case 'ORDER_EXIST':
  889. // case 'EXTEND_ORDER':
  890. // case 'PAY_ERROR':
  891. // uni.hideLoading();
  892. // return that.$util.Tips({
  893. // title: res.msg
  894. // }, {
  895. // tab: 5,
  896. // url: goPages
  897. // });
  898. // break;
  899. // case 'SUCCESS':
  900. // uni.hideLoading();
  901. // if ((that.BargainId || that.combinationId || that.pinkId || that.seckillId || that
  902. // .discountId) && data.payType != 'friend')
  903. // return that.$util.Tips({
  904. // title: res.msg,
  905. // icon: 'success'
  906. // }, {
  907. // tab: 4,
  908. // url: goPages
  909. // });
  910. // return that.$util.Tips({
  911. // title: res.msg,
  912. // icon: 'success'
  913. // }, {
  914. // tab: 4,
  915. // url: data.payType == 'friend' ? friendPay : goPages
  916. // });
  917. // break;
  918. // case 'WECHAT_PAY':
  919. // that.toPay = true;
  920. // // #ifdef MP
  921. // /* that.toPay = true; */
  922. // let mp_pay_name = ''
  923. // if (uni.requestOrderPayment) {
  924. // mp_pay_name = 'requestOrderPayment'
  925. // } else {
  926. // mp_pay_name = 'requestPayment'
  927. // }
  928. // uni[mp_pay_name]({
  929. // timeStamp: jsConfig.timestamp,
  930. // nonceStr: jsConfig.nonceStr,
  931. // package: jsConfig.package,
  932. // signType: jsConfig.signType,
  933. // paySign: jsConfig.paySign,
  934. // success: function (res) {
  935. // uni.hideLoading();
  936. // if (that.BargainId || that.combinationId || that.pinkId || that
  937. // .seckillId || that.discountId)
  938. // return that.$util.Tips({
  939. // title: that.$t(`支付成功`),
  940. // icon: 'success'
  941. // }, {
  942. // tab: 4,
  943. // url: goPages
  944. // });
  945. // return that.$util.Tips({
  946. // title: that.$t(`支付成功`),
  947. // icon: 'success'
  948. // }, {
  949. // tab: 5,
  950. // url: goPages
  951. // });
  952. // },
  953. // fail: function (e) {
  954. // uni.hideLoading();
  955. // return that.$util.Tips({
  956. // title: that.$t(`取消支付`)
  957. // }, {
  958. // tab: 5,
  959. // url: goPages + '&status=2'
  960. // });
  961. // },
  962. // complete: function (e) {
  963. // uni.hideLoading();
  964. // //关闭当前页面跳转至订单状态
  965. // if (res.errMsg == 'requestPayment:cancel' || e.errMsg ==
  966. // 'requestOrderPayment:cancel') return that.$util
  967. // .Tips({
  968. // title: that.$t(`取消支付`)
  969. // }, {
  970. // tab: 5,
  971. // url: goPages + '&status=2'
  972. // });
  973. // },
  974. // })
  975. // // #endif
  976. // // #ifdef H5
  977. // this.$wechat.pay(res.data.result.jsConfig).then(res => {
  978. // return that.$util.Tips({
  979. // title: that.$t(`支付成功`),
  980. // icon: 'success'
  981. // }, {
  982. // tab: 5,
  983. // url: goPages
  984. // });
  985. // }).catch(res => {
  986. // if (!this.$wechat.isWeixin()) {
  987. // uni.redirectTo({
  988. // url: goPages + '&msg=' + that.$t(`支付失败`) + '&status=2'
  989. // // '&msg=支付失败&status=2'
  990. // })
  991. // }
  992. // if (res.errMsg == 'chooseWXPay:cancel') return that.$util.Tips({
  993. // title: that.$t(`取消支付`)
  994. // }, {
  995. // tab: 5,
  996. // url: goPages + '&status=2'
  997. // });
  998. // })
  999. // // #endif
  1000. // // #ifdef APP-PLUS
  1001. // uni.requestPayment({
  1002. // provider: 'wxpay',
  1003. // orderInfo: jsConfig,
  1004. // success: (e) => {
  1005. // let url = goPages;
  1006. // uni.showToast({
  1007. // title: that.$t(`支付成功`)
  1008. // })
  1009. // setTimeout(res => {
  1010. // uni.redirectTo({
  1011. // url: url
  1012. // })
  1013. // }, 2000)
  1014. // },
  1015. // fail: (e) => {
  1016. // let url = '/pages/goods/order_pay_status/index?order_id=' +
  1017. // orderId +
  1018. // '&msg=' + that.$t(`支付失败`);
  1019. // uni.showModal({
  1020. // content: that.$t(`支付失败`),
  1021. // showCancel: false,
  1022. // success: function (res) {
  1023. // if (res.confirm) {
  1024. // uni.redirectTo({
  1025. // url: url
  1026. // })
  1027. // } else if (res.cancel) { }
  1028. // }
  1029. // })
  1030. // },
  1031. // complete: () => {
  1032. // uni.hideLoading();
  1033. // },
  1034. // });
  1035. // // #endif
  1036. // break;
  1037. // case 'PAY_DEFICIENCY':
  1038. // uni.hideLoading();
  1039. // //余额不足
  1040. // return that.$util.Tips({
  1041. // title: res.msg
  1042. // }, {
  1043. // tab: 5,
  1044. // url: goPages + '&status=1'
  1045. // });
  1046. // break;
  1047. // case "WECHAT_H5_PAY":
  1048. // uni.hideLoading();
  1049. // that.$util.Tips({
  1050. // title: that.$t(`订单创建成功`)
  1051. // }, {
  1052. // tab: 4,
  1053. // url: goPages + '&status=0'
  1054. // });
  1055. // setTimeout(() => {
  1056. // location.href = res.data.result.jsConfig.mweb_url;
  1057. // }, 2000);
  1058. // break;
  1059. // case 'ALIPAY_PAY':
  1060. // //#ifdef H5
  1061. // if (this.from === 'weixin') {
  1062. // uni.redirectTo({
  1063. // url: `/pages/users/alipay_invoke/index?id=${orderId}&pay_key=${res.data.result.pay_key}`
  1064. // });
  1065. // } else {
  1066. // uni.hideLoading();
  1067. // that.formContent = res.data.result.jsConfig;
  1068. // that.$nextTick(() => {
  1069. // document.getElementById('alipaysubmit').submit();
  1070. // })
  1071. // }
  1072. // //#endif
  1073. // // #ifdef MP
  1074. // uni.navigateTo({
  1075. // url: `/pages/users/alipay_invoke/index?id=${orderId}&link=${jsConfig.qrCode}`
  1076. // });
  1077. // // #endif
  1078. // // #ifdef APP-PLUS
  1079. // uni.requestPayment({
  1080. // provider: 'alipay',
  1081. // orderInfo: jsConfig,
  1082. // success: (e) => {
  1083. // uni.showToast({
  1084. // title: that.$t(`支付成功`)
  1085. // })
  1086. // let url = '/pages/goods/order_pay_status/index?order_id=' +
  1087. // orderId +
  1088. // '&msg=' + that.$t(`支付成功`);
  1089. // setTimeout(res => {
  1090. // uni.redirectTo({
  1091. // url: url
  1092. // })
  1093. // }, 2000)
  1094. // },
  1095. // fail: (e) => {
  1096. // let url = '/pages/goods/order_pay_status/index?order_id=' +
  1097. // orderId +
  1098. // '&msg=' + that.$t(`支付失败`);
  1099. // uni.showModal({
  1100. // content: that.$t(`支付失败`),
  1101. // showCancel: false,
  1102. // success: function (res) {
  1103. // if (res.confirm) {
  1104. // uni.redirectTo({
  1105. // url: url
  1106. // })
  1107. // } else if (res.cancel) { }
  1108. // }
  1109. // })
  1110. // },
  1111. // complete: () => {
  1112. // uni.hideLoading();
  1113. // },
  1114. // });
  1115. // // #endif
  1116. // break;
  1117. // }
  1118. // }).catch(err => {
  1119. // uni.hideLoading();
  1120. // return that.$util.Tips({
  1121. // title: err
  1122. // });
  1123. // });
  1124. },
  1125. clickTextArea () {
  1126. this.$refs.textarea.focus()
  1127. },
  1128. SubOrder (e) {
  1129. let that = this,
  1130. data = {};
  1131. if (!that.payType) return that.$util.Tips({
  1132. title: that.$t(`请选择支付方式`)
  1133. });
  1134. if (!that.addressId && !that.shippingType && !that.virtual_type) return that.$util.Tips({
  1135. title: that.$t(`请选择收货地址`)
  1136. });
  1137. if (that.shippingType == 1) {
  1138. if (that.contacts == "" || that.contactsTel == "") {
  1139. return that.$util.Tips({
  1140. title: that.$t(`请填写联系人或联系人电话`)
  1141. });
  1142. }
  1143. if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(that.contactsTel)) {
  1144. return that.$util.Tips({
  1145. title: that.$t(`请输入正确的手机号码`)
  1146. });
  1147. }
  1148. if (!that.contacts) {
  1149. return that.$util.Tips({
  1150. title: that.$t(`请输入姓名`)
  1151. });
  1152. }
  1153. if (that.storeList.length == 0) return that.$util.Tips({
  1154. title: that.$t(`暂无门店,请选择其他方式`)
  1155. });
  1156. }
  1157. for (var i = 0; i < that.confirm.length; i++) {
  1158. let data = that.confirm[i]
  1159. if (data.status) {
  1160. if (data.label === 'text' || data.label === 'data' || data.label === 'time' || data.label ===
  1161. 'id') {
  1162. if (!data.value.trim()) {
  1163. return uni.showToast({
  1164. title: that.$t(`请输入`) + `${data.title}`,
  1165. icon: 'none'
  1166. });
  1167. }
  1168. }
  1169. if (data.label === 'number') {
  1170. if (data.value <= 0) {
  1171. return uni.showToast({
  1172. title: that.$t(`请输入`) + `${data.title}`,
  1173. icon: 'none'
  1174. });
  1175. }
  1176. }
  1177. if (data.label === 'email') {
  1178. if (!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(data.value)) {
  1179. return uni.showToast({
  1180. title: that.$t(`请输入正确的`) + `${data.title}`,
  1181. icon: 'none'
  1182. });
  1183. }
  1184. }
  1185. if (data.label === 'phone') {
  1186. if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(data.value)) {
  1187. return uni.showToast({
  1188. title: that.$t(`请输入正确的`) + `${data.title}`,
  1189. icon: 'none'
  1190. });
  1191. }
  1192. }
  1193. if (data.label === 'img') {
  1194. if (!data.value.length) {
  1195. return uni.showToast({
  1196. title: that.$t(`请上传`) + `${data.title}`,
  1197. icon: 'none'
  1198. });
  1199. }
  1200. }
  1201. }
  1202. }
  1203. data = {
  1204. custom_form: that.confirm,
  1205. real_name: that.contacts,
  1206. phone: that.contactsTel,
  1207. addressId: that.addressId,
  1208. formId: '',
  1209. couponId: that.couponId,
  1210. payType: that.payType,
  1211. useIntegral: that.useIntegral,
  1212. bargainId: that.BargainId,
  1213. combinationId: that.combinationId,
  1214. discountId: that.discountId,
  1215. pinkId: that.pinkId,
  1216. advanceId: that.advanceId,
  1217. seckill_id: that.seckillId,
  1218. mark: that.mark,
  1219. store_id: that.system_store ? that.system_store.id : 0,
  1220. 'from': that.from,
  1221. shipping_type: that.$util.$h.Add(that.shippingType, 1),
  1222. 'new': that.news,
  1223. 'invoice_id': that.invChecked,
  1224. // #ifdef H5
  1225. quitUrl: location.protocol + '//' + location.hostname +
  1226. '/pages/goods/order_pay_status/index?' +
  1227. '&type=3' + '&totalPrice=' + this.totalPrice
  1228. // #endif
  1229. // #ifdef APP-PLUS
  1230. quitUrl: '/pages/goods/order_details/index?order_id=' + this.order_id
  1231. // #endif
  1232. };
  1233. if (data.payType == 'yue' && parseFloat(that.userInfo.now_money) < parseFloat(that.totalPrice))
  1234. return that.$util.Tips({
  1235. title: that.$t(`余额不足`)
  1236. });
  1237. uni.showLoading({
  1238. title: that.$t(`订单支付中`)
  1239. });
  1240. // #ifdef MP
  1241. openPaySubscribe().then(() => {
  1242. that.payment(data);
  1243. });
  1244. // #endif
  1245. // #ifndef MP
  1246. that.payment(data);
  1247. // #endif
  1248. },
  1249. bindDateChange: function (e, index) {
  1250. this.confirm[index].value = e.target.value
  1251. },
  1252. bindTimeChange: function (e, index) {
  1253. this.confirm[index].value = e.target.value
  1254. },
  1255. getDate (type) {
  1256. const date = new Date();
  1257. let year = date.getFullYear();
  1258. let month = date.getMonth() + 1;
  1259. let day = date.getDate();
  1260. if (type === 'start') {
  1261. year = year - 60;
  1262. } else if (type === 'end') {
  1263. year = year + 2;
  1264. }
  1265. month = month > 9 ? month : '0' + month;
  1266. day = day > 9 ? day : '0' + day;
  1267. return `${year}-${month}-${day}`;
  1268. },
  1269. uploadpic: function (index, item) {
  1270. let that = this;
  1271. this.canvasStatus = true
  1272. that.$util.uploadImageChange('upload/image', function (res) {
  1273. item.value.push(res.data.url);
  1274. }, (res) => {
  1275. this.canvasStatus = false
  1276. }, (res) => {
  1277. this.canvasWidth = res.w
  1278. this.canvasHeight = res.h
  1279. });
  1280. },
  1281. DelPic: function (index, indexs) {
  1282. let that = this,
  1283. pic = this.confirm[index].value;
  1284. that.confirm[index].value.splice(indexs, 1);
  1285. // that.$set(that, 'pics', that.pics);
  1286. },
  1287. inputTripClick () {
  1288. this.inputTrip = true
  1289. // this.$refs.trip.foucs()
  1290. },
  1291. }
  1292. }
  1293. </script>
  1294. <style lang="scss" scoped>
  1295. /deep/uni-checkbox[disabled] .uni-checkbox-input {
  1296. background-color: #eee;
  1297. }
  1298. .alipaysubmit {
  1299. display: none;
  1300. }
  1301. .order-submission .line {
  1302. width: 100%;
  1303. height: 3rpx;
  1304. }
  1305. .order-submission .line image {
  1306. width: 100%;
  1307. height: 100%;
  1308. display: block;
  1309. }
  1310. .order-submission .address {
  1311. padding: 28rpx 30rpx;
  1312. background-color: #fff;
  1313. box-sizing: border-box;
  1314. }
  1315. .order-submission .address .addressCon {
  1316. width: 610rpx;
  1317. font-size: 26rpx;
  1318. color: #666;
  1319. }
  1320. .order-submission .address .addressCon .name {
  1321. font-size: 30rpx;
  1322. color: #282828;
  1323. font-weight: bold;
  1324. margin-bottom: 10rpx;
  1325. }
  1326. .order-submission .address .addressCon .name .phone {
  1327. margin-left: 50rpx;
  1328. }
  1329. .order-submission .address .addressCon .default {
  1330. margin-right: 12rpx;
  1331. }
  1332. .order-submission .address .addressCon .setaddress {
  1333. color: #333;
  1334. font-size: 28rpx;
  1335. }
  1336. .order-submission .address .iconfont {
  1337. font-size: 35rpx;
  1338. color: #707070;
  1339. }
  1340. .order-submission .allAddress {
  1341. width: 100%;
  1342. background: linear-gradient(to bottom, var(--view-theme) 0%, #f5f5f5 100%);
  1343. padding-top: 100rpx;
  1344. margin-bottom: 12rpx;
  1345. }
  1346. .order-submission .allAddress .nav {
  1347. width: 710rpx;
  1348. margin: 0 auto;
  1349. }
  1350. .order-submission .allAddress .nav .item {
  1351. width: 355rpx;
  1352. }
  1353. .order-submission .allAddress .nav .item.on {
  1354. position: relative;
  1355. width: 250rpx;
  1356. }
  1357. .order-submission .allAddress .nav .item.on::before {
  1358. position: absolute;
  1359. bottom: 0;
  1360. content: "快递配送";
  1361. font-size: 28rpx;
  1362. display: block;
  1363. height: 0;
  1364. width: 336rpx;
  1365. border-width: 0 20rpx 80rpx 0;
  1366. border-style: none solid solid;
  1367. border-color: transparent transparent #fff;
  1368. z-index: 2;
  1369. border-radius: 7rpx 30rpx 0 0;
  1370. text-align: center;
  1371. line-height: 80rpx;
  1372. }
  1373. .order-submission .allAddress .nav .item:nth-of-type(2).on::before {
  1374. content: "到店自提";
  1375. border-width: 0 0 80rpx 20rpx;
  1376. border-radius: 30rpx 7rpx 0 0;
  1377. }
  1378. .order-submission .allAddress .nav .item.on2 {
  1379. position: relative;
  1380. }
  1381. .order-submission .allAddress .nav .item.on2::before {
  1382. position: absolute;
  1383. bottom: 0;
  1384. content: "到店自提";
  1385. font-size: 28rpx;
  1386. display: block;
  1387. height: 0;
  1388. width: 400rpx;
  1389. border-width: 0 0 60rpx 60rpx;
  1390. border-style: none solid solid;
  1391. border-color: transparent transparent rgba(255, 255, 255, 0.6);
  1392. border-radius: 40rpx 6rpx 0 0;
  1393. text-align: center;
  1394. line-height: 60rpx;
  1395. }
  1396. .order-submission .allAddress .nav .item:nth-of-type(1).on2::before {
  1397. content: "快递配送";
  1398. border-width: 0 60rpx 60rpx 0;
  1399. border-radius: 6rpx 40rpx 0 0;
  1400. }
  1401. .order-submission .allAddress .address {
  1402. width: 710rpx;
  1403. height: 150rpx;
  1404. margin: 0 auto;
  1405. }
  1406. .order-submission .allAddress .line {
  1407. width: 710rpx;
  1408. margin: 0 auto;
  1409. }
  1410. .order-submission .wrapper .item .discount .placeholder {
  1411. color: #ccc;
  1412. }
  1413. .placeholder-textarea {
  1414. position: relative;
  1415. .placeholder {
  1416. position: absolute;
  1417. color: #ccc;
  1418. top: 26rpx;
  1419. left: 30rpx;
  1420. }
  1421. }
  1422. .order-submission .wrapper {
  1423. background-color: #fff;
  1424. margin-top: 13rpx;
  1425. }
  1426. .order-submission .wrapper .item {
  1427. padding: 27rpx 30rpx;
  1428. font-size: 30rpx;
  1429. color: #282828;
  1430. border-bottom: 1px solid #f0f0f0;
  1431. .mark {
  1432. background-color: #f9f9f9;
  1433. width: 345px;
  1434. height: 70px;
  1435. border-radius: 1px;
  1436. margin-top: 15px;
  1437. padding: 12px 14px;
  1438. color: #ccc;
  1439. font-size: 28rpx;
  1440. box-sizing: border-box;
  1441. }
  1442. .mark-msg {
  1443. color: #333;
  1444. font-size: 32rpx;
  1445. }
  1446. }
  1447. .order-submission .wrapper .item .discount {
  1448. font-size: 30rpx;
  1449. color: #999;
  1450. }
  1451. .order-submission .wrapper .item .discount input {
  1452. text-align: end;
  1453. }
  1454. .order-submission .wrapper .item .discount .iconfont {
  1455. color: #515151;
  1456. font-size: 30rpx;
  1457. margin-left: 15rpx;
  1458. }
  1459. .order-submission .wrapper .item .discount .num {
  1460. font-size: 32rpx;
  1461. margin-right: 20rpx;
  1462. }
  1463. .order-submission .wrapper .item .shipping {
  1464. font-size: 30rpx;
  1465. color: #999;
  1466. position: relative;
  1467. padding-right: 58rpx;
  1468. }
  1469. .order-submission .wrapper .item .shipping .iconfont {
  1470. font-size: 35rpx;
  1471. color: #707070;
  1472. position: absolute;
  1473. right: 0;
  1474. top: 50%;
  1475. transform: translateY(-50%);
  1476. margin-left: 30rpx;
  1477. }
  1478. .order-submission .wrapper .item textarea {
  1479. background-color: #f9f9f9;
  1480. width: 690rpx;
  1481. height: 140rpx;
  1482. border-radius: 3rpx;
  1483. margin-top: 30rpx;
  1484. padding: 25rpx 28rpx;
  1485. box-sizing: border-box;
  1486. }
  1487. .order-submission .wrapper .item .placeholder {
  1488. color: #ccc;
  1489. font-size: 28rpx;
  1490. }
  1491. .order-submission .wrapper .item .list {
  1492. margin-top: 35rpx;
  1493. }
  1494. .order-submission .wrapper .item .list .payItem {
  1495. border: 1px solid #eee;
  1496. border-radius: 6rpx;
  1497. height: 86rpx;
  1498. width: 100%;
  1499. box-sizing: border-box;
  1500. margin-top: 20rpx;
  1501. font-size: 28rpx;
  1502. color: #282828;
  1503. }
  1504. .order-submission .wrapper .item .list .payItem.on {
  1505. border-color: #fc5445;
  1506. color: #e93323;
  1507. }
  1508. .order-submission .wrapper .item .list .payItem .name {
  1509. width: 50%;
  1510. text-align: center;
  1511. border-right: 1px solid #eee;
  1512. padding-left: 80rpx;
  1513. }
  1514. .order-submission .wrapper .item .list .payItem .name .iconfont {
  1515. width: 44rpx;
  1516. height: 44rpx;
  1517. border-radius: 50%;
  1518. text-align: center;
  1519. line-height: 44rpx;
  1520. background-color: #fe960f;
  1521. color: #fff;
  1522. font-size: 30rpx;
  1523. margin-right: 15rpx;
  1524. }
  1525. .order-submission .wrapper .item .list .payItem .name .iconfont.icon-weixin2 {
  1526. background-color: #41b035;
  1527. }
  1528. .order-submission .wrapper .item .list .payItem .name .iconfont.icon-zhifubao {
  1529. background-color: #1677FF;
  1530. }
  1531. .order-submission .wrapper .item .list .payItem .tip {
  1532. width: 49%;
  1533. text-align: center;
  1534. font-size: 26rpx;
  1535. color: #aaa;
  1536. }
  1537. .order-submission .moneyList {
  1538. margin-top: 12rpx;
  1539. background-color: #fff;
  1540. padding: 30rpx;
  1541. }
  1542. .order-submission .moneyList .item {
  1543. font-size: 28rpx;
  1544. color: #282828;
  1545. }
  1546. .order-submission .moneyList .item~.item {
  1547. margin-top: 20rpx;
  1548. }
  1549. .order-submission .moneyList .item .money {
  1550. color: #868686;
  1551. }
  1552. .order-submission .footer {
  1553. width: 100%;
  1554. height: 100rpx;
  1555. background-color: #fff;
  1556. padding: 0 30rpx;
  1557. font-size: 28rpx;
  1558. color: #333;
  1559. box-sizing: border-box;
  1560. position: fixed;
  1561. bottom: 0;
  1562. left: 0;
  1563. z-index: 9;
  1564. }
  1565. .order-submission .footer .settlement {
  1566. font-size: 30rpx;
  1567. color: #fff;
  1568. width: 240rpx;
  1569. height: 70rpx;
  1570. background-color: var(--view-theme);
  1571. border-radius: 50rpx;
  1572. text-align: center;
  1573. line-height: 70rpx;
  1574. }
  1575. .footer .transparent {
  1576. opacity: 0
  1577. }
  1578. .confirm {
  1579. text-align: right;
  1580. font-size: 22rpx;
  1581. }
  1582. .confirmImg {
  1583. width: 100%;
  1584. .img {
  1585. width: 136rpx;
  1586. height: 136rpx;
  1587. }
  1588. .pictrue {
  1589. width: 136rpx;
  1590. height: 136rpx;
  1591. box-sizing: border-box;
  1592. margin: 18rpx;
  1593. margin-bottom: 35rpx;
  1594. position: relative;
  1595. font-size: 22rpx;
  1596. color: #bbb;
  1597. .del {
  1598. position: absolute;
  1599. top: 0;
  1600. right: 0;
  1601. }
  1602. }
  1603. .bor {
  1604. border: 1rpx solid #ddd;
  1605. }
  1606. }
  1607. .fontC {
  1608. color: grey;
  1609. }
  1610. .all-products-body {
  1611. margin-top: 30rpx;
  1612. .all-products-item {
  1613. display: flex;
  1614. margin-bottom: 20rpx;
  1615. background: #fff;
  1616. image {
  1617. width: 128rpx;
  1618. height: 128rpx;
  1619. margin-right: 20rpx;
  1620. border: 2rpx solid #FFFFFF;
  1621. }
  1622. .all-products-item-content {
  1623. flex-grow: 1;
  1624. display: flex;
  1625. flex-direction: column;
  1626. .all-products-item-content-t {
  1627. flex: 1;
  1628. font-size: 24rpx;
  1629. font-weight: 400;
  1630. color: #333333;
  1631. line-height: 40rpx;
  1632. }
  1633. .all-products-item-content-b {
  1634. flex: 1;
  1635. font-size: 28rpx;
  1636. font-weight: 500;
  1637. line-height: 80rpx;
  1638. display: flex;
  1639. justify-content: space-between;
  1640. .red {
  1641. display: block;
  1642. font-size: 28rpx;
  1643. font-weight: 500;
  1644. color: #B22338 !important;
  1645. margin-right: 10rpx;
  1646. }
  1647. .line-thr {
  1648. display: block;
  1649. font-size: 28rpx;
  1650. font-weight: 400;
  1651. color: #999999;
  1652. text-decoration: line-through;
  1653. }
  1654. }
  1655. }
  1656. }
  1657. }
  1658. .address-info {
  1659. padding: 30rpx 0;
  1660. background: white;
  1661. .a-t {
  1662. padding: 0 30rpx;
  1663. display: flex;
  1664. justify-content: space-between;
  1665. height: 44rpx;
  1666. margin-bottom: 20rpx;
  1667. .t1 {
  1668. height: 44rpx;
  1669. font-size: 32rpx;
  1670. font-weight: 500;
  1671. color: #111111;
  1672. line-height: 44rpx;
  1673. }
  1674. .t2 {
  1675. height: 34rpx;
  1676. font-size: 24rpx;
  1677. font-weight: 400;
  1678. color: #B42A3E;
  1679. line-height: 34rpx;
  1680. image {
  1681. margin-left: 30rpx;
  1682. height: 34rpx;
  1683. width: 34rpx;
  1684. vertical-align: middle;
  1685. }
  1686. }
  1687. }
  1688. .a-m {
  1689. padding: 0 30rpx;
  1690. .am1 {
  1691. display: flex;
  1692. justify-content: space-between;
  1693. margin-bottom: 20rpx;
  1694. .am1-1 {
  1695. height: 40rpx;
  1696. font-size: 28rpx;
  1697. font-weight: 400;
  1698. color: #111111;
  1699. line-height: 40rpx;
  1700. }
  1701. .am1-2 {
  1702. height: 36rpx;
  1703. font-size: 20rpx;
  1704. font-weight: 400;
  1705. color: #666666;
  1706. line-height: 36rpx;
  1707. image {
  1708. margin-left: 30rpx;
  1709. vertical-align: middle;
  1710. height: 34rpx;
  1711. width: 34rpx;
  1712. }
  1713. }
  1714. }
  1715. .am2 {
  1716. margin-bottom: 20rpx;
  1717. height: 34rpx;
  1718. font-size: 24rpx;
  1719. font-weight: 400;
  1720. color: #999999;
  1721. line-height: 34rpx;
  1722. }
  1723. .am3 {
  1724. width: 248rpx;
  1725. height: 44rpx;
  1726. background: #FFF7F8;
  1727. border-radius: 8rpx;
  1728. margin: 20rpx 30rpx;
  1729. margin-top: 0rpx;
  1730. font-size: 20rpx;
  1731. font-weight: 400;
  1732. color: #999999;
  1733. line-height: 44rpx;
  1734. }
  1735. }
  1736. .a-b {
  1737. padding: 0 30rpx;
  1738. width: 100%;
  1739. background: #FFF7F8;
  1740. height: 60rpx;
  1741. line-height: 60rpx;
  1742. margin: 20rpx 30rpx;
  1743. display: flex;
  1744. justify-content: space-between;
  1745. .a-b1 {
  1746. font-size: 20rpx;
  1747. font-weight: 400;
  1748. color: #666666;
  1749. .red {
  1750. font-size: 20rpx;
  1751. font-weight: 500;
  1752. color: #B22338;
  1753. }
  1754. }
  1755. .a-b2 {
  1756. image {
  1757. vertical-align: middle;
  1758. margin-right: 30rpx;
  1759. margin-left: 30rpx;
  1760. height: 34rpx;
  1761. width: 34rpx;
  1762. }
  1763. }
  1764. }
  1765. }
  1766. .payment-details {
  1767. margin-top: 20rpx;
  1768. margin-bottom: 20rpx;
  1769. padding: 30rpx;
  1770. background: white;
  1771. .p-t {
  1772. font-size: 32rpx;
  1773. height: 80rpx;
  1774. font-weight: 500;
  1775. color: #111111;
  1776. line-height: 80rpx;
  1777. }
  1778. .p-b-item {
  1779. height: 60rpx;
  1780. line-height: 60rpx;
  1781. display: flex;
  1782. justify-content: space-between;
  1783. .item-lable {
  1784. font-size: 28rpx;
  1785. font-weight: 400;
  1786. color: #666666;
  1787. }
  1788. .item-value {
  1789. font-size: 28rpx;
  1790. font-weight: 400;
  1791. color: #B22338;
  1792. }
  1793. }
  1794. }
  1795. </style>