index.vue 51 KB

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