index.vue 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430
  1. <template>
  2. <view :style="colorStyle">
  3. <view class='order-submission'>
  4. <view class="allAddress" v-if="product_type == 0">
  5. <!-- #ifdef MP -->
  6. <!-- 桌码信息 -->
  7. <view v-if="tableId" class="table-header">
  8. <view class="top">
  9. <view class="name">{{ codeData.storeName.storeName }}</view>
  10. <view class="number"><text class="light">{{ codeData.category.name }}{{ codeData.table_number }}</text>号桌</view>
  11. </view>
  12. <view>{{ codeData.serial_number }}</view>
  13. </view>
  14. <!-- #endif -->
  15. <!-- 地址 -->
  16. <view v-if="!tableId" class='headerCon'>
  17. <view class="add-title acea-row row-between-wrapper">
  18. <view class="acea-row row-middle">
  19. <view class="icon" :class="deliveryType==1?'':deliveryType==3?'orange':'red'">{{deliveryType==1?'商城配送':deliveryType==2?'门店自提':'门店配送'}}</view>
  20. <view class="text add-text line1" v-if="deliveryType==1">由平台为您提供配送服务</view>
  21. <view class="text add-text line1" v-if="deliveryType==2">线上下单,到店自提</view>
  22. <view class="text add-text line1" v-if="deliveryType==3">{{system_store.name || '请选择门店'}}</view>
  23. </view>
  24. <view class="text" @tap='onDelivery' v-if="(isDisplay.length >1 || (isDisplay.length==1 && deliveryType !=1)) && store_func_status && goodsType != 9">点击切换 <text class='iconfont icon-jiantou'></text></view>
  25. </view>
  26. <view class="address acea-row row-between-wrapper" @tap="onAddress(addressInfo.real_name)" v-if="deliveryType==1 || deliveryType==3">
  27. <view class="addressCon" v-if="addressInfo.real_name">
  28. <view class='name acea-row row-middle'><view class="nameCon line1">{{addressInfo.real_name}}</view><text class='phone'>{{addressInfo.phone}}</text></view>
  29. <view class="line1">
  30. <text class='default font-num'
  31. v-if="addressInfo.is_default">[默认]</text>{{addressInfo.province}}{{addressInfo.city}}{{addressInfo.district}}{{addressInfo.street}}{{addressInfo.detail}}
  32. </view>
  33. </view>
  34. <view class='addressCon' v-else>
  35. <view class='setaddress'>设置收货地址</view>
  36. </view>
  37. <view class="iconfont icon-s-bianji"></view>
  38. </view>
  39. <view class="address acea-row row-between-wrapper" v-else>
  40. <view class="addressCon" v-if="storeList.length>0">
  41. <view class='name acea-row row-middle'><view class="nameCon line1 on">{{system_store.name || ''}}</view></view>
  42. <view class="line1">
  43. {{system_store.address || ''}}{{system_store.detailed_address || ''}}
  44. </view>
  45. </view>
  46. <view class='addressCon' v-else>
  47. <view class='setaddress'>暂无门店信息</view>
  48. </view>
  49. <view class="icon acea-row row-middle" v-if="storeList.length>0">
  50. <view class="iconfont icon-dianhua" @click.stop="call(system_store.phone)"></view>
  51. <view class="iconfont icon-dingwei2" @click.stop="showMaoLocation(system_store)"></view>
  52. </view>
  53. </view>
  54. </view>
  55. <view v-if="!tableId" class='line'>
  56. <image src='/static/images/line.jpg'></image>
  57. </view>
  58. </view>
  59. <view class="wrapper">
  60. <group-goods-list v-if="collage_id" :goods-list="goodsList"></group-goods-list>
  61. <orderGoods v-else :cartInfo="cartInfo" :giveData="giveData" :shippingType="shippingType" :product_type='product_type'
  62. :giveCartInfo="giveCartInfo"></orderGoods>
  63. </view>
  64. <view class='wrapper'>
  65. <view class='item acea-row row-between-wrapper' @tap='couponTap'
  66. v-if="!pinkId && !BargainId && !combinationId && !seckillId&& !noCoupon && !discountId && goodsType != 7 && priceGroup.firstOrderPrice==0">
  67. <view>优惠券</view>
  68. <view class='discount'>{{couponTitle}}
  69. <text class='iconfont icon-jiantou'></text>
  70. </view>
  71. </view>
  72. <view class='item acea-row row-between-wrapper' v-if="!pinkId && !BargainId && !combinationId && !seckillId && integral_ratio_status == 1">
  73. <view>积分抵扣</view>
  74. <view class='discount acea-row row-middle'>
  75. <view> {{useIntegral ? "剩余积分":"当前积分"}}
  76. <text class='num font-color'>{{integral || 0}}</text>
  77. </view>
  78. <checkbox-group @change="ChangeIntegral">
  79. <checkbox :disabled="integral<=0 && !useIntegral" :checked='useIntegral ? true : false' />
  80. </checkbox-group>
  81. </view>
  82. </view>
  83. <view v-if="invoice_func || special_invoice" class='item acea-row row-between-wrapper' @tap="goInvoice">
  84. <view>开具发票</view>
  85. <view class='discount'>
  86. {{invTitle}}
  87. <text class='iconfont icon-jiantou'></text>
  88. </view>
  89. </view>
  90. <!-- <view class='item acea-row row-between-wrapper' v-if="priceGroup.vipPrice > 0 && userInfo.vip && !pinkId && !BargainId && !combinationId && !seckillId">
  91. <view>会员优惠</view>
  92. <view class='discount'>-¥{{priceGroup.vipPrice}}</view>
  93. </view>
  94. <view class='item acea-row row-between-wrapper' v-if='shippingType==0'>
  95. <view>快递费用</view>
  96. <view class='discount' v-if='priceGroup.storePostage > 0'>+¥{{priceGroup.storePostage}}</view>
  97. <view class='discount' v-else>免运费</view>
  98. </view> -->
  99. <view v-if="shippingType == 1">
  100. <view class="item acea-row row-between-wrapper">
  101. <view>联系人</view>
  102. <view class="discount">
  103. <input v-model="contacts" type="text" placeholder="请填写您的联系姓名" placeholder-class="placeholder"></input>
  104. </view>
  105. </view>
  106. <view class="item acea-row row-between-wrapper">
  107. <view>联系电话</view>
  108. <view class="discount">
  109. <input type="number" maxlength="11" v-model="contactsTel" placeholder="请填写您的联系电话"
  110. placeholder-class="placeholder"></input>
  111. </view>
  112. </view>
  113. </view>
  114. <!-- <view class='item acea-row row-between-wrapper' wx:else>
  115. <view>自提门店</view>
  116. <view class='discount'>{{system_store.name}}</view>
  117. </view> -->
  118. <view class='item' v-if="textareaStatus">
  119. <view>备注信息</view>
  120. <!-- <view class="placeholder-textarea"> -->
  121. <textarea placeholder-class='placeholder' placeholder="请添加备注(150字以内)" :always-embed="true" :adjust-position="true" cursor-spacing="30" v-if="!coupon.coupon"
  122. @input='bindHideKeyboard' :value="mark" :maxlength="150" name="mark">
  123. </textarea>
  124. <!-- <view class="placeholder" @click="clickTextArea" v-show="!mark">
  125. 请添加备注(150字以内)
  126. </view> -->
  127. <!-- </view> -->
  128. </view>
  129. </view>
  130. <view class='wrapper' v-if="confirm.length">
  131. <view class='item acea-row row-between-wrapper' :class="{on:(item.name=='radios' || item.name=='checkboxs'),on2:item.name == 'dateranges',on3:item.name == 'citys'}" v-for="(item,index) in confirm" :key="index">
  132. <view class="name">
  133. <span class="asterisk" v-if="item.titleShow.val">*</span>
  134. {{ item.titleConfig.value }}
  135. </view>
  136. <!-- radio -->
  137. <view v-if="item.name=='radios'" class="discount">
  138. <radio-group @change="radioChange(e, index, item)" class="acea-row row-middle row-right">
  139. <label class="radio" v-for="(j,jindex) in item.wordsConfig.list" :key="jindex">
  140. <view class="acea-row row-middle">
  141. <!-- #ifndef MP -->
  142. <radio :value="jindex.toString()" :checked='j.show'/>
  143. <!-- #endif -->
  144. <!-- #ifdef MP -->
  145. <radio :value="jindex" :checked='j.show'/>
  146. <!-- #endif -->
  147. <view>{{j.val}}</view>
  148. </view>
  149. </label>
  150. </radio-group>
  151. </view>
  152. <!-- checkbox -->
  153. <view v-if="item.name=='checkboxs'" class="discount">
  154. <checkbox-group @change="checkboxChange($event, index, item)" class="acea-row row-middle row-right">
  155. <label class="radio" v-for="(j,jindex) in item.wordsConfig.list" :key="jindex">
  156. <view class="acea-row row-middle">
  157. <!-- #ifndef MP -->
  158. <checkbox :value="jindex.toString()" :checked="j.show" style="transform:scale(0.9)" />
  159. <!-- #endif -->
  160. <!-- #ifdef MP -->
  161. <checkbox :value="jindex" :checked="j.show" style="transform:scale(0.9)" />
  162. <!-- #endif -->
  163. <view>{{j.val}}</view>
  164. </view>
  165. </label>
  166. </checkbox-group>
  167. </view>
  168. <!-- text -->
  169. <view v-if="item.name=='texts' && item.valConfig.tabVal == 0" class="discount">
  170. <input type="text" :placeholder="item.tipConfig.value" placeholder-class="placeholder" v-model="item.value" />
  171. </view>
  172. <!-- number -->
  173. <view v-if="item.name=='texts' && item.valConfig.tabVal == 4" class="discount">
  174. <input type="number" :placeholder="item.tipConfig.value" placeholder-class="placeholder" v-model="item.value" />
  175. </view>
  176. <!-- email -->
  177. <view v-if="item.name=='texts' && item.valConfig.tabVal == 3" class="discount">
  178. <input type="text" :placeholder="item.tipConfig.value" placeholder-class="placeholder" v-model="item.value" />
  179. </view>
  180. <!-- data -->
  181. <view v-if="item.name=='dates'" class="discount">
  182. <picker mode="date" :value="item.value" @change="bindDateChange($event,index)">
  183. <view class="acea-row row-between-wrapper">
  184. <view v-if="item.value == ''">{{item.tipConfig.value}}</view>
  185. <view v-else>{{item.value}}</view>
  186. <text class='iconfont icon-jiantou'></text>
  187. </view>
  188. </picker>
  189. </view>
  190. <!-- dateranges -->
  191. <view v-if="item.name=='dateranges'" class="discount">
  192. <uni-datetime-picker v-model="item.value" type="daterange" @maskClick="maskClick">
  193. {{item.value.length?item.value[0]+' - '+item.value[1]:item.tipConfig.value}}
  194. <text class='iconfont icon-jiantou'></text>
  195. </uni-datetime-picker>
  196. </view>
  197. <!-- time -->
  198. <view v-if="item.name=='times'" class="discount">
  199. <picker mode="time" :value="item.value" @change="bindTimeChange($event,index)"
  200. :placeholder="item.tipConfig.value">
  201. <view class="acea-row row-between-wrapper">
  202. <view v-if="item.value == ''">{{item.tipConfig.value}}</view>
  203. <view v-else>{{item.value}}</view>
  204. <text class='iconfont icon-jiantou'></text>
  205. </view>
  206. </picker>
  207. </view>
  208. <!-- timeranges -->
  209. <view v-if="item.name=='timeranges'" class="discount acea-row row-between-wrapper" @click="getTimeranges(index)">
  210. <view v-if="item.value">{{item.value}}</view>
  211. <view v-else>{{item.tipConfig.value}}</view>
  212. <text class='iconfont icon-jiantou'></text>
  213. </view>
  214. <!-- select -->
  215. <view v-if="item.name=='selects'" class="discount">
  216. <picker :value="item.value" :range="item.wordsConfig.list" @change="bindSelectChange($event,index,item)" range-key="val">
  217. <view class="acea-row row-between-wrapper">
  218. <view v-if="item.value == ''">请选择</view>
  219. <view v-else>{{item.value}}</view>
  220. <text class='iconfont icon-jiantou'></text>
  221. </view>
  222. </picker>
  223. </view>
  224. <!-- city -->
  225. <view v-if="item.name=='citys'" class="discount" @click="changeRegion(index)">
  226. <view class="acea-row row-middle row-right">
  227. <view class="city" v-if="item.value == ''">{{item.tipConfig.value}}</view>
  228. <view class="city" v-else>{{item.value}}</view>
  229. <text class='iconfont icon-jiantou'></text>
  230. </view>
  231. </view>
  232. <!-- id -->
  233. <view v-if="item.name=='texts' && item.valConfig.tabVal == 2" class="discount">
  234. <input type="idcard" :placeholder="item.tipConfig.value" placeholder-class="placeholder" v-model="item.value" />
  235. </view>
  236. <!-- phone -->
  237. <view v-if="item.name=='texts' && item.valConfig.tabVal == 1" class="discount">
  238. <input type="number" :placeholder="item.tipConfig.value" placeholder-class="placeholder" v-model="item.value" />
  239. </view>
  240. <!-- img -->
  241. <view v-if="item.name=='uploadPicture'" class="confirmImg">
  242. <view class='upload acea-row row-middle'>
  243. <view class='pictrue' v-for="(items,indexs) in item.value" :key="indexs">
  244. <image :src='items' mode="aspectFill"></image>
  245. <!-- <view class='iconfont icon-guanbi1 font-num' @tap='DelPic(index,indexs)'></view> -->
  246. <view class="close acea-row row-center-wrapper" @tap='DelPic(index,indexs)'>
  247. <view class="iconfont icon-guanbi5"></view>
  248. </view>
  249. </view>
  250. <view class='pictrue acea-row row-center-wrapper row-column' @tap='uploadpic(index)'
  251. v-if="item.value.length < item.numConfig.val">
  252. <text class='iconfont icon-icon25201'></text>
  253. <view>上传图片</view>
  254. </view>
  255. </view>
  256. </view>
  257. </view>
  258. </view>
  259. <view class='moneyList'>
  260. <view class='item acea-row row-between-wrapper'>
  261. <view>商品总价:</view>
  262. <!-- {{(parseFloat(priceGroup.totalPrice)+parseFloat(priceGroup.vipPrice)).toFixed(2)}} -->
  263. <view class='money'>
  264. ¥{{priceGroup.sumPrice}}
  265. </view>
  266. </view>
  267. <view class='item acea-row row-between-wrapper' v-if="priceGroup.storePostage > 0">
  268. <view>配送运费:</view>
  269. <view class='money'>
  270. ¥{{(parseFloat(priceGroup.storePostage)+parseFloat(priceGroup.storePostageDiscount)).toFixed(2)}}
  271. </view>
  272. </view>
  273. <view class='item acea-row row-between-wrapper'
  274. v-if="priceGroup.vipPrice > 0 && userInfo.vip && !pinkId && !BargainId && !combinationId && !seckillId && !discountId">
  275. <view>会员商品优惠:</view>
  276. <view class='money'>-¥{{parseFloat(priceGroup.vipPrice).toFixed(2)}}</view>
  277. </view>
  278. <view class='item acea-row row-between-wrapper' v-if="priceGroup.storePostageDiscount > 0">
  279. <view>会员运费优惠:</view>
  280. <view class='money'>-¥{{parseFloat(priceGroup.storePostageDiscount).toFixed(2)}}</view>
  281. </view>
  282. <view class='item acea-row row-between-wrapper' v-if="coupon_price > 0">
  283. <view>优惠券抵扣:</view>
  284. <view class='money'>-¥{{parseFloat(coupon_price).toFixed(2)}}</view>
  285. </view>
  286. <view class='item acea-row row-between-wrapper' v-if="parseFloat(priceGroup.firstOrderPrice) > 0">
  287. <view>新人首单优惠:</view>
  288. <view class='money'>-¥{{parseFloat(priceGroup.firstOrderPrice).toFixed(2)}}</view>
  289. </view>
  290. <view class='item acea-row row-between-wrapper' v-if="integral_price > 0">
  291. <view>积分抵扣:</view>
  292. <view class='money'>-¥{{parseFloat(integral_price).toFixed(2)}}</view>
  293. </view>
  294. <view class='item acea-row row-between' v-for="(item,index) in promotions_detail" :key="index"
  295. v-if="parseFloat(item.promotions_price)">
  296. <view>{{item.title}}:</view>
  297. <view class='money'>-¥{{parseFloat(item.promotions_price).toFixed(2)}}</view>
  298. </view>
  299. <!-- <view class='item acea-row row-between-wrapper' v-if="priceGroup.storePostage > 0">
  300. <view>运费:</view>
  301. <view class='money'>+¥{{priceGroup.storePostage}}</view>
  302. </view>
  303. <view class='item acea-row row-between-wrapper' v-if="priceGroup.storePostageDiscount > 0">
  304. <view>会员运费抵扣:</view>
  305. <view class='money'>-¥{{priceGroup.storePostageDiscount}}</view>
  306. </view> -->
  307. </view>
  308. <view class="height-add"></view>
  309. <view class='footer acea-row row-between-wrapper'>
  310. <view>合计:
  311. <text class='font-color'>¥{{totalPrice || 0}}</text>
  312. </view>
  313. <!-- <view class='settlement' style='z-index:100' @tap.stop="goPay"
  314. v-if="(((valid_count>0&&!discount_id) || (valid_count==cartInfo.length&&discount_id)) && shippingType) || (!shippingType && addressId) || product_type != 0">
  315. 立即结算</view>
  316. <view class='settlement bg-color-hui' style='z-index:100' v-else>立即结算</view> -->
  317. <view class='settlement' style='z-index:100' @tap.stop="goPay"
  318. v-if="
  319. (((valid_count>0&&!discount_id) || (valid_count==cartInfo.length&&discount_id))) ||
  320. (deliveryType == 2 && !shippingType) ||
  321. (deliveryType == 3 && shippingType) ||
  322. product_type != 0"
  323. >
  324. 提交订单</view>
  325. <view class='settlement bg-color-hui' style='z-index:100' v-else>提交订单</view>
  326. </view>
  327. </view>
  328. <view class="alipaysubmit" v-html="formContent"></view>
  329. <view class="tipaddress" v-show="isaddress">
  330. <view class="top"></view>
  331. <view class="bottom">
  332. <div class="font1">更新地址</div>
  333. <div class="font2">当前地址功能已更新,请重新修改</div>
  334. <div class="btn" @tap="payAddress">前往修改</div>
  335. </view>
  336. </view>
  337. <view class="mark" v-show="isaddress"></view>
  338. <couponListWindow :coupon='coupon' @ChangCouponsClone="ChangCouponsClone" :openType='openType' :cartId='cartId'
  339. @ChangCoupons="ChangCoupons"></couponListWindow>
  340. <addressWindow ref="addressWindow" @changeTextareaStatus="changeTextareaStatus" :news='news' :address='address'
  341. :pagesUrl="pagesUrl" @OnChangeAddress="OnChangeAddress" @changeClose="changeClose">
  342. </addressWindow>
  343. <home v-show="!invShow && navigation"></home>
  344. <invoice-picker :inv-show="invShow" :inv-list="invList" :inv-checked="invChecked" :is-special="special_invoice"
  345. :url-query="urlQuery" @inv-close="invClose" @inv-change="invChange" @inv-cancel="invCancel">
  346. </invoice-picker>
  347. <payment :payMode="cartArr" :pay_close="pay_close" :isCall="true" :totalPrice="totalPrice.toString()"
  348. @changePayType="changePayType" @onChangeFun="onChangeFun"></payment>
  349. <deliveryMethod ref="deliveryMethod" :isDisplay="isDisplay" :storeList="storeList" :storeSelfMention="store_self_mention" @deliveryFun="deliveryFun" @storeFun="storeFun"></deliveryMethod>
  350. <!-- #ifdef MP -->
  351. <!-- <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize> -->
  352. <!-- #endif -->
  353. <timeranges :isShow='isShow' :time='timeranges' @confrim="confrim" @cancel="cancels"></timeranges>
  354. <areaWindow ref="areaWindow" :display="display" :address='addressInfoArea' :cityShow='cityShow' @submit="OnAreaAddress" @changeClose="changeAddressClose"></areaWindow>
  355. </view>
  356. </template>
  357. <script>
  358. const CACHE_CITY = {};
  359. import dayjs from '@/plugin/dayjs/dayjs.min.js';
  360. import {
  361. orderConfirm,
  362. getCouponsOrderPrice,
  363. orderCreate,
  364. postOrderComputed,
  365. checkShipping
  366. } from '@/api/order.js';
  367. import {
  368. getAddressDefault,
  369. getAddressDetail,
  370. invoiceList,
  371. invoiceOrder
  372. } from '@/api/user.js';
  373. import {
  374. openPaySubscribe
  375. } from '@/utils/SubscribeMessage.js';
  376. import {
  377. storeListApi,
  378. getCollagePartake,
  379. getCodeData
  380. } from '@/api/store.js';
  381. import {
  382. CACHE_LONGITUDE,
  383. CACHE_LATITUDE
  384. } from '@/config/cache.js';
  385. import areaWindow from '@/components/areaWindow';
  386. import couponListWindow from '@/components/couponListWindow';
  387. import addressWindow from '@/components/addressWindow';
  388. import orderGoods from '@/components/orderGoods';
  389. import deliveryMethod from '../components/deliveryMethod/index.vue';
  390. import timeranges from '@/components/timeranges';
  391. import home from '@/components/home';
  392. import invoicePicker from '../components/invoicePicker';
  393. import groupGoodsList from '@/components/groupGoodsList/index.vue'
  394. import {
  395. toLogin
  396. } from '@/libs/login.js';
  397. import {
  398. mapGetters
  399. } from "vuex";
  400. import payment from '@/components/payment';
  401. import colors from "@/mixins/color";
  402. export default {
  403. components: {
  404. payment,
  405. invoicePicker,
  406. couponListWindow,
  407. addressWindow,
  408. orderGoods,
  409. home,
  410. deliveryMethod,
  411. timeranges,
  412. areaWindow,
  413. groupGoodsList
  414. },
  415. mixins: [colors],
  416. data() {
  417. return {
  418. addressInfoArea: [],
  419. cityShow: 2,
  420. display: false,
  421. timeranges:[],
  422. isShow:false,
  423. giveData: {
  424. give_integral: 0,
  425. give_coupon: []
  426. },
  427. giveCartInfo: [],
  428. confirm: [], //自定义留言
  429. id: 0,
  430. isaddress: false,
  431. textareaStatus: true,
  432. //支付方式
  433. cartArr: [{
  434. "name": "微信支付",
  435. "icon": "icon-weixin2",
  436. value: 'weixin',
  437. title: '使用微信快捷支付',
  438. payStatus: 1,
  439. },
  440. {
  441. "name": "支付宝支付",
  442. "icon": "icon-zhifubao",
  443. value: 'alipay',
  444. title: '使用线上支付宝支付',
  445. payStatus: 1,
  446. },
  447. {
  448. "name": "余额支付",
  449. "icon": "icon-yuezhifu",
  450. value: 'yue',
  451. title: '可用余额:',
  452. payStatus: 1,
  453. },
  454. {
  455. "name": "线下支付",
  456. "icon": "icon-yuezhifu1",
  457. value: 'offline',
  458. title: '选择线下付款方式',
  459. payStatus: 2,
  460. }
  461. ],
  462. formContent: '',
  463. payType: 'weixin', //支付方式
  464. openType: 1, //优惠券打开方式 1=使用
  465. active: 0, //支付方式切换
  466. coupon: {
  467. coupon: false,
  468. list: [],
  469. statusTile: '立即使用'
  470. }, //优惠券组件
  471. address: {
  472. address: false
  473. }, //地址组件
  474. addressInfo: {}, //地址信息
  475. pinkId: 0, //拼团id
  476. addressId: 0, //地址id
  477. couponId: 0, //优惠券id
  478. cartId: '', //购物车id
  479. BargainId: 0,
  480. combinationId: 0,
  481. seckillId: 0,
  482. discountId: 0,
  483. userInfo: {}, //用户信息
  484. mark: '', //备注信息
  485. couponTitle: '请选择', //优惠券
  486. coupon_price: 0, //优惠券抵扣金额
  487. promotions_detail: [], //优惠活动金额明细
  488. useIntegral: false, //是否使用积分
  489. integral_price: 0, //积分抵扣金额
  490. integral: 0,
  491. ChangePrice: 0, //使用积分抵扣变动后的金额
  492. formIds: [], //收集formid
  493. status: 0,
  494. is_address: false,
  495. toPay: false, //修复进入支付时页面隐藏从新刷新页面
  496. shippingType: 0,
  497. system_store: {},
  498. storePostage: 0,
  499. contacts: '',
  500. contactsTel: '',
  501. mydata: {},
  502. storeList: [],
  503. store_self_mention: 0,//是开启门店自提;
  504. store_func_status: false,//是否开启门店自提和门店配送;
  505. cartInfo: [],
  506. priceGroup: {},
  507. animated: false,
  508. totalPrice: 0,
  509. integralRatio: "0",
  510. pagesUrl: "",
  511. orderKey: "",
  512. // usableCoupon: {},
  513. offlinePostage: "",
  514. isAuto: false, //没有授权的不会自动授权
  515. isShowAuth: false, //是否隐藏授权
  516. from: '',
  517. news: 1,
  518. invTitle: '不开发票',
  519. special_invoice: false,
  520. invoice_func: false,
  521. integral_ratio_status : 1,
  522. header_type: '',
  523. invShow: false,
  524. invList: [],
  525. invChecked: '',
  526. urlQuery: '',
  527. pay_close: false,
  528. noCoupon: 0,
  529. valid_count: 0,
  530. discount_id: 0,
  531. storeId: 0,
  532. product_type: 1,
  533. newImg: [],
  534. isDisplay: [],
  535. deliveryType:1,
  536. goodsType:0,
  537. product_id:0,
  538. selectIndex:0,
  539. timerangesIndex:0,
  540. collage_id: 0,
  541. goodsList: [],
  542. tableId: 0,
  543. codeData: {}
  544. };
  545. },
  546. computed: mapGetters(['isLogin']),
  547. onLoad: function(options) {
  548. // #ifdef H5
  549. this.from = this.$wechat.isWeixin() ? 'weixin' : 'weixinh5'
  550. // #endif
  551. // #ifdef MP
  552. this.from = 'routine'
  553. // #endif
  554. if (!options.cartId) return this.$util.Tips({
  555. title: '请选择要购买的商品'
  556. }, {
  557. tab: 3,
  558. url: 1
  559. });
  560. this.deliveryType = options.delivery_type || 1;
  561. if(this.deliveryType == 1 || this.deliveryType == 3){
  562. this.addressId = options.addressId || 0;
  563. this.system_store.name = options.store_name;
  564. }
  565. if(this.deliveryType == 2 || this.deliveryType == 3){
  566. this.storeId = options.store_id || 0;
  567. this.system_store.id = options.store_id || 0;
  568. }
  569. this.couponId = options.couponId || 0;
  570. this.noCoupon = options.noCoupon || 0;
  571. this.product_id = options.product_id || 0;
  572. this.pinkId = options.pinkId ? parseInt(options.pinkId) : 0;
  573. this.cartId = options.cartId;
  574. this.is_address = options.is_address ? true : false;
  575. this.news = !options.new || options.new === '0' ? 0 : 1;
  576. uni.setStorageSync('news', this.news);
  577. this.invChecked = options.invoice_id || '';
  578. this.header_type = options.header_type || '1';
  579. this.couponTitle = options.couponTitle || '请选择'
  580. switch (options.invoice_type) {
  581. case '1':
  582. this.invTitle = '增值税电子普通发票';
  583. break;
  584. case '2':
  585. this.invTitle = '增值税电子专用发票';
  586. break;
  587. }
  588. if (options.invoice_name) {
  589. this.invTitle = options.invoice_name;
  590. }
  591. // #ifndef APP-PLUS
  592. this.textareaStatus = true;
  593. // #endif
  594. if (this.isLogin && this.toPay == false) {
  595. this.getCheckShipping();
  596. } else {
  597. toLogin();
  598. }
  599. this.collage_id = options.collage_id || 0;
  600. if (this.collage_id) {
  601. this.getCollagePartake();
  602. }
  603. // #ifdef MP
  604. // 桌码
  605. this.tableId = options.tableId || 0;
  606. if (this.tableId) {
  607. this.getCodeData();
  608. }
  609. // #endif
  610. },
  611. /**
  612. * 生命周期函数--监听页面显示
  613. */
  614. onShow: function() {
  615. uni.removeStorageSync('form_type_cart');
  616. let _this = this
  617. uni.$on("handClick", res => {
  618. if (res) {
  619. _this.system_store = res.address
  620. _this.storeId = _this.system_store.id
  621. _this.cartId = res.cartId
  622. _this.news = res.new
  623. _this.pinkId = Number(res.pinkId)
  624. _this.couponId = res.couponId
  625. _this.getConfirm()
  626. }
  627. // 清除监听
  628. uni.$off('handClick');
  629. })
  630. let current = (dayjs(new Date(Number(new Date().getTime()))).format('HH:mm')).split(':');
  631. let currentArray = current;
  632. currentArray.push(0);
  633. let arrayNew = [];
  634. [...currentArray,...current].forEach(item=>{
  635. arrayNew.push(Number(item))
  636. })
  637. this.timeranges = arrayNew;
  638. },
  639. methods: {
  640. // #ifdef MP
  641. // 桌码信息
  642. getCodeData() {
  643. getCodeData({
  644. tableId: this.tableId
  645. }).then(res => {
  646. this.codeData = res.data;
  647. });
  648. },
  649. // #endif
  650. getCollagePartake() {
  651. getCollagePartake({
  652. collage_id: this.collage_id
  653. }).then(res => {
  654. this.goodsList = res.data;
  655. });
  656. },
  657. OnAreaAddress(address){
  658. let addr = '';
  659. if (address.length==4){
  660. addr = address[0].label+'/'+address[1].label+'/'+address[2].label+'/'+address[3].label;
  661. }else if (address.length==3){
  662. addr = address[0].label+'/'+address[1].label+'/'+address[2].label;
  663. }else if(address.length==2){
  664. addr = address[0].label+'/'+address[1].label;
  665. }else{
  666. addr = address[0].label;
  667. }
  668. this.confirm[this.timerangesIndex].value = addr;
  669. CACHE_CITY[this.timerangesIndex] = address;
  670. },
  671. changeRegion(index){
  672. if(!this.confirm[index].value){
  673. this.addressInfoArea = [];
  674. }
  675. this.timerangesIndex = index;
  676. this.cityShow = Number(this.confirm[index].valConfig.tabVal) + 1;
  677. this.display = true;
  678. if(CACHE_CITY[index]){
  679. this.addressInfoArea = CACHE_CITY[index];
  680. }
  681. },
  682. // 关闭地址弹窗;
  683. changeAddressClose: function() {
  684. this.display = false;
  685. },
  686. maskClick(e) {
  687. console.log(e);
  688. },
  689. // 授权关闭
  690. authColse: function(e) {
  691. this.isShowAuth = e
  692. },
  693. showMaoLocation(e) {
  694. let self = this;
  695. // #ifdef H5
  696. if (self.$wechat.isWeixin()) {
  697. self.$wechat.seeLocation({
  698. latitude: Number(e.latitude),
  699. longitude: Number(e.longitude),
  700. name: e.name,
  701. scale: 13,
  702. address: `${e.address}-${e.detailed_address}`,
  703. }).then(res => {})
  704. } else {
  705. // #endif
  706. uni.openLocation({
  707. latitude: Number(e.latitude),
  708. longitude: Number(e.longitude),
  709. name: e.name,
  710. address: `${e.address}-${e.detailed_address}`,
  711. success: function() {
  712. Number
  713. }
  714. });
  715. // #ifdef H5
  716. }
  717. // #endif
  718. },
  719. call(phone) {
  720. uni.makePhoneCall({
  721. phoneNumber: phone,
  722. });
  723. },
  724. // 选中配送类型
  725. deliveryFun(e,item){
  726. this.deliveryType = e;
  727. this.$refs.deliveryMethod.module = false;
  728. if(e==2){
  729. this.storeId = item.id;
  730. }else{
  731. if(e == 3){
  732. this.storeId = item.id;
  733. if(this.isDisplay.includes("2") && this.isDisplay.includes("3")){
  734. this.getaddressInfo();
  735. this.$nextTick(function() {
  736. this.$refs.addressWindow.getAddressList();
  737. })
  738. }
  739. }
  740. this.system_store = item;
  741. }
  742. if(e == 1 || e == 3){
  743. this.addressType(0,e);
  744. }else{
  745. this.addressType(1,e);
  746. }
  747. },
  748. // 选择配送方式
  749. onDelivery() {
  750. this.$refs.deliveryMethod.module = true
  751. },
  752. // 子集调用门店列表接口
  753. storeFun(index){
  754. this.getList(1,index);
  755. },
  756. // 是否显示快递配送
  757. getCheckShipping() {
  758. let data = {
  759. cartId: this.cartId,
  760. new: this.news
  761. }
  762. checkShipping(data).then(res => {
  763. // 1:快递配送,2:到店自提,3:门店配送
  764. res.data.type.sort((x,y)=>x - y)//正序
  765. this.isDisplay = res.data.type;
  766. if (((this.isDisplay.includes("2") && this.isDisplay.length == 1) || (this.deliveryType == 2 && !this.tableId) || (this.deliveryType == 3 && this.storeId>0 && !this.system_store.name)) && this.isDisplay.length) {
  767. if((this.deliveryType == 2 || (this.deliveryType == 3 && !this.isDisplay.includes("3"))) && this.isDisplay.includes("2")){
  768. this.deliveryType = 2
  769. this.addressType(1,this.deliveryType);
  770. }
  771. if((this.deliveryType == 3 || (this.deliveryType == 2 && !this.isDisplay.includes("2"))) && this.isDisplay.includes("3")){
  772. this.deliveryType = 3
  773. this.addressType(0,this.deliveryType);
  774. this.getaddressInfo();
  775. this.$nextTick(function() {
  776. this.$refs.addressWindow.getAddressList();
  777. })
  778. }
  779. } else {
  780. this.getaddressInfo();
  781. this.getConfirm();
  782. this.$nextTick(function() {
  783. this.$refs.addressWindow.getAddressList();
  784. })
  785. }
  786. }).catch(err => {
  787. uni.showToast({
  788. title: err,
  789. icon: 'none'
  790. });
  791. })
  792. },
  793. /**
  794. * 删除图片
  795. *
  796. */
  797. DelPic: function(index, indexs) {
  798. let that = this,
  799. pic = this.confirm[index].value;
  800. that.confirm[index].value.splice(indexs, 1);
  801. that.$set(that.confirm[index], 'value', that.confirm[index].value);
  802. },
  803. /**
  804. * 上传文件
  805. *
  806. */
  807. uploadpic: function(index) {
  808. let that = this;
  809. this.$util.uploadImageOne('upload/image', function(res) {
  810. that.newImg.push(res.data.url);
  811. that.$set(that.confirm[index], 'value', that.newImg);
  812. });
  813. },
  814. // 不开发票
  815. invCancel() {
  816. this.invChecked = '';
  817. this.invTitle = '不开发票';
  818. this.invShow = false;
  819. },
  820. // 选择发票
  821. invChange(id) {
  822. this.invChecked = id;
  823. this.invShow = false;
  824. const result = this.invList.find(item => item.id === id);
  825. let name = '';
  826. name += result.header_type === 1 ? '个人' : '企业';
  827. name += result.type === 1 ? '普通' : '专用';
  828. name += '发票';
  829. this.invTitle = name;
  830. },
  831. // 关闭发票
  832. invClose() {
  833. this.invShow = false;
  834. this.getInvoiceList()
  835. },
  836. getInvoiceList() {
  837. uni.showLoading({
  838. title: '正在加载…'
  839. })
  840. invoiceList().then(res => {
  841. uni.hideLoading();
  842. this.invList = res.data.map(item => {
  843. item.id = item.id.toString();
  844. return item;
  845. });
  846. const result = this.invList.find(item => item.id == this.invChecked);
  847. if (result) {
  848. let name = '';
  849. name += result.header_type === 1 ? '个人' : '企业';
  850. name += result.type === 1 ? '普通' : '专用';
  851. name += '发票';
  852. this.invTitle = name;
  853. }
  854. }).catch(err => {
  855. uni.showToast({
  856. title: err,
  857. icon: 'none'
  858. });
  859. });
  860. },
  861. /**
  862. * 开发票
  863. */
  864. goInvoice: function() {
  865. this.getInvoiceList()
  866. this.invShow = true;
  867. this.urlQuery =
  868. `new=${this.news}&cartId=${this.cartId}&pinkId=${this.pinkId}&couponId=${this.couponId}&addressId=${this.addressId}&specialInvoice=${this.special_invoice}&couponTitle=${this.couponTitle}&delivery_type=${this.deliveryType}&store_id=${this.storeId}&store_name=${this.system_store.name}&product_id=${this.product_id}`;
  869. },
  870. /**
  871. * 授权回调事件
  872. *
  873. */
  874. onLoadFun: function() {
  875. this.getCheckShipping();
  876. this.isShowAuth = false;
  877. //调用子页面方法授权后执行获取地址列表
  878. // this.$scope.selectComponent('#address-window').getAddressList();
  879. },
  880. /**
  881. * 事件回调
  882. *
  883. */
  884. onChangeFun: function(e) {
  885. let opt = e;
  886. let action = opt.action || null;
  887. let value = opt.value != undefined ? opt.value : null;
  888. action && this[action] && this[action](value);
  889. },
  890. payClose: function() {
  891. this.pay_close = false;
  892. },
  893. goPay() {
  894. uni.showModal({
  895. title: '温馨提示',
  896. content: '此笔交易一旦确认支付,将无法申请退款!(除质量问题可换货)',
  897. success: res => {
  898. if(res.confirm){
  899. this.formVerify();
  900. }
  901. },
  902. fail: () => {},
  903. complete: () => {}
  904. });
  905. },
  906. payCheck(type) {
  907. this.payType = type;
  908. this.SubOrder();
  909. },
  910. payAddress() {
  911. uni.navigateTo({
  912. // /pages/users/user_address/index?id=25&cartId=76179610656654229504&pinkId=0&couponId=0&new=1
  913. url: '/pages/users/user_address/index?id=' + this.id + '&new=' + this.news + '&cartId=' + this.cartId +
  914. '&pinkId=' +
  915. this.pinkId +
  916. '&couponId=' +
  917. this.couponId +'&delivery_type='+this.deliveryType+'&addressId='+this.addressId+'&store_id='+this.storeId+'&store_name='+ this.system_store.name+'&product_id='+this.product_id
  918. })
  919. },
  920. /**
  921. * 获取门店列表数据
  922. */
  923. getList: function(fromType,index) {
  924. let longitude = uni.getStorageSync("user_longitude"); //经度
  925. let latitude = uni.getStorageSync("user_latitude"); //纬度
  926. let data = {
  927. latitude: latitude, //纬度
  928. longitude: longitude, //经度
  929. page: 1,
  930. limit: 100,
  931. type: this.seckillId>0?1:0,
  932. product_id: this.product_id,
  933. is_store: index
  934. }
  935. storeListApi(data).then(res => {
  936. let list = res.data.list.list || [];
  937. this.$set(this, 'storeList', list);
  938. this.$set(this, 'storeId', this.storeId !=0?this.storeId:list[0].id);
  939. list.forEach(item=>{
  940. if(this.storeId == item.id){
  941. this.$set(this, 'system_store', item);
  942. }
  943. })
  944. if(fromType !=1 ){
  945. this.getConfirm();
  946. }
  947. }).catch(err => {})
  948. },
  949. // 关闭地址弹窗;
  950. changeClose: function() {
  951. this.$set(this.address, 'address', false);
  952. },
  953. /*
  954. * 跳转门店列表
  955. */
  956. showStoreList: function() {
  957. let _this = this
  958. if (this.storeList.length > 0) {
  959. uni.navigateTo({
  960. url: `/pages/store/store_list/index?type=1&cartId=${_this.cartId}&new=${_this.news}&pinkId=${_this.pinkId}&couponId=${_this.couponId}`
  961. })
  962. }
  963. },
  964. changePayType(type) {
  965. this.payType = type
  966. this.computedPrice()
  967. },
  968. computedPrice: function() {
  969. let shippingType = this.shippingType;
  970. postOrderComputed(this.orderKey, {
  971. addressId: this.addressId,
  972. useIntegral: this.useIntegral ? 1 : 0,
  973. couponId: this.priceGroup.couponPrice == 0 ? 0 : this.couponId,
  974. shipping_type: this.tableId ? 4 : parseInt(shippingType) + 1,
  975. payType: this.payType
  976. }).then(res => {
  977. let result = res.data.result;
  978. if (result) {
  979. this.totalPrice = result.pay_price;
  980. this.integral_price = result.deduction_price;
  981. this.coupon_price = result.coupon_price;
  982. this.promotions_detail = result.promotions_detail;
  983. this.integral = this.useIntegral ? result.SurplusIntegral : this.userInfo.integral;
  984. this.$set(this.priceGroup, 'storePostage', shippingType == 1 ? 0 : result.pay_postage);
  985. this.$set(this.priceGroup, 'storePostageDiscount', result.storePostageDiscount);
  986. }
  987. }).catch(err => {
  988. return that.$util.Tips({
  989. title: err
  990. });
  991. })
  992. },
  993. addressType: function(e,type) {
  994. let index = e;
  995. this.shippingType = parseInt(index);
  996. // this.computedPrice();
  997. if (index == 1) {
  998. this.getList(0,type);
  999. } else {
  1000. this.getConfirm();
  1001. }
  1002. },
  1003. bindPickerChange: function(e) {
  1004. let value = e.detail.value;
  1005. this.shippingType = value;
  1006. this.computedPrice();
  1007. },
  1008. ChangCouponsClone: function() {
  1009. this.$set(this.coupon, 'coupon', false);
  1010. },
  1011. changeTextareaStatus: function() {
  1012. for (let i = 0, len = this.coupon.list.length; i < len; i++) {
  1013. this.coupon.list[i].use_title = '';
  1014. this.coupon.list[i].is_use = 0;
  1015. }
  1016. this.textareaStatus = true;
  1017. this.status = 0;
  1018. this.$set(this.coupon, 'list', this.coupon.list);
  1019. },
  1020. /**
  1021. * 处理点击优惠券后的事件
  1022. *
  1023. */
  1024. ChangCoupons: function(e) {
  1025. // this.usableCoupon = e
  1026. // this.coupon.coupon = false
  1027. let index = e,
  1028. list = this.coupon.list,
  1029. couponTitle = '请选择',
  1030. couponId = 0;
  1031. for (let i = 0, len = list.length; i < len; i++) {
  1032. if (i != index) {
  1033. list[i].use_title = '';
  1034. list[i].is_use = 0;
  1035. }
  1036. }
  1037. if (list[index].is_use) {
  1038. //不使用优惠券
  1039. list[index].use_title = '';
  1040. list[index].is_use = 0;
  1041. } else {
  1042. //使用优惠券
  1043. list[index].use_title = '不使用';
  1044. list[index].is_use = 1;
  1045. couponTitle = list[index].coupon_title;
  1046. couponId = list[index].id;
  1047. }
  1048. this.couponTitle = couponTitle;
  1049. this.couponId = couponId;
  1050. this.$set(this.coupon, 'coupon', false);
  1051. this.$set(this.coupon, 'list', list);
  1052. this.getConfirm(1);
  1053. },
  1054. /**
  1055. * 使用积分抵扣
  1056. */
  1057. ChangeIntegral: function() {
  1058. this.useIntegral = !this.useIntegral;
  1059. this.computedPrice();
  1060. },
  1061. /**
  1062. * 选择地址后改变事件
  1063. * @param object e
  1064. */
  1065. OnChangeAddress: function(e) {
  1066. this.textareaStatus = true;
  1067. this.addressId = e;
  1068. this.address.address = false;
  1069. this.getConfirm()
  1070. this.getaddressInfo();
  1071. this.computedPrice();
  1072. },
  1073. bindHideKeyboard: function(e) {
  1074. this.mark = e.detail.value;
  1075. },
  1076. // 对象转数组
  1077. objToArr(data) {
  1078. let obj = Object.keys(data);
  1079. let m = obj.map(key => data[key]);
  1080. return m;
  1081. },
  1082. /**
  1083. * 获取当前订单详细信息
  1084. *
  1085. */
  1086. getConfirm: function(numType) {
  1087. let that = this;
  1088. let shippingType = parseInt(this.shippingType) + 1;
  1089. let addressId = 0,storeid;
  1090. if (this.tableId) {
  1091. shippingType = 4;
  1092. }
  1093. if (shippingType == 1) {
  1094. addressId = that.addressId
  1095. if(this.deliveryType == 1){
  1096. storeid = 0
  1097. }else{
  1098. storeid = that.storeId
  1099. }
  1100. } else {
  1101. addressId = ''
  1102. storeid = that.storeId
  1103. }
  1104. orderConfirm(that.cartId, that.news, addressId, shippingType, storeid, that.couponId).then(res => {
  1105. if (res.data.upgrade_addr == 1) {
  1106. that.id = res.data.addressInfo.id
  1107. this.isaddress = true
  1108. }
  1109. if (numType != 1) {
  1110. let confirm = this.objToArr(res.data.custom_form);
  1111. confirm.forEach((item, index, arr)=>{
  1112. CACHE_CITY[index] = ''; //清空省市区
  1113. if(item.name == 'texts'){
  1114. if(item.defaultValConfig.value){
  1115. item.value = item.defaultValConfig.value
  1116. }else{
  1117. item.value = ''
  1118. }
  1119. }else if(item.name == 'radios'){
  1120. item.value = item.wordsConfig.list[0].val
  1121. }else if(item.name == 'uploadPicture'){
  1122. item.value = [];
  1123. }else if(item.name == 'dateranges'){
  1124. if(item.valConfig.tabVal==0){
  1125. if(item.valConfig.tabData==0){
  1126. let obj = dayjs(new Date(Number(new Date().getTime()))).format('YYYY-MM-DD');
  1127. item.value = [obj,obj]
  1128. }else{
  1129. let data1 = dayjs(new Date(Number(new Date(item.valConfig.specifyDate[0]).getTime()))).format('YYYY-MM-DD');
  1130. let data2 = dayjs(new Date(Number(new Date(item.valConfig.specifyDate[1]).getTime()))).format('YYYY-MM-DD');
  1131. item.value = [data1,data2];
  1132. }
  1133. }else{
  1134. item.value = [];
  1135. }
  1136. }else{
  1137. if(['times','dates','timeranges'].indexOf(item.name) != -1){
  1138. if(item.valConfig.tabVal==0){
  1139. if(item.valConfig.tabData==0){
  1140. if(item.name == 'times'){
  1141. item.value = dayjs(new Date(Number(new Date().getTime()))).format('HH:mm');
  1142. }else if(item.name == 'dates'){
  1143. item.value = dayjs(new Date(Number(new Date().getTime()))).format('YYYY-MM-DD');
  1144. }else{
  1145. let current = dayjs(new Date(Number(new Date().getTime()))).format('HH:mm');
  1146. item.value = current+' - '+current;
  1147. }
  1148. }else{
  1149. if(item.name == 'times' || item.name == 'dates'){
  1150. item.value = item.valConfig.specifyDate;
  1151. }else{
  1152. item.value = item.valConfig.specifyDate[0]+' - '+item.valConfig.specifyDate[1];
  1153. }
  1154. }
  1155. }else{
  1156. item.value = '';
  1157. }
  1158. }else{
  1159. item.value = '';
  1160. }
  1161. }
  1162. })
  1163. function sortNumber(a, b) {
  1164. return a.timestamp - b.timestamp;
  1165. }
  1166. confirm.sort(sortNumber);
  1167. that.$set(that, 'confirm', confirm);
  1168. }
  1169. that.$set(that, 'goodsType', res.data.type);
  1170. that.$set(that, 'userInfo', res.data.userInfo);
  1171. that.$set(that, 'integral', res.data.userInfo.integral);
  1172. that.$set(that, 'contacts', res.data.userInfo.real_name);
  1173. that.$set(that, 'contactsTel', res.data.userInfo.record_phone || '');
  1174. that.$set(that, 'integralRatio', res.data.integralRatio);
  1175. that.$set(that, 'offlinePostage', res.data.offlinePostage);
  1176. that.$set(that, 'orderKey', res.data.orderKey);
  1177. that.$set(that, 'valid_count', res.data.valid_count);
  1178. that.$set(that, 'discount_id', res.data.discount_id)
  1179. that.$set(that, 'priceGroup', res.data.priceGroup);
  1180. that.$set(that, 'seckillId', parseInt(res.data.seckill_id));
  1181. that.$set(that, 'BargainId', parseInt(res.data.bargain_id));
  1182. that.$set(that, 'combinationId', parseInt(res.data.combination_id));
  1183. that.$set(that, 'discountId', parseInt(res.data.discount_id));
  1184. that.$set(that, 'invoice_func', res.data.invoice_func);
  1185. that.$set(that, 'special_invoice', res.data.special_invoice);
  1186. that.$set(that, 'integral_ratio_status', res.data.integral_ratio_status);
  1187. that.$set(that, 'store_self_mention', res.data.store_self_mention);
  1188. that.$set(that, 'store_func_status', res.data.store_func_status);
  1189. that.giveData.give_integral = res.data.give_integral;
  1190. that.giveData.give_coupon = res.data.give_coupon;
  1191. let cartInfo = res.data.cartInfo;
  1192. let cartObj = [],
  1193. giftObj = [];
  1194. cartInfo.forEach(item => {
  1195. if (item.is_gift == 1) {
  1196. giftObj.push(item)
  1197. } else {
  1198. cartObj.push(item)
  1199. }
  1200. })
  1201. that.$set(that, 'cartInfo', cartObj);
  1202. that.$set(that, 'giveCartInfo', giftObj);
  1203. let giveType = -1;
  1204. giftObj.forEach(item => {
  1205. if (item.product_type == 0 || item.product_type == 4) {
  1206. return giveType = 0
  1207. }
  1208. })
  1209. that.$set(that, 'product_type', (res.data.product_type == 0 || giveType == 0 || res.data.product_type == 4) ? 0 : 1);
  1210. //微信支付是否开启
  1211. that.cartArr[0].payStatus = res.data.pay_weixin_open || 0
  1212. //支付宝是否开启
  1213. that.cartArr[1].payStatus = res.data.ali_pay_status || 0;
  1214. //#ifdef MP
  1215. that.cartArr[1].payStatus = 0;
  1216. //#endif
  1217. //余额支付是否开启
  1218. // that.cartArr[2].title = '可用余额:' + res.data.userInfo.now_money;
  1219. that.cartArr[2].number = res.data.userInfo.now_money;
  1220. that.cartArr[2].payStatus = res.data.yue_pay_status == 1 ? res.data.yue_pay_status : 0
  1221. if (res.data.offline_pay_status == 2) {
  1222. that.cartArr[3].payStatus = 0
  1223. } else {
  1224. that.cartArr[3].payStatus = 1
  1225. }
  1226. // that.$set(that, 'cartArr', that.cartArr);
  1227. that.$set(that, 'ChangePrice', that.totalPrice);
  1228. that.getBargainId();
  1229. that.getCouponList();
  1230. that.computedPrice();
  1231. if (this.addressId || this.couponId) {
  1232. // this.computedPrice();
  1233. } else {
  1234. that.$set(that, 'totalPrice', that.$util.$h.Add(parseFloat(res.data.priceGroup.totalPrice),
  1235. parseFloat(res.data
  1236. .priceGroup.storePostage)));
  1237. }
  1238. }).catch(err => {
  1239. return this.$util.Tips({
  1240. title: err
  1241. });
  1242. });
  1243. },
  1244. /*
  1245. * 提取砍价和拼团id
  1246. */
  1247. getBargainId: function() {
  1248. let that = this;
  1249. // let cartINfo = that.cartInfo;
  1250. // let BargainId = 0;
  1251. // let combinationId = 0;
  1252. // let discountId = 0;
  1253. // cartINfo.forEach(function(value, index, cartINfo) {
  1254. // BargainId = cartINfo[index].bargain_id,
  1255. // combinationId = cartINfo[index].combination_id,
  1256. // discountId = cartINfo[index].discount_id
  1257. // })
  1258. // that.$set(that, 'BargainId', parseInt(BargainId));
  1259. // that.$set(that, 'combinationId', parseInt(combinationId));
  1260. // that.$set(that, 'discountId', parseInt(discountId));
  1261. if (that.cartArr.length == 3 && (that.BargainId || that.combinationId || that.seckillId || that.discountId)) {
  1262. that.cartArr[2].payStatus = 0;
  1263. that.$set(that, 'cartArr', that.cartArr);
  1264. }
  1265. },
  1266. /**
  1267. * 获取当前金额可用优惠券
  1268. *
  1269. */
  1270. getCouponList: function() {
  1271. let that = this;
  1272. let data = {
  1273. cartId: this.cartId,
  1274. 'new': this.news,
  1275. shipping_type: that.$util.$h.Add(that.shippingType, 1),
  1276. store_id: that.system_store ? that.system_store.id : 0
  1277. }
  1278. getCouponsOrderPrice(this.totalPrice, data).then(res => {
  1279. that.$set(that.coupon, 'list', res.data);
  1280. that.openType = 1;
  1281. });
  1282. },
  1283. /*
  1284. * 获取默认收货地址或者获取某条地址信息
  1285. */
  1286. getaddressInfo: function() {
  1287. let that = this;
  1288. if (that.addressId) {
  1289. getAddressDetail(that.addressId).then(res => {
  1290. res.data.is_default = parseInt(res.data.is_default);
  1291. that.addressInfo = res.data || {};
  1292. that.addressId = res.data.id || 0;
  1293. that.address.addressId = res.data.id || 0;
  1294. })
  1295. } else {
  1296. getAddressDefault().then(res => {
  1297. res.data.is_default = parseInt(res.data.is_default);
  1298. that.addressInfo = res.data || {};
  1299. that.addressId = res.data.id || 0;
  1300. that.address.addressId = res.data.id || 0;
  1301. })
  1302. }
  1303. },
  1304. payItem: function(e) {
  1305. let that = this;
  1306. let active = e;
  1307. that.active = active;
  1308. that.animated = true;
  1309. that.payType = that.cartArr[active].value;
  1310. that.computedPrice();
  1311. setTimeout(function() {
  1312. that.car();
  1313. }, 500);
  1314. },
  1315. couponTap: function() {
  1316. this.coupon.coupon = true;
  1317. this.coupon.list.forEach((item, index) => {
  1318. if (item.id == this.couponId) {
  1319. item.is_use = 1
  1320. } else {
  1321. item.is_use = 0
  1322. }
  1323. })
  1324. this.$set(this.coupon, 'list', this.coupon.list);
  1325. },
  1326. car: function() {
  1327. let that = this;
  1328. that.animated = false;
  1329. },
  1330. onAddress: function(name) {
  1331. let that = this;
  1332. if(name){
  1333. that.textareaStatus = false;
  1334. that.address.address = true;
  1335. that.pagesUrl = '/pages/users/user_address_list/index?news=' + this.news + '&cartId=' + this.cartId +
  1336. '&pinkId=' +
  1337. this.pinkId +
  1338. '&couponId=' +
  1339. this.couponId +'&delivery_type='+this.deliveryType+'&addressId='+this.addressId+'&store_id='+this.storeId+'&store_name='+ this.system_store.name+'&product_id='+this.product_id
  1340. }else{
  1341. uni.navigateTo({
  1342. url: '/pages/users/user_address/index?new=' + this.news + '&cartId=' + this.cartId +
  1343. '&pinkId=' +
  1344. this.pinkId +
  1345. '&couponId=' +
  1346. this.couponId +'&delivery_type='+this.deliveryType+'&addressId='+this.addressId+'&store_id='+this.storeId+'&store_name='+ this.system_store.name+'&product_id='+this.product_id
  1347. })
  1348. }
  1349. },
  1350. payment: function(data) {
  1351. let that = this;
  1352. orderCreate(that.orderKey, data).then(res => {
  1353. let status = res.data.status,
  1354. orderId = res.data.result.orderId,
  1355. jsConfig = res.data.result.jsConfig,
  1356. goPages = '/pages/goods/order_pay_status/index?order_id=' + orderId + '&msg=' + res.msg +
  1357. '&type=3' + '&totalPrice=' + this.totalPrice
  1358. switch (status) {
  1359. case 'ORDER_EXIST':
  1360. case 'EXTEND_ORDER':
  1361. case 'PAY_ERROR':
  1362. uni.hideLoading();
  1363. return that.$util.Tips({
  1364. title: res.msg
  1365. }, {
  1366. tab: 5,
  1367. url: goPages
  1368. });
  1369. break;
  1370. case 'SUCCESS':
  1371. uni.hideLoading();
  1372. if (that.BargainId || that.combinationId || that.pinkId || that.seckillId || that
  1373. .discountId)
  1374. return that.$util.Tips({
  1375. title: res.msg,
  1376. icon: 'success'
  1377. }, {
  1378. tab: 4,
  1379. url: goPages
  1380. });
  1381. return that.$util.Tips({
  1382. title: res.msg,
  1383. icon: 'success'
  1384. }, {
  1385. tab: 5,
  1386. url: goPages
  1387. });
  1388. break;
  1389. case 'WECHAT_PAY':
  1390. that.toPay = true;
  1391. // #ifdef MP
  1392. /* that.toPay = true; */
  1393. let mp_pay_name=''
  1394. if(uni.requestOrderPayment){
  1395. mp_pay_name='requestOrderPayment'
  1396. }else{
  1397. mp_pay_name='requestPayment'
  1398. }
  1399. uni[mp_pay_name]({
  1400. timeStamp: jsConfig.timestamp,
  1401. nonceStr: jsConfig.nonceStr,
  1402. package: jsConfig.package,
  1403. signType: jsConfig.signType,
  1404. paySign: jsConfig.paySign,
  1405. success: function(res) {
  1406. uni.hideLoading();
  1407. if (that.BargainId || that.combinationId || that.pinkId || that
  1408. .seckillId || that.discountId)
  1409. return that.$util.Tips({
  1410. title: '支付成功',
  1411. icon: 'success'
  1412. }, {
  1413. tab: 4,
  1414. url: goPages
  1415. });
  1416. return that.$util.Tips({
  1417. title: '支付成功',
  1418. icon: 'success'
  1419. }, {
  1420. tab: 5,
  1421. url: goPages
  1422. });
  1423. },
  1424. fail: function(e) {
  1425. uni.hideLoading();
  1426. return that.$util.Tips({
  1427. title: '取消支付'
  1428. }, {
  1429. tab: 5,
  1430. url: goPages + '&status=2'
  1431. });
  1432. },
  1433. complete: function(e) {
  1434. uni.hideLoading();
  1435. //关闭当前页面跳转至订单状态
  1436. if (res.errMsg == 'requestPayment:cancel') return that.$util
  1437. .Tips({
  1438. title: '取消支付'
  1439. }, {
  1440. tab: 5,
  1441. url: goPages + '&status=2'
  1442. });
  1443. },
  1444. })
  1445. // #endif
  1446. // #ifdef H5
  1447. this.$wechat.pay(res.data.result.jsConfig).then(res => {
  1448. return that.$util.Tips({
  1449. title: '支付成功',
  1450. icon: 'success'
  1451. }, {
  1452. tab: 5,
  1453. url: goPages
  1454. });
  1455. }).catch(res => {
  1456. if (!this.$wechat.isWeixin()) {
  1457. uni.redirectTo({
  1458. url: goPages +
  1459. '&msg=支付失败&status=2'
  1460. })
  1461. }
  1462. if (res.errMsg == 'chooseWXPay:cancel') return that.$util.Tips({
  1463. title: '取消支付'
  1464. }, {
  1465. tab: 5,
  1466. url: goPages + '&status=2'
  1467. });
  1468. })
  1469. // #endif
  1470. // #ifdef APP-PLUS
  1471. uni.requestPayment({
  1472. provider: 'wxpay',
  1473. orderInfo: jsConfig,
  1474. success: (e) => {
  1475. let url = goPages;
  1476. uni.showToast({
  1477. title: "支付成功"
  1478. })
  1479. setTimeout(res => {
  1480. uni.redirectTo({
  1481. url: url
  1482. })
  1483. }, 2000)
  1484. },
  1485. fail: (e) => {
  1486. let url = '/pages/goods/order_pay_status/index?order_id=' + orderId +
  1487. '&msg=支付失败';
  1488. uni.showModal({
  1489. content: "支付失败",
  1490. showCancel: false,
  1491. success: function(res) {
  1492. if (res.confirm) {
  1493. uni.redirectTo({
  1494. url: url
  1495. })
  1496. } else if (res.cancel) {
  1497. console.log('用户点击取消');
  1498. }
  1499. }
  1500. })
  1501. },
  1502. complete: () => {
  1503. uni.hideLoading();
  1504. },
  1505. });
  1506. // #endif
  1507. break;
  1508. case 'PAY_DEFICIENCY':
  1509. uni.hideLoading();
  1510. //余额不足
  1511. return that.$util.Tips({
  1512. title: res.msg
  1513. }, {
  1514. tab: 5,
  1515. url: goPages + '&status=1'
  1516. });
  1517. break;
  1518. case "WECHAT_H5_PAY":
  1519. uni.hideLoading();
  1520. that.$util.Tips({
  1521. title: '订单创建成功!'
  1522. }, {
  1523. tab: 4,
  1524. url: goPages + '&status=0'
  1525. });
  1526. setTimeout(() => {
  1527. location.href = res.data.result.jsConfig.mweb_url;
  1528. }, 2000);
  1529. break;
  1530. case 'ALIPAY_PAY':
  1531. //#ifdef H5
  1532. if (this.from === 'weixin') {
  1533. uni.redirectTo({
  1534. url: `/pages/users/alipay_invoke/index?id=${orderId}&pay_key=${res.data.result.pay_key}`
  1535. });
  1536. } else {
  1537. uni.hideLoading();
  1538. that.formContent = res.data.result.jsConfig;
  1539. that.$nextTick(() => {
  1540. document.getElementById('alipaysubmit').submit();
  1541. })
  1542. }
  1543. //#endif
  1544. // #ifdef MP
  1545. uni.navigateTo({
  1546. url: `/pages/users/alipay_invoke/index?id=${orderId}&link=${jsConfig.qrCode}`
  1547. });
  1548. // #endif
  1549. // #ifdef APP-PLUS
  1550. uni.requestPayment({
  1551. provider: 'alipay',
  1552. orderInfo: jsConfig,
  1553. success: (e) => {
  1554. uni.showToast({
  1555. title: "支付成功"
  1556. })
  1557. let url = '/pages/goods/order_pay_status/index?order_id=' + orderId +
  1558. '&msg=支付成功';
  1559. setTimeout(res => {
  1560. uni.redirectTo({
  1561. url: url
  1562. })
  1563. }, 2000)
  1564. },
  1565. fail: (e) => {
  1566. let url = '/pages/goods/order_pay_status/index?order_id=' + orderId +
  1567. '&msg=支付失败';
  1568. uni.showModal({
  1569. content: "支付失败",
  1570. showCancel: false,
  1571. success: function(res) {
  1572. if (res.confirm) {
  1573. uni.redirectTo({
  1574. url: url
  1575. })
  1576. } else if (res.cancel) {
  1577. console.log('用户点击取消');
  1578. }
  1579. }
  1580. })
  1581. },
  1582. complete: () => {
  1583. uni.hideLoading();
  1584. },
  1585. });
  1586. // #endif
  1587. break;
  1588. }
  1589. }).catch(err => {
  1590. uni.hideLoading();
  1591. return that.$util.Tips({
  1592. title: err
  1593. });
  1594. });
  1595. },
  1596. clickTextArea() {
  1597. this.$refs.textarea.focus()
  1598. },
  1599. bindDateChange: function(e, index) {
  1600. this.confirm[index].value = e.target.value
  1601. },
  1602. bindTimeChange: function(e, index) {
  1603. this.confirm[index].value = e.target.value
  1604. },
  1605. bindSelectChange: function(e, index, item) {
  1606. this.confirm[index].value = item.wordsConfig.list[e.detail.value].val
  1607. },
  1608. getTimeranges(index){
  1609. this.isShow = true
  1610. this.timerangesIndex = index
  1611. },
  1612. confrim(e){
  1613. this.isShow = false;
  1614. this.confirm[this.timerangesIndex].value = e.time;
  1615. let arrayNew = [];
  1616. e.val.forEach(item=>{
  1617. arrayNew.push(Number(item))
  1618. })
  1619. this.timeranges = arrayNew;
  1620. },
  1621. cancels(){
  1622. this.isShow = false;
  1623. },
  1624. // 单选
  1625. radioChange(e, index, item){
  1626. this.confirm[index].value = item.wordsConfig.list[e.detail.value].val
  1627. },
  1628. // 多选
  1629. checkboxChange(e, index, item){
  1630. let obj = e.detail.value;
  1631. let val = '';
  1632. item.wordsConfig.list.forEach((j,jindex)=>{
  1633. obj.forEach(x=>{
  1634. if(jindex == x){
  1635. val = val +(val?',':'') + j.val;
  1636. }
  1637. })
  1638. })
  1639. this.confirm[index].value = val
  1640. },
  1641. formVerify(){
  1642. let that = this;
  1643. if (!that.addressId && !that.shippingType && !that.product_type && !that.tableId) return that.$util.Tips({
  1644. title: '请选择收货地址'
  1645. });
  1646. if (that.shippingType == 1) {
  1647. if (that.contacts == "" || that.contactsTel == "") {
  1648. return that.$util.Tips({
  1649. title: '请填写联系人或联系人电话'
  1650. });
  1651. }
  1652. if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(that.contactsTel)) {
  1653. return that.$util.Tips({
  1654. title: '请填写正确的手机号'
  1655. });
  1656. }
  1657. if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(that.contacts)) {
  1658. return that.$util.Tips({
  1659. title: '请填写您的真实姓名'
  1660. });
  1661. }
  1662. if (that.storeList.length == 0) return that.$util.Tips({
  1663. title: '暂无门店,请选择其他方式'
  1664. });
  1665. }
  1666. for (var i = 0; i < that.confirm.length; i++) {
  1667. let data = that.confirm[i]
  1668. if (['radios'].indexOf(data.name) == -1 && (data.titleShow.val || (['uploadPicture','dateranges'].indexOf(data.name) == -1 && data.value && data.value.trim()))) {
  1669. if ((data.name === 'texts' && data.valConfig.tabVal == 0) || ['dates','times','selects','citys','checkboxs'].indexOf(data.name) != -1) {
  1670. if (!data.value || (data.value && !data.value.trim())) {
  1671. return that.$util.Tips({
  1672. title: `请填写${data.titleConfig.value}`
  1673. });
  1674. }
  1675. }
  1676. if(data.name === 'timeranges'){
  1677. if(!data.value){
  1678. return that.$util.Tips({
  1679. title: `请选择${data.titleConfig.value}`
  1680. });
  1681. }
  1682. }
  1683. if (data.name === 'dateranges') {
  1684. if (!data.value.length) {
  1685. return that.$util.Tips({
  1686. title: `请选择${data.titleConfig.value}`
  1687. });
  1688. }
  1689. }
  1690. if (data.name === 'texts' && data.valConfig.tabVal == 4) {
  1691. if (data.value <= 0) {
  1692. return that.$util.Tips({
  1693. title: `请填写大于0的${data.titleConfig.value}`
  1694. });
  1695. }
  1696. }
  1697. if (data.name === 'texts' && data.valConfig.tabVal == 3) {
  1698. if (!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(data.value)) {
  1699. return that.$util.Tips({
  1700. title: `请填写正确的${data.titleConfig.value}`
  1701. });
  1702. }
  1703. }
  1704. if (data.name === 'texts' && data.valConfig.tabVal == 1) {
  1705. if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(data.value)) {
  1706. return that.$util.Tips({
  1707. title: `请填写正确的${data.titleConfig.value}`
  1708. });
  1709. }
  1710. }
  1711. if (data.name === 'texts' && data.valConfig.tabVal == 2) {
  1712. if (!
  1713. /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/i
  1714. .test(data.value)) {
  1715. return that.$util.Tips({
  1716. title: `请填写正确的${data.titleConfig.value}`
  1717. });
  1718. }
  1719. }
  1720. if (data.name === 'uploadPicture') {
  1721. if (!data.value.length) {
  1722. return that.$util.Tips({
  1723. title: `请上传${data.titleConfig.value}`
  1724. });
  1725. }
  1726. }
  1727. }
  1728. }
  1729. this.pay_close = true;
  1730. },
  1731. SubOrder: function(e) {
  1732. let that = this,
  1733. data = {};
  1734. if (!that.payType) return that.$util.Tips({
  1735. title: '请选择支付方式'
  1736. });
  1737. data = {
  1738. collate_code_id: that.collage_id || that.tableId,
  1739. custom_form: that.confirm,
  1740. real_name: that.contacts,
  1741. phone: that.contactsTel,
  1742. addressId: that.addressId,
  1743. formId: '',
  1744. couponId: that.priceGroup.couponPrice == 0 ? 0 : that.couponId,
  1745. payType: that.payType,
  1746. useIntegral: that.useIntegral,
  1747. bargainId: that.BargainId,
  1748. combinationId: that.combinationId,
  1749. discountId: that.discountId,
  1750. pinkId: that.pinkId,
  1751. seckill_id: that.seckillId,
  1752. mark: that.mark,
  1753. store_id: that.deliveryType==1? 0 : that.system_store.id||0,
  1754. 'from': that.from,
  1755. shipping_type: that.tableId ? 4 : that.$util.$h.Add(that.shippingType, 1),
  1756. 'new': that.news,
  1757. 'invoice_id': that.invChecked,
  1758. // #ifdef H5
  1759. quitUrl: location.protocol + '//' + location.hostname +
  1760. '/pages/goods/order_pay_status/index?' +
  1761. '&type=3' + '&totalPrice=' + this.totalPrice
  1762. // #endif
  1763. // #ifdef APP-PLUS
  1764. quitUrl: '/pages/goods/order_details/index?order_id=' + this.order_id
  1765. // #endif
  1766. };
  1767. if (data.payType == 'yue' && parseFloat(that.userInfo.now_money) < parseFloat(that.totalPrice))
  1768. return that.$util.Tips({
  1769. title: '余额不足!'
  1770. });
  1771. uni.showLoading({
  1772. title: '订单支付中'
  1773. });
  1774. // #ifdef MP
  1775. openPaySubscribe().then(() => {
  1776. that.payment(data);
  1777. });
  1778. // #endif
  1779. // #ifndef MP
  1780. that.payment(data);
  1781. // #endif
  1782. }
  1783. }
  1784. }
  1785. </script>
  1786. <style lang="scss" scoped>
  1787. /deep/.uni-date-x--border{
  1788. border: 0;
  1789. }
  1790. /deep/.uni-icons{
  1791. font-size: 0 !important;
  1792. }
  1793. /deep/.uni-date-x{
  1794. color: #999;
  1795. font-size: 15px;
  1796. }
  1797. /deep/.uni-date__x-input{
  1798. font-size: 15px;
  1799. }
  1800. .height-add {
  1801. height: calc(120rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  1802. height: calc(120rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  1803. }
  1804. /deep/uni-checkbox[disabled] .uni-checkbox-input {
  1805. background-color: #eee;
  1806. }
  1807. .confirmImg {
  1808. width: 100%;
  1809. }
  1810. /deep/.orderGoods {
  1811. margin-top: 20rpx;
  1812. border-radius: 14rpx;
  1813. }
  1814. .confirmImg .upload {
  1815. padding-bottom: 36rpx;
  1816. }
  1817. .confirmImg .upload .pictrue {
  1818. margin: 22rpx 23rpx 0 0;
  1819. width: 146rpx;
  1820. height: 146rpx;
  1821. position: relative;
  1822. font-size: 24rpx;
  1823. color: #bbb;
  1824. }
  1825. .confirmImg .upload .pictrue:nth-of-type(4n) {
  1826. margin-right: 0;
  1827. }
  1828. .confirmImg .upload .pictrue image {
  1829. width: 100%;
  1830. height: 100%;
  1831. border-radius: 8rpx;
  1832. }
  1833. .confirmImg .upload .pictrue .icon-guanbi1 {
  1834. position: absolute;
  1835. font-size: 45rpx;
  1836. top: -10rpx;
  1837. right: -10rpx;
  1838. }
  1839. .confirmImg .upload .pictrue .close{
  1840. position: absolute;
  1841. width: 26rpx;
  1842. height: 26rpx;
  1843. border-radius: 0 8rpx 0 8rpx;
  1844. background-color: rgba(0, 0, 0, 0.6);
  1845. top: 0;
  1846. right: 0;
  1847. }
  1848. .confirmImg .upload .pictrue .close .iconfont{
  1849. font-size: 24rpx;
  1850. }
  1851. .confirmImg .upload .pictrue .icon-icon25201 {
  1852. color: #bfbfbf;
  1853. font-size: 50rpx;
  1854. }
  1855. .confirmImg .upload .pictrue:nth-last-child(1) {
  1856. border: 1rpx solid #ddd;
  1857. box-sizing: border-box;
  1858. }
  1859. .alipaysubmit {
  1860. display: none;
  1861. }
  1862. .order-submission .line {
  1863. width: 100%;
  1864. height: 4rpx;
  1865. }
  1866. .order-submission .line image {
  1867. width: 100%;
  1868. height: 100%;
  1869. display: block;
  1870. }
  1871. .order-submission .headerCon {
  1872. background-color: #fff;
  1873. box-sizing: border-box;
  1874. .icon-s-bianji {
  1875. width: 44rpx;
  1876. height: 44rpx;
  1877. background: #F5F5F5;
  1878. border-radius: 50%;
  1879. text-align: center;
  1880. line-height: 44rpx;
  1881. font-size: 17rpx;
  1882. color: #666;
  1883. }
  1884. .add-title {
  1885. height: 72rpx;
  1886. padding: 0 26rpx;
  1887. border-bottom: 1px solid #eee;
  1888. .icon {
  1889. height: 32rpx;
  1890. background: #1890FF;
  1891. border-radius: 4rpx;
  1892. font-size: 20rpx;
  1893. font-weight: 400;
  1894. color: #FFFFFF;
  1895. text-align: center;
  1896. line-height: 32rpx;
  1897. padding: 0 6rpx;
  1898. &.orange{
  1899. background: #FE960F;
  1900. }
  1901. &.red{
  1902. background: #E93323;
  1903. }
  1904. }
  1905. .add-text {
  1906. margin-left: 14rpx;
  1907. width: 360rpx;
  1908. }
  1909. .text {
  1910. font-size: 24rpx;
  1911. font-weight: 400;
  1912. color: #999999;
  1913. .icon-jiantou {
  1914. display: inline-block;
  1915. font-size: 20rpx;
  1916. }
  1917. }
  1918. }
  1919. }
  1920. .order-submission .address{
  1921. padding: 0 26rpx;
  1922. height: 130rpx;
  1923. .icon{
  1924. .iconfont{
  1925. width: 44rpx;
  1926. height: 44rpx;
  1927. background: var(--view-minorColorT);
  1928. font-size: 20rpx;
  1929. border-radius: 50%;
  1930. text-align: center;
  1931. line-height: 44rpx;
  1932. color: var(--view-theme);
  1933. margin-left: 26rpx;
  1934. }
  1935. }
  1936. }
  1937. .order-submission .address .addressCon {
  1938. width: 502rpx;
  1939. font-size: 26rpx;
  1940. color: #666;
  1941. }
  1942. .order-submission .address .addressCon .name {
  1943. font-size: 30rpx;
  1944. color: #282828;
  1945. font-weight: bold;
  1946. margin-bottom: 10rpx;
  1947. .nameCon{
  1948. max-width: 244rpx;
  1949. &.on{
  1950. max-width: unset;
  1951. }
  1952. }
  1953. }
  1954. .order-submission .address .addressCon .name .phone {
  1955. margin-left: 50rpx;
  1956. }
  1957. .order-submission .address .addressCon .default {
  1958. margin-right: 12rpx;
  1959. }
  1960. .order-submission .address .addressCon .setaddress {
  1961. color: #333;
  1962. font-size: 28rpx;
  1963. }
  1964. .order-submission .allAddress {
  1965. width: 100%;
  1966. background: linear-gradient(to bottom, var(--view-theme) 0%, #f5f5f5 100%);
  1967. display: flex;
  1968. flex-direction: column;
  1969. justify-content: center;
  1970. align-items: center;
  1971. padding-top: 24rpx;
  1972. }
  1973. .order-submission .allAddress .nav {
  1974. width: 710rpx;
  1975. // margin: 0 auto;
  1976. }
  1977. .order-submission .allAddress .nav .item {
  1978. width: 355rpx;
  1979. }
  1980. .order-submission .allAddress .nav .item.on {
  1981. position: relative;
  1982. width: 250rpx;
  1983. }
  1984. .order-submission .allAddress .nav .item.on::before {
  1985. position: absolute;
  1986. bottom: 0;
  1987. content: "快递配送";
  1988. font-size: 28rpx;
  1989. display: block;
  1990. height: 0;
  1991. width: 336rpx;
  1992. border-width: 0 20rpx 80rpx 0;
  1993. border-style: none solid solid;
  1994. border-color: transparent transparent #fff;
  1995. z-index: 2;
  1996. border-radius: 7rpx 30rpx 0 0;
  1997. text-align: center;
  1998. // line-height: 80rpx;
  1999. }
  2000. .header-title {
  2001. font-size: 36rpx;
  2002. font-weight: 600;
  2003. color: #FFFFFF;
  2004. }
  2005. .order-submission .allAddress .nav .item:nth-of-type(2).on::before {
  2006. content: "到店自提";
  2007. border-width: 0 0 80rpx 20rpx;
  2008. border-radius: 30rpx 7rpx 0 0;
  2009. }
  2010. .order-submission .allAddress .nav .item.on2 {
  2011. position: relative;
  2012. }
  2013. .order-submission .allAddress .nav .item.on2::before {
  2014. position: absolute;
  2015. bottom: 0;
  2016. content: "到店自提";
  2017. font-size: 28rpx;
  2018. display: block;
  2019. height: 0;
  2020. width: 400rpx;
  2021. border-width: 0 0 60rpx 60rpx;
  2022. border-style: none solid solid;
  2023. border-color: transparent transparent rgba(255, 255, 255, 0.6);
  2024. border-radius: 40rpx 6rpx 0 0;
  2025. text-align: center;
  2026. // line-height: 60rpx;
  2027. }
  2028. .order-submission .allAddress .nav .item:nth-of-type(1).on2::before {
  2029. content: "快递配送";
  2030. border-width: 0 60rpx 60rpx 0;
  2031. border-radius: 6rpx 40rpx 0 0;
  2032. }
  2033. .order-submission .allAddress .headerCon{
  2034. width: 710rpx;
  2035. margin: 0 auto;
  2036. border-radius: 14rpx;
  2037. background-color: #fff;
  2038. }
  2039. .order-submission .allAddress .line {
  2040. width: 710rpx;
  2041. margin: 0 auto;
  2042. }
  2043. .order-submission .wrapper .item .discount .placeholder {
  2044. color: #ccc;
  2045. }
  2046. .placeholder-textarea {
  2047. position: relative;
  2048. .placeholder {
  2049. position: absolute;
  2050. color: #ccc;
  2051. top: 26rpx;
  2052. left: 30rpx;
  2053. }
  2054. }
  2055. .order-submission .wrapper {
  2056. background-color: #fff;
  2057. width: 710rpx;
  2058. border-radius: 14rpx;
  2059. margin: 0 auto;
  2060. margin-top: 14rpx;
  2061. }
  2062. .order-submission .wrapper .item .name {
  2063. position: relative;
  2064. width: 190rpx;
  2065. }
  2066. .order-submission .wrapper .item .asterisk {
  2067. position: absolute;
  2068. color: red;
  2069. left: -15rpx
  2070. }
  2071. .order-submission .wrapper .item {
  2072. padding: 27rpx 30rpx;
  2073. font-size: 30rpx;
  2074. color: #282828;
  2075. border-bottom: 1px solid #f0f0f0;
  2076. }
  2077. .order-submission .wrapper .item.on{
  2078. padding: 17rpx 14rpx 17rpx 30rpx;
  2079. align-items: baseline;
  2080. }
  2081. .order-submission .wrapper .item.on3{
  2082. align-items: baseline;
  2083. }
  2084. .order-submission .wrapper .item.on2{
  2085. padding: 17rpx 30rpx;
  2086. }
  2087. .order-submission .wrapper .item .discount {
  2088. font-size: 30rpx;
  2089. color: #999;
  2090. }
  2091. .order-submission .wrapper .item.on .discount,
  2092. .order-submission .wrapper .item.on3 .discount{
  2093. width: 460rpx;
  2094. text-align: right;
  2095. }
  2096. .order-submission .wrapper .item.on3 .discount .city{
  2097. width: 400rpx;
  2098. }
  2099. .order-submission .wrapper .item .discount input {
  2100. text-align: right;
  2101. width: 450rpx;
  2102. }
  2103. .order-submission .wrapper .item .discount .iconfont {
  2104. color: #515151;
  2105. font-size: 30rpx;
  2106. margin-left: 15rpx;
  2107. }
  2108. .order-submission .wrapper .item .discount .num {
  2109. font-size: 32rpx;
  2110. margin-right: 20rpx;
  2111. }
  2112. .order-submission .wrapper .item .discount .radio{
  2113. margin: 0 22rpx 0 22rpx;
  2114. padding: 10rpx 0;
  2115. }
  2116. .order-submission .wrapper .item .discount .radio /deep/uni-checkbox .uni-checkbox-input{
  2117. border-radius: 0 }
  2118. .order-submission .wrapper .item .shipping {
  2119. font-size: 30rpx;
  2120. color: #999;
  2121. position: relative;
  2122. padding-right: 58rpx;
  2123. }
  2124. .order-submission .wrapper .item .shipping .iconfont {
  2125. font-size: 35rpx;
  2126. color: #707070;
  2127. position: absolute;
  2128. right: 0;
  2129. top: 50%;
  2130. transform: translateY(-50%);
  2131. margin-left: 30rpx;
  2132. }
  2133. .order-submission .wrapper .item textarea {
  2134. background-color: #f9f9f9;
  2135. width: 650rpx;
  2136. height: 140rpx;
  2137. border-radius: 3rpx;
  2138. margin-top: 30rpx;
  2139. padding: 25rpx 28rpx;
  2140. box-sizing: border-box;
  2141. }
  2142. .order-submission .wrapper .item .placeholder {
  2143. color: #ccc;
  2144. }
  2145. .order-submission .wrapper .item .list {
  2146. margin-top: 35rpx;
  2147. }
  2148. .order-submission .wrapper .item .list .payItem {
  2149. border: 1px solid #eee;
  2150. border-radius: 6rpx;
  2151. height: 86rpx;
  2152. width: 100%;
  2153. box-sizing: border-box;
  2154. margin-top: 20rpx;
  2155. font-size: 28rpx;
  2156. color: #282828;
  2157. }
  2158. .order-submission .wrapper .item .list .payItem.on {
  2159. border-color: #fc5445;
  2160. color: #e93323;
  2161. }
  2162. .order-submission .wrapper .item .list .payItem .name {
  2163. width: 50%;
  2164. text-align: center;
  2165. border-right: 1px solid #eee;
  2166. padding-left: 80rpx;
  2167. }
  2168. .order-submission .wrapper .item .list .payItem .name .iconfont {
  2169. width: 44rpx;
  2170. height: 44rpx;
  2171. border-radius: 50%;
  2172. text-align: center;
  2173. line-height: 44rpx;
  2174. background-color: #fe960f;
  2175. color: #fff;
  2176. font-size: 30rpx;
  2177. margin-right: 15rpx;
  2178. }
  2179. .order-submission .wrapper .item .list .payItem .name .iconfont.icon-weixin2 {
  2180. background-color: #41b035;
  2181. }
  2182. .order-submission .wrapper .item .list .payItem .name .iconfont.icon-zhifubao {
  2183. background-color: #1677FF;
  2184. }
  2185. .order-submission .wrapper .item .list .payItem .tip {
  2186. width: 49%;
  2187. text-align: center;
  2188. font-size: 26rpx;
  2189. color: #aaa;
  2190. }
  2191. .order-submission .moneyList {
  2192. background-color: #fff;
  2193. padding: 30rpx;
  2194. width: 710rpx;
  2195. border-radius: 14rpx;
  2196. margin: 0 auto;
  2197. margin-top: 14rpx;
  2198. }
  2199. .order-submission .moneyList .item {
  2200. font-size: 28rpx;
  2201. color: #282828;
  2202. }
  2203. .order-submission .moneyList .item~.item {
  2204. margin-top: 20rpx;
  2205. }
  2206. .order-submission .moneyList .item .money {
  2207. color: #868686;
  2208. }
  2209. .order-submission .footer {
  2210. width: 100%;
  2211. height: 100rpx;
  2212. background-color: #fff;
  2213. padding: 0 30rpx;
  2214. font-size: 28rpx;
  2215. color: #333;
  2216. box-sizing: border-box;
  2217. position: fixed;
  2218. bottom: 0;
  2219. left: 0;
  2220. z-index: 9;
  2221. height: calc(100rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  2222. height: calc(100rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  2223. padding-bottom: calc(0rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  2224. padding-bottom: calc(0rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  2225. }
  2226. .order-submission .footer .settlement {
  2227. font-size: 30rpx;
  2228. color: #fff;
  2229. width: 240rpx;
  2230. height: 70rpx;
  2231. background-color: var(--view-theme);
  2232. border-radius: 50rpx;
  2233. text-align: center;
  2234. line-height: 70rpx;
  2235. }
  2236. .footer .transparent {
  2237. opacity: 0
  2238. }
  2239. .tipaddress {
  2240. position: fixed;
  2241. left: 13%;
  2242. top: 25%;
  2243. // margin-left: -283rpx;
  2244. width: 560rpx;
  2245. height: 614rpx;
  2246. background-color: #fff;
  2247. border-radius: 10rpx;
  2248. z-index: 100;
  2249. text-align: center;
  2250. .top {
  2251. width: 560rpx;
  2252. height: 270rpx;
  2253. border-top-left-radius: 10rpx;
  2254. border-top-right-radius: 10rpx;
  2255. background-image: url(../../../static/images/address.png);
  2256. background-repeat: round;
  2257. background-color: var(--view-theme);
  2258. .tipsphoto {
  2259. display: inline-block;
  2260. width: 200rpx;
  2261. height: 200rpx;
  2262. margin-top: 73rpx;
  2263. }
  2264. }
  2265. .bottom {
  2266. font-size: 32rpx;
  2267. font-weight: 400;
  2268. .font1 {
  2269. font-size: 36rpx;
  2270. font-weight: 600;
  2271. color: #333333;
  2272. margin: 32rpx 0rpx 22rpx;
  2273. }
  2274. .font2 {
  2275. color: #666666;
  2276. margin-bottom: 48rpx;
  2277. }
  2278. .btn {
  2279. width: 360rpx;
  2280. height: 82rpx;
  2281. border-radius: 42rpx;
  2282. background: linear-gradient(to left, var(--view-theme) 0%, #f5f5f5 100%);
  2283. color: #FFFFFF;
  2284. line-height: 82rpx;
  2285. margin: 0 auto;
  2286. }
  2287. }
  2288. }
  2289. .mark {
  2290. position: fixed;
  2291. top: 0;
  2292. left: 0;
  2293. bottom: 0;
  2294. right: 0;
  2295. background: rgba(0, 0, 0, 0.5);
  2296. z-index: 99;
  2297. }
  2298. .table-header {
  2299. width: 710rpx;
  2300. padding: 52rpx 24rpx 46rpx;
  2301. border-radius: 14rpx;
  2302. margin: 0 30rpx;
  2303. background-color: #FFFFFF;
  2304. font-size: 24rpx;
  2305. color: #999999;
  2306. .top {
  2307. display: flex;
  2308. margin-bottom: 18rpx;
  2309. }
  2310. .name {
  2311. flex: 1;
  2312. min-width: 0;
  2313. font-weight: 600;
  2314. font-size: 34rpx;
  2315. color: #333333;
  2316. }
  2317. .number {
  2318. color: #333333;
  2319. }
  2320. .light {
  2321. margin-right: 6rpx;
  2322. font-weight: 600;
  2323. font-size: 34rpx;
  2324. color: var(--view-theme);
  2325. }
  2326. }
  2327. </style>