buy.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. <template>
  2. <view class="center">
  3. <view class="product" v-for="(item, index) in productList">
  4. <view class="product-top flex">
  5. <image class="product-image" :src="item.image" mode=""></image>
  6. <view class="product-info">
  7. <view class="title">{{ item.store_name }}</view>
  8. <view class="title buyId">x{{ item.num }}</view>
  9. <view class="title buyName">¥{{ item.price * 1 * item.num }}</view>
  10. </view>
  11. </view>
  12. <view class="product-bottom flex">
  13. <view class="product-bottom-left">购买数量</view>
  14. <view class="product-bottom-right">
  15. <uni-number-box class="step" :isMin="true" :value="num" :min="0" :max="100" @eventChange="numberChange(item, arguments)"></uni-number-box>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="main" v-if="bank">
  20. <view class="main-tip">请向以下银行账号自行转账</view>
  21. <view class="tc-item flex">
  22. <view class="tcitem-name">姓名</view>
  23. <view class="ali-name">{{ bank.bank_name }}</view>
  24. <image class="tcitem-image" src="../../static/img/copy.png" mode="" @click="copy(bank.bank_name)"></image>
  25. </view>
  26. <view class="tc-item flex">
  27. <view class="tcitem-name">银行</view>
  28. <view class="ali-name">{{ bank.bank }}</view>
  29. <image class="tcitem-image" src="../../static/img/copy.png" mode="" @click="copy(bank.bank)"></image>
  30. </view>
  31. <view class="tc-item flex">
  32. <view class="tcitem-name">开户行</view>
  33. <view class="ali-name">{{ bank.sub_branch }}</view>
  34. <image @click="copy(bank.sub_branch)" class="tcitem-image" src="../../static/img/copy.png" mode=""></image>
  35. </view>
  36. <view class="tc-item flex">
  37. <view class="tcitem-name">账号</view>
  38. <view class="ali-name">{{ bank.bank_number }}</view>
  39. <image class="tcitem-image" src="../../static/img/copy.png" mode="" @click="copy(bank.bank_number)"></image>
  40. </view>
  41. <view class="tc-item flex">
  42. <view class="tcitem-name">说明</view>
  43. <view class="ali-name" style="color: #FD3B39;">请务必上传付款截图,否则不发货</view>
  44. <view class="tcitem-image"></view>
  45. </view>
  46. <view class="tc-item">
  47. <view class="upload-title" style="color: #9d9d9d;">二维码</view>
  48. <view class="upload-main" @click="lookimg(bank.code)"><image class="upload-image" :src="bank.code" mode="aspectFit"></image></view>
  49. </view>
  50. </view>
  51. <view class="upload">
  52. <view class="upload-title">上传支付截图</view>
  53. <view class="upload-main">
  54. <image class="upload-image" src="../../static/img/add.png" mode="" v-if="!image" @click="uploads()"></image>
  55. <image class="upload-image" :src="image" mode="" @click="uploads()" v-if="image"></image>
  56. <view class="upload-font">点击上传支付截图</view>
  57. </view>
  58. </view>
  59. <view class="contentBottomHeight"></view>
  60. <view class="bottom flex">
  61. <view class="bottom-item" @click.stop="openKf()">
  62. <image class="bi-image" src="../../static/img/kf.png" mode=""></image>
  63. <view class="bottom-font">联系客服</view>
  64. </view>
  65. <view class="btn" @click.stop="buy()">完成上传</view>
  66. </view>
  67. <uni-popup ref="popupkf" type="center">
  68. <view class="popup-box">
  69. <view class="img"><image src="../../static/img/img009.png" mode=""></image></view>
  70. <view class="mian">
  71. <view class="delivery">
  72. <view class="title">已经为您定制专属客服</view>
  73. <image src="../../static/img/img010.png" mode=""></image>
  74. </view>
  75. <view class="nocancel">客服VX:{{ text }}</view>
  76. <view class="comfirm-box">
  77. <view class="cancel" @click="cancel">取消</view>
  78. <view class="comfirm" @click="copy(text)">复制微信</view>
  79. </view>
  80. </view>
  81. </view>
  82. </uni-popup>
  83. </view>
  84. </template>
  85. <script>
  86. import uniCountdowns from '@/components/uni-countdown/uni-countdowns.vue';
  87. import uniCopy from '@/components/js_sdk/xb-copy/uni-copy.js';
  88. import { upload, bank } from '@/api/order.js';
  89. import { getProducts, purchase } from '@/api/product.js';
  90. import { timeComputed } from '@/utils/rocessor.js';
  91. import uniNumberBox from '@/components/uni-number-box.vue';
  92. export default {
  93. components: {
  94. uniCountdowns,
  95. uniNumberBox
  96. },
  97. data() {
  98. return {
  99. num: 0,
  100. type: 1,
  101. productList: [],
  102. buyList: {},
  103. tabCurrentIndex: 0,
  104. bank: '',
  105. image: '',
  106. text: '123456'
  107. };
  108. },
  109. onLoad(option) {
  110. this.id = option.ordid;
  111. this.loadData();
  112. if (option.type) {
  113. this.type = option.type;
  114. }
  115. },
  116. methods: {
  117. uploads() {
  118. upload({
  119. filename: ''
  120. }).then(data => {
  121. this.image = data[0].url;
  122. console.log(this.image);
  123. });
  124. },
  125. loadData() {
  126. getProducts({ pages: 1, limit: 1000 }).then(({ data }) => {
  127. data.forEach(e => {
  128. e.num = 0;
  129. console.log(e, '123456');
  130. });
  131. this.productList = data;
  132. });
  133. bank({}).then(({ data }) => {
  134. this.bank = data;
  135. });
  136. },
  137. nav(url) {
  138. uni.navigateTo({
  139. url
  140. });
  141. },
  142. copy(value) {
  143. let obj = this;
  144. let content = value; //需要复制的内容
  145. console.log('复制的内容:', content);
  146. // content = typeof content === 'string' ? content : content.toString(); // 复制内容,必须字符串,数字需要转换为字符串
  147. const result = uniCopy(content);
  148. if (result === false) {
  149. uni.showToast({
  150. title: '不支持'
  151. });
  152. } else {
  153. uni.showToast({
  154. title: '复制成功',
  155. icon: 'none'
  156. });
  157. }
  158. },
  159. tocall() {
  160. let num = this.zfb != '' ? this.zfb.phone : this.wx != '' ? this.wx.phone : this.bank.phone;
  161. console.log(num);
  162. uni.makePhoneCall({
  163. phoneNumber: num //仅为示例
  164. });
  165. },
  166. // 查看大图
  167. lookimg(src) {
  168. console.log(src);
  169. let arr = [src];
  170. uni.previewImage({
  171. current: src,
  172. urls: arr
  173. });
  174. },
  175. //swiper 切换
  176. changeTab(e) {
  177. this.tabCurrentIndex = e.target.current;
  178. },
  179. toBack() {
  180. uni.navigateBack({});
  181. },
  182. change(num) {
  183. this.tabCurrentIndex = num * 1;
  184. },
  185. // 打开客服
  186. openKf() {
  187. this.$refs.popupkf.open();
  188. },
  189. // 关闭客服
  190. cancel() {
  191. this.$refs.popupkf.close();
  192. },
  193. // 购买数量变化
  194. numberChange(e, num) {
  195. const obj = this;
  196. obj.buyList[e.id] = num[0].number;
  197. e.num = num[0].number;
  198. if (num[0].number == 0) {
  199. Reflect.deleteProperty(obj.buyList, e.id);
  200. }
  201. console.log(obj.buyList);
  202. },
  203. buy() {
  204. console.log(this.buyList);
  205. if (this.buyList === {}) {
  206. console.log(111);
  207. return this.$api.msg('请选择进货商品');
  208. }
  209. if (this.image == '') {
  210. return this.$api.msg('请上传支付凭证');
  211. }
  212. purchase({ image: this.image, product_id: this.buyList }).then(e => {
  213. uni.navigateTo({
  214. url: '/pages/shop/sucess?type=2'
  215. });
  216. });
  217. }
  218. }
  219. };
  220. </script>
  221. <style lang="less">
  222. .center {
  223. background: #f8f6f6;
  224. min-height: 100%;
  225. height: auto;
  226. }
  227. .product-top {
  228. margin-top: 20rpx;
  229. padding: 35rpx 35rpx 40rpx 35rpx;
  230. background-color: #ffffff;
  231. justify-content: flex-start;
  232. align-items: flex-start;
  233. border-bottom: 1px solid #eeeeee;
  234. .product-image {
  235. width: 210rpx;
  236. height: 210rpx;
  237. border-radius: 10rpx;
  238. }
  239. .product-info {
  240. margin-left: 26rpx;
  241. padding-top: 10rpx;
  242. line-height: 1;
  243. .title {
  244. font-size: 35rpx;
  245. font-family: PingFang SC;
  246. font-weight: bold;
  247. color: #333333;
  248. }
  249. .buyId {
  250. font-size: 26rpx;
  251. font-weight: 500;
  252. color: #999999;
  253. margin-top: 30rpx;
  254. }
  255. .buyName {
  256. margin-top: 82rpx;
  257. color: #fd3b39;
  258. }
  259. }
  260. }
  261. .product-bottom {
  262. padding: 30rpx 24rpx 24rpx;
  263. background: #ffffff;
  264. .product-bottom-left {
  265. font-size: 28rpx;
  266. font-family: PingFang SC;
  267. font-weight: 500;
  268. color: #333333;
  269. }
  270. }
  271. .main {
  272. margin-top: 20rpx;
  273. padding: 30rpx 0 40rpx;
  274. background: #ffffff;
  275. .main-tip {
  276. padding: 0 30rpx;
  277. font-size: 30rpx;
  278. font-family: PingFang SC;
  279. font-weight: 500;
  280. color: #999999;
  281. }
  282. }
  283. .tc-item {
  284. padding: 50rpx 30rpx 0;
  285. line-height: 1;
  286. .tcitem-name {
  287. width: 100rpx;
  288. font-size: 30rpx;
  289. font-family: PingFang SC;
  290. font-weight: 500;
  291. color: #999999;
  292. }
  293. .ali-name {
  294. width: 440rpx;
  295. font-size: 30rpx;
  296. font-family: PingFang SC;
  297. font-weight: 500;
  298. color: #333333;
  299. }
  300. .tcitem-image {
  301. width: 26rpx;
  302. height: 28rpx;
  303. }
  304. }
  305. .upload-image {
  306. width: 160rpx;
  307. height: 160rpx;
  308. border-radius: 10rpx;
  309. }
  310. .upload-title {
  311. font-size: 30rpx;
  312. font-family: PingFang SC;
  313. font-weight: bold;
  314. color: #333333;
  315. }
  316. .upload-main {
  317. padding-top: 32rpx;
  318. display: flex;
  319. justify-content: center;
  320. align-items: center;
  321. flex-direction: column;
  322. .upload-font {
  323. margin-top: 24rpx;
  324. font-size: 30rpx;
  325. font-family: PingFang SC;
  326. font-weight: bold;
  327. color: #333333;
  328. }
  329. }
  330. .upload {
  331. margin-top: 20rpx;
  332. padding: 34rpx 30rpx 40rpx 30rpx;
  333. background: #ffffff;
  334. }
  335. .bottom {
  336. position: fixed;
  337. bottom: 0;
  338. background: #ffffff;
  339. width: 750rpx;
  340. height: 146rpx;
  341. justify-content: flex-start;
  342. .bottom-item {
  343. margin-left: 30rpx;
  344. display: flex;
  345. flex-direction: column;
  346. align-items: center;
  347. .bi-image {
  348. width: 38rpx;
  349. height: 34rpx;
  350. }
  351. .bottom-font {
  352. margin-top: 14rpx;
  353. font-size: 24rpx;
  354. font-family: PingFang SC;
  355. font-weight: bold;
  356. color: #333333;
  357. }
  358. .bottom-num {
  359. line-height: 1;
  360. font-size: 24rpx;
  361. font-family: PingFang SC;
  362. font-weight: bold;
  363. color: #333333;
  364. }
  365. }
  366. .shu {
  367. margin-left: 20rpx;
  368. width: 2px;
  369. height: 74rpx;
  370. background: #c0bfc0;
  371. }
  372. .btn {
  373. margin-left: 20rpx;
  374. width: 570rpx;
  375. height: 80rpx;
  376. background: #fd3b39;
  377. border-radius: 20rpx;
  378. text-align: center;
  379. font-size: 34rpx;
  380. font-family: PingFang SC;
  381. font-weight: bold;
  382. color: #ffffff;
  383. line-height: 80rpx;
  384. }
  385. }
  386. // 文章页底部高度撑开
  387. .contentBottomHeight {
  388. height: 150rpx;
  389. }
  390. .popup-box {
  391. width: 522rpx;
  392. height: 605rpx;
  393. background-color: #ffffff;
  394. border-radius: 20rpx;
  395. position: relative;
  396. .img {
  397. position: relative;
  398. top: -56rpx;
  399. left: 0;
  400. width: 522rpx;
  401. height: 132rpx;
  402. display: flex;
  403. justify-content: center;
  404. image {
  405. border-radius: 20rpx 20rpx 0 0;
  406. width: 450rpx;
  407. height: 132rpx;
  408. }
  409. }
  410. .mian {
  411. margin-top: -44rpx;
  412. display: flex;
  413. flex-direction: column;
  414. align-items: center;
  415. // padding: 32rpx 32rpx;
  416. background-color: #ffffff;
  417. border-radius: 0 0 20rpx 20rpx;
  418. text-align: center;
  419. .delivery {
  420. font-size: 40rpx;
  421. color: #333333;
  422. display: flex;
  423. align-items: center;
  424. flex-direction: column;
  425. .title {
  426. }
  427. image {
  428. margin-top: 48rpx;
  429. width: 172rpx;
  430. height: 160rpx;
  431. }
  432. }
  433. .nocancel {
  434. font-size: 32rpx;
  435. color: #333333;
  436. margin-top: 14rpx;
  437. }
  438. .comfirm-box {
  439. margin-top: 52rpx;
  440. display: flex;
  441. // margin-bottom: 32rpx;
  442. // justify-content: space-around;
  443. .cancel {
  444. display: flex;
  445. align-items: center;
  446. justify-content: center;
  447. width: 197rpx;
  448. height: 74rpx;
  449. border: 1px solid #dcc786;
  450. border-radius: 38rpx;
  451. font-size: 32rpx;
  452. color: #605128;
  453. }
  454. .comfirm {
  455. margin-left: 32rpx;
  456. display: flex;
  457. align-items: center;
  458. justify-content: center;
  459. width: 197rpx;
  460. height: 74rpx;
  461. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  462. border-radius: 38px;
  463. font-size: 32rpx;
  464. color: #605128;
  465. }
  466. }
  467. }
  468. }
  469. </style>