index.vue 48 KB

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