creatStandard.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. <template>
  2. <view class="product">
  3. <view class="top"></view>
  4. <view class="head">
  5. <view class="handle">
  6. <view class="head_left">
  7. <span class="cuIcon-back" @click="back"></span>
  8. </view>
  9. <span class="center">添加品牌标品</span>
  10. </view>
  11. <view class="search">
  12. <span class="cuIcon-search"></span>
  13. <!-- <input @blur="InputBlur" :adjust-position="false" type="text" placeholder="请输入关键词" confirm-type="search"> -->
  14. <u-input v-model="productName" />
  15. </input>
  16. <view class="search_btn" @click.stop="getProductList">
  17. <span></span>搜索
  18. </view>
  19. </view>
  20. </view>
  21. <view class="list">
  22. <view class="product_item" v-for="(item,index) in productList" :key="index" >
  23. <view class="details">
  24. <view class="img">
  25. <image :src="item.productImage" mode=""></image>
  26. </view>
  27. <view class="data">
  28. <span>{{item.productName}}</span>
  29. <!-- <span>售卖时间:{{item.time}}</span> -->
  30. <view class="repertory">售卖时间:{{item.saleStartDate}} - {{ item.saleEndDate }}</view>
  31. <view class="price">
  32. <span style="font-size: 22rpx;margin: 0px;">¥</span>{{item.soldPrice}}
  33. <span style="color:#999 ;font-size: 22rpx; text-decoration: line-through;">¥{{item.price}}</span>
  34. </view>
  35. </view>
  36. <view class="tag" @click.stop="select(item)">
  37. <!-- <span>组合套餐</span>
  38. <span class="frame"></span> -->
  39. <image src="/static/product/select.png" mode="" v-if="item.select"></image>
  40. <image src="/static/product/round.png" mode="" v-else></image>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="creat">
  46. <view class="operate" >
  47. <view class="all" @click="allSelect">
  48. <image src="/static/product/select.png" mode="" v-if="isAll"></image>
  49. <image src="/static/product/round.png" mode="" v-else></image>
  50. 全选
  51. </view>
  52. <view class="delete delist" @click="add()" >确认添加</view>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import configService from '../../common/service/config.service'
  59. export default {
  60. data() {
  61. return {
  62. isManage: false,
  63. currentIndex: 0,
  64. productStatus: 0, //商品状态,默认1售卖中,0未上架,2审核中,3未通过
  65. isAll: false,
  66. canBeDelete: true,
  67. productName: '',
  68. productList: [],
  69. merchantId: '',
  70. productHandleList: [],
  71. tabIndex:1
  72. }
  73. },
  74. methods: {
  75. //返回
  76. back() {
  77. uni.navigateTo({
  78. url: '/pages/product/index'
  79. })
  80. },
  81. handleClear() {
  82. this.getProductList()
  83. // 这里可以添加其他逻辑
  84. },
  85. //切换分类
  86. selectType(item, index) {
  87. if (!this.isManage) {
  88. this.currentIndex = index
  89. this.productStatus = item.code
  90. this.getProductList()
  91. }
  92. },
  93. add(){
  94. // this.productList.forEach((item => {
  95. // this.productHandleList.push(item.productId)
  96. // }))
  97. let ids = this.productHandleList.join(',')
  98. console.log(ids,8888888888);
  99. this.$http.get("/app/product/addPurveyorProduct?ids="+ ids+'&merchantId='+ this.merchantId )
  100. .then(res => {
  101. if (res.data.code == 200) {
  102. this.$tip.success(res.data.message ||'添加成功');
  103. this.back()
  104. }
  105. else{
  106. this.$tip.error(res.data.message);
  107. }
  108. })
  109. },
  110. select(item) {
  111. item.select = !item.select
  112. this.productHandleList.push(item.productId)
  113. },
  114. //全选
  115. allSelect() {
  116. if (this.isAll) {
  117. this.isAll = false
  118. this.productList.forEach(item => {
  119. item.select = false
  120. })
  121. } else {
  122. this.isAll = true
  123. this.productList.forEach(item => {
  124. item.select = true
  125. })
  126. }
  127. },
  128. getProductList() {
  129. this.$http.get("/app/product/purveyor/list?merchantId=" + this.merchantId + "&productStatus=" + this.productStatus +
  130. '&productName=' + this.productName, )
  131. .then(res => {
  132. if (res.data.code == 200) {
  133. res.data.result.records.forEach((item) => {
  134. item.select = false;
  135. item.saleEndDate= item.saleEndDate.includes('00:00:00')?item.saleEndDate.slice(0,10): item.saleEndDate
  136. item.saleStartDate= item.saleStartDate.includes('00:00:00')?item.saleStartDate.slice(0,10): item.saleStartDate
  137. item.productImage=configService.apiUrl +'/'+ item.productImage
  138. })
  139. this.productList = res.data.result.records
  140. }
  141. })
  142. },
  143. },
  144. onShow() {
  145. let that = this
  146. uni.getStorage({
  147. key: 'login_user_info',
  148. success: function(res) {
  149. that.merchantId = res.data.merchantId
  150. }
  151. })
  152. uni.removeStorage({
  153. key: 'smdate',
  154. });
  155. uni.removeStorage({
  156. key: 'group',
  157. });
  158. this.getProductList()
  159. }
  160. }
  161. </script>
  162. <style lang="scss" scoped>
  163. .product {
  164. width: 100%;
  165. height: 100vh;
  166. display: flex;
  167. flex-direction: column;
  168. justify-content: space-between;
  169. background: #F7F8FC;
  170. .top {
  171. width: 100%;
  172. height: var(--status-bar-height);
  173. background: linear-gradient(87deg, #FFFFFF 0%, #A3CDFF 100%), linear-gradient(360deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%);
  174. }
  175. .head {
  176. width: 100%;
  177. background: #ffffff;
  178. .handle {
  179. height: 112rpx;
  180. display: flex;
  181. justify-content: space-between;
  182. align-items: center;
  183. padding: 0px 24rpx;
  184. position: relative;
  185. background: linear-gradient(87deg, #FFFFFF 0%, #A3CDFF 100%), linear-gradient(360deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%);
  186. .head_left {
  187. font-size: 40rpx;
  188. }
  189. .center {
  190. position: absolute;
  191. left: 50%;
  192. top: 50%;
  193. transform: translate(-50%, -50%);
  194. font-size: 36rpx;
  195. font-weight: 600;
  196. }
  197. .head_right {
  198. display: flex;
  199. justify-content: space-between;
  200. align-items: center;
  201. span {
  202. width: 40rpx;
  203. height: 40rpx;
  204. display: flex;
  205. justify-content: center;
  206. align-items: center;
  207. }
  208. .manage {
  209. // width: 150rpx;
  210. margin-left: 28rpx;
  211. }
  212. }
  213. }
  214. .search {
  215. width: 93%;
  216. height: 56rpx;
  217. background: #F7F8FC;
  218. border-radius: 12rpx;
  219. display: flex;
  220. align-items: center;
  221. justify-content: space-between;
  222. margin: 24rpx auto;
  223. font-size: 26rpx;
  224. padding: 13rpx 20rpx;
  225. span {
  226. margin-right: 15rpx;
  227. }
  228. input {
  229. flex: 1;
  230. font-size: 26rpx;
  231. }
  232. .search_btn {
  233. width: 72rpx;
  234. color: #333333;
  235. display: flex;
  236. align-items: center;
  237. justify-content: space-between;
  238. span {
  239. display: block;
  240. width: 1px;
  241. height: 26rpx;
  242. background-color: #eeeeee;
  243. }
  244. }
  245. }
  246. .type {
  247. display: flex;
  248. justify-content: space-between;
  249. background-color: #fff;
  250. padding: 8px 24rpx 16rpx;
  251. .type_item {
  252. height: 54rpx;
  253. display: flex;
  254. justify-content: center;
  255. align-items: center;
  256. font-size: 26rpx;
  257. color: #888888;
  258. position: relative;
  259. padding: 8rpx 12rpx;
  260. background: #F2F3F5;
  261. border-radius: 8rpx;
  262. }
  263. .active {
  264. color: #2D88F4;
  265. background: #ECF5FF;
  266. }
  267. }
  268. }
  269. .list {
  270. width: 100%;
  271. flex: 1;
  272. // padding: 0px 20rpx;
  273. overflow-y: auto;
  274. .product_item {
  275. width: 100%;
  276. background-color: #fff;
  277. border-radius: 20rpx;
  278. padding: 20rpx 40rpx;
  279. margin-top: 20rpx;
  280. .status {
  281. display: flex;
  282. align-items: center;
  283. .round {
  284. display: flex;
  285. align-items: center;
  286. color: #49A03F;
  287. }
  288. .round::before {
  289. content: "";
  290. display: inline-block;
  291. width: 9rpx;
  292. height: 9rpx;
  293. background: #49A03F;
  294. border-radius: 50%;
  295. margin-right: 8rpx;
  296. }
  297. .no {
  298. color: #666666;
  299. }
  300. .no::before {
  301. content: "";
  302. display: inline-block;
  303. width: 9rpx;
  304. height: 9rpx;
  305. background: #666666;
  306. border-radius: 50%;
  307. margin-right: 8rpx;
  308. }
  309. .audit {
  310. display: flex;
  311. align-items: center;
  312. color: #596ABB;
  313. }
  314. .audit::before {
  315. content: "";
  316. display: inline-block;
  317. width: 9rpx;
  318. height: 9rpx;
  319. background: #596ABB;
  320. border-radius: 50%;
  321. margin-right: 8rpx;
  322. }
  323. .reject {
  324. display: flex;
  325. align-items: center;
  326. color: #F55D65;
  327. }
  328. .reject::before {
  329. content: "";
  330. display: inline-block;
  331. width: 9rpx;
  332. height: 9rpx;
  333. background: #F55D65;
  334. border-radius: 50%;
  335. margin-right: 8rpx;
  336. }
  337. .line {
  338. display: block;
  339. width: 1rpx;
  340. height: 20rpx;
  341. background: #d9d9d9;
  342. margin: 0 12rpx;
  343. }
  344. }
  345. .details {
  346. width: 100%;
  347. height: auto;
  348. min-height: 132rpx;
  349. height: 132rpx;
  350. display: flex;
  351. align-items: center;
  352. margin-top: 20rpx;
  353. .img {
  354. margin-right: 16rpx;
  355. border-radius: 12rpx;
  356. overflow: hidden;
  357. image {
  358. width: 132rpx;
  359. height: 132rpx;
  360. }
  361. }
  362. .data {
  363. flex: 1;
  364. height: 100%;
  365. display: flex;
  366. flex-direction: column;
  367. justify-content: space-between;
  368. font-weight: 600;
  369. font-style: 28rpx;
  370. .repertory {
  371. font-size: 24rpx;
  372. display: flex;
  373. align-items: center;
  374. color: #8A91A8;
  375. font-weight: 400;
  376. margin: 6rpx 0 10rpx 0;
  377. }
  378. .price {
  379. display: flex;
  380. align-items: center;
  381. font-size: 30rpx;
  382. font-weight: 600;
  383. span {
  384. font-size: 26rpx;
  385. margin-left: 20rpx;
  386. font-weight: 400;
  387. }
  388. }
  389. }
  390. .tag {
  391. width: 40rpx;
  392. height: 40rpx;
  393. display: flex;
  394. flex-direction: column;
  395. align-items: center;
  396. image {
  397. width: 40rpx;
  398. height: 40rpx;
  399. }
  400. }
  401. }
  402. .btn_box {
  403. width: 100%;
  404. display: flex;
  405. justify-content: flex-end;
  406. align-items: center;
  407. margin-top: 20rpx;
  408. .delist {
  409. width: 100rpx;
  410. height: 50rpx;
  411. border-radius: 8rpx;
  412. border: 1px solid #CCCCCC;
  413. display: flex;
  414. justify-content: center;
  415. align-items: center;
  416. font-size: 26rpx;
  417. color: #666666;
  418. }
  419. .edit {
  420. margin-left: 20rpx;
  421. background: rgba(68, 154, 255, 0.05);
  422. border: 1px solid #449AFF;
  423. color: #449AFF;
  424. }
  425. }
  426. }
  427. }
  428. .creat {
  429. width: 100%;
  430. height: 100rpx;
  431. background-color: #fff;
  432. display: flex;
  433. justify-content: center;
  434. align-items: center;
  435. .btn {
  436. width: 672rpx;
  437. height: 76rpx;
  438. display: flex;
  439. justify-content: center;
  440. align-items: center;
  441. background: linear-gradient(90deg, #77B6FF 0%, #449AFF 100%);
  442. border-radius: 75rpx;
  443. font-size: 28rpx;
  444. color: #FFFFFF;
  445. image {
  446. width: 40rpx;
  447. height: 40rpx;
  448. margin-right: 10rpx;
  449. }
  450. }
  451. .operate {
  452. width: 100%;
  453. display: flex;
  454. // justify-content: space-between;
  455. align-items: center;
  456. padding: 0px 20rpx;
  457. justify-content: space-between;
  458. .delete {
  459. width: 205rpx;
  460. height: 76rpx;
  461. background: linear-gradient(90deg, #77B6FF 0%, #449AFF 100%);
  462. border-radius: 49rpx;
  463. font-size: 28rpx;
  464. color: #FFFFFF;
  465. display: flex;
  466. justify-content: center;
  467. align-items: center;
  468. margin-right: 24rpx;
  469. margin-left: 140rpx;
  470. }
  471. .delist {
  472. margin-left: 0rpx;
  473. background: linear-gradient(90deg, #FFA05B 0%, #FF7918 100%);
  474. }
  475. .all {
  476. width: 25%;
  477. // height: 60rpx;
  478. // border: 1px solid #999;
  479. display: flex;
  480. justify-content: center;
  481. align-items: center;
  482. image {
  483. width: 40rpx;
  484. height: 40rpx;
  485. margin-right: 10rpx;
  486. }
  487. }
  488. }
  489. }
  490. .popup {
  491. width: 100vw;
  492. height: 100vh;
  493. position: fixed;
  494. top: 0;
  495. left: 0;
  496. background: rgba(0, 0, 0, 0.4);
  497. display: flex;
  498. align-items: center;
  499. justify-content: center;
  500. .content {
  501. width: 570rpx;
  502. background: #FFFFFF;
  503. border-radius: 16rpx;
  504. padding: 0px 24rpx;
  505. padding-bottom: 16rpx;
  506. .title {
  507. width: 100%;
  508. height: 86rpx;
  509. font-size: 32rpx;
  510. color: #333333;
  511. font-weight: 600;
  512. border-bottom: 1px solid #EEEEEE;
  513. display: flex;
  514. align-items: center;
  515. justify-content: center;
  516. }
  517. .center {
  518. font-size: 30rpx;
  519. color: #333333;
  520. line-height: 35rpx;
  521. display: flex;
  522. flex-direction: column;
  523. align-items: center;
  524. justify-content: center;
  525. padding-top: 28rpx;
  526. border-bottom: 1px solid #EEEEEE;
  527. padding-bottom: 40rpx;
  528. margin-bottom: 16rpx;
  529. .error {
  530. text-align: center;
  531. }
  532. image {
  533. width: 100rpx;
  534. height: 100rpx;
  535. margin-bottom: 10rpx;
  536. }
  537. }
  538. .sub {
  539. width: 320rpx;
  540. height: 68rpx;
  541. border-radius: 66rpx;
  542. font-size: 28rpx;
  543. color: #FFFFFF;
  544. display: flex;
  545. align-items: center;
  546. justify-content: center;
  547. margin: 0rpx auto;
  548. .button {
  549. width: 320rpx;
  550. height: 68rpx;
  551. background: #449AFF;
  552. border-radius: 66rpx;
  553. display: flex;
  554. align-items: center;
  555. justify-content: center;
  556. }
  557. }
  558. .start {
  559. background: #53CC48;
  560. }
  561. .rest {
  562. background: #FF8024;
  563. }
  564. }
  565. }
  566. }
  567. .tab-container {
  568. display: flex;
  569. justify-content: space-around;
  570. .tab-item {
  571. position: relative;
  572. padding: 18rpx 0;
  573. cursor: pointer;
  574. color: #333;
  575. font-weight: 400;
  576. font-size: 28rpx;
  577. }
  578. .tab-item.active {
  579. color: #449AFF;
  580. font-weight: 600;
  581. }
  582. .tab-item.active::after {
  583. content: '';
  584. position: absolute;
  585. bottom: -28px;
  586. left: 35%;
  587. width: 38rpx;
  588. height: 100%;
  589. background: url(/static/product/tab-act.png) no-repeat;
  590. background-size: contain;
  591. }
  592. }
  593. </style>