commodityDetails.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. <template>
  2. <view>
  3. <view style="width: 100%;height: 750rpx;">
  4. <image :src="form.filesList[0].url" mode="aspectFit" style="width: 100%;height: 750rpx;"
  5. @click="previewImage()" />
  6. </view>
  7. <view style="background-color: #fff;padding: 43rpx 65rpx;margin-bottom: 20rpx;">
  8. <view style="display: flex;justify-content: space-between;">
  9. <view style="display: flex;color: #E75F37;font-size: 40rpx;align-items: flex-end;">
  10. <view style="font-size: 26rpx;height: 40rpx;">
  11. </view>
  12. <view style="font-size: 40rpx;">
  13. {{ checkStatus == '通过' ? form.mallPrice|| 0 :'***'}}
  14. </view>
  15. </view>
  16. <view style="display: flex;align-items: center;">
  17. <view style="display: flex;margin-right: 10rpx;">
  18. <image v-if="Number(inventoryDataForm.storeInventory)" src="/static/images/tabBar/11.png" v-show="showIcon"
  19. mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  20. <image v-if="Number(inventoryDataForm.storeInventory)==0" src="/static/images/tabBar/14.png" v-show="showIcon"
  21. mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  22. <view style="font-size: 24rpx;color: #C4C4C4;margin-left: 10rpx;">
  23. 库存:{{ inventoryDataForm.storeInventory ? Number(inventoryDataForm.storeInventory) > 10 ? '充足' : inventoryDataForm.storeInventory : '' }}
  24. </view>
  25. </view>
  26. <view style="display: flex;align-items: center;">
  27. <image v-if="Number(inventoryDataForm.storeInventoryShare)" src="/static/images/tabBar/12.png" v-show="showIcon"
  28. mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  29. <image v-if="Number(inventoryDataForm.storeInventoryShare)==0" v-show="showIcon"
  30. src="/static/images/tabBar/15.png" mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  31. <view style="font-size: 24rpx;color: #C4C4C4;margin-left: 10rpx;">
  32. 库存:{{ inventoryDataForm.storeInventoryShare ? Number(inventoryDataForm.storeInventoryShare) > 10 ? '充足' : inventoryDataForm.storeInventoryShare : '' }}
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="retailPrice" v-if="form.suggestedRetailPrice">
  38. 建议零售价:¥{{form.suggestedRetailPrice}}
  39. </view>
  40. <view style="margin-top: 14rpx;">
  41. <u--text :text="form.cname" size="26rpx" color='#797979' lines="2"></u--text>
  42. </view>
  43. <view style="display: flex;justify-content: space-between;margin-top: 8rpx;align-items: center;">
  44. <view style="font-size: 24rpx;color: #C4C4C4;">
  45. 库存:{{ form.inventory ? Number(form.inventory) > 10 ? '充足' : form.inventory : '' }}
  46. </view>
  47. <u-number-box v-model="form.goodsNum" :min="1" :max="form.inventory" buttonSize="53rpx" color="#414141"
  48. bgColor="#fff" iconStyle="color:#A4A4A4"></u-number-box>
  49. </view>
  50. <view style="display: flex;;margin-top: 8rpx;align-items:center;" v-for="(item, index) in inventoryData"
  51. :key="index">
  52. <view style="display: flex;align-items: center;">
  53. <view style="border-radius: 10rpx;border: 2rpx solid #F6744D;font-size: 26rpx;color: #E75F37;">
  54. {{item.storageName}}
  55. </view>
  56. <view style="font-size: 24rpx;color: #C4C4C4;margin-left: 35rpx;">
  57. 库存:{{Number(item.storeInventory) > 10 ? '充足' : Number(item.storeInventory)}}
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <view style="background-color: #fff;padding:62rpx 62rpx 37rpx 62rpx;margin-bottom: 20rpx;">
  63. <view style="font-weight: 400;font-size: 26rpx;color: #797979;" v-show="arrow">
  64. <view style="display: flex;justify-content: space-between;">
  65. <view>
  66. 规格型号:{{ form.specificationAndModel||'-' }}
  67. </view>
  68. <view>
  69. 花纹:{{ form.brandItem || '-' }}
  70. </view>
  71. </view>
  72. <view style="display: flex;justify-content: space-between;margin-top: 52rpx;">
  73. <view>
  74. 产地:{{ form.placeProduction || '-' }}
  75. </view>
  76. <view>
  77. 防爆:{{ form.explosionProof == 1 ? "是" : "否" }}
  78. </view>
  79. </view>
  80. <view style="display: flex;justify-content: space-between;margin-top: 52rpx;">
  81. <view>
  82. 原厂:{{ form.originalFactory == 1 ? '是' : '否' }}
  83. </view>
  84. <view>
  85. 自修复:{{ form.selfRecovery == 1 ? '是' : '否' }}
  86. </view>
  87. </view>
  88. <view style="display: flex;justify-content: space-between;margin-top: 52rpx;">
  89. <view>
  90. 商品描述:{{ form.goodsDescription || '-' }}
  91. </view>
  92. </view>
  93. </view>
  94. <view style="display: flex;justify-content: center;margin-top: 49rpx;" @click="arrow = !arrow">
  95. <image v-if="arrow" src="/static/images/tabBar/10.png" mode="aspectFit"
  96. style="width: 33rpx;height: 26rpx;" />
  97. <image v-if="!arrow" src="/static/images/tabBar/10.png" mode="aspectFit"
  98. style="width: 33rpx;height: 26rpx;transform: rotate(180deg)" />
  99. </view>
  100. </view>
  101. <view style="background-color: #fff;padding:40rpx 62rpx;margin-bottom: 20rpx;">
  102. <view style="font-weight: 400;font-size: 30rpx;color: #F6744D;">
  103. 商品详情
  104. </view>
  105. </view>
  106. <view style="width: 100%;background-color: #fff;">
  107. <view v-html="form.detailsText"></view>
  108. </view>
  109. <view class="text-bottom">
  110. </view>
  111. <view style="width: 100%;position: fixed;bottom: 0;background-color: #fff;border-top:2rpx #F2F2F2 solid;"
  112. class="dynamic-bottom">
  113. <view style="display: flex;justify-content: space-around;align-items: center;">
  114. <view style="width: 71rpx;display: flex;flex-direction: column;align-items: center;"
  115. @click="shoppingCart">
  116. <view class="">
  117. <image src="/static/images/tabBar/16.png" mode="aspectFit"
  118. style="width: 31rpx;height: 28rpx;" />
  119. </view>
  120. <view style="font-size: 24rpx;color: #797979;">
  121. 购物车
  122. </view>
  123. </view>
  124. <view style="width:360rpx;">
  125. <u-button v-if="form.inventory > 0" type="primary" @click="placeAnOrder" text="加入购物车"
  126. color="#E75F37" shape='circle'></u-button>
  127. <u-button v-if="form.inventory == 0" type="primary" @click="soldOut" text="已售罄" color="#c8c9cc"
  128. shape='circle'></u-button>
  129. </view>
  130. </view>
  131. </view>
  132. <!-- 提取去登录 -->
  133. <u-modal :show="adminShow" :showCancelButton="true" content='当前还未登录请先登录!!' @confirm="adminConfirm"
  134. @cancel="adminShow = false"></u-modal>
  135. </view>
  136. </template>
  137. <script>
  138. import {
  139. appDetail,
  140. appDetailNew,
  141. addToCart,
  142. appModifyPrice,
  143. stockDescListV1,
  144. listShareV1,
  145. getGoodsDetailStockByCloud,
  146. appDetailCloud,
  147. } from '@/api/tabBar/homeNew.js'
  148. import {isProcurement} from '@/api/tabBar/shoppingCart.js'
  149. export default {
  150. data() {
  151. return {
  152. inventoryDataForm: {},
  153. checkboxValue: [],
  154. form: {
  155. shareList: []
  156. },
  157. arrow: true,
  158. dataList: [],
  159. screen: {},
  160. columns: [],
  161. keyName: '',
  162. showWarehouse: false,
  163. dataForm: {
  164. thisLocality: {},
  165. offsite: {}
  166. },
  167. inventoryFalse: true,
  168. inventoryData: [],
  169. // 审核状态
  170. checkStatus: '',
  171. adminShow: false,
  172. cloudWarehouse: 0,
  173. showIcon: true
  174. }
  175. },
  176. onLoad(onLoad) {
  177. this.getIsShowIcon()
  178. this.checkStatus = uni.getStorageSync('checkStatus');
  179. isProcurement({
  180. "param": "cloud_warehouse"
  181. }).then(res => {
  182. this.cloudWarehouse = res.data ? Number(res.data) : 0
  183. if (this.cloudWarehouse === 1) {
  184. this.getCloudAppDetail(onLoad.id)
  185. } else {
  186. this.loadList(onLoad)
  187. }
  188. })
  189. },
  190. methods: {
  191. getIsShowIcon(){
  192. isProcurement({
  193. "param": "show.icon"
  194. }).then(res => {
  195. console.info('res-----', res)
  196. this.showIcon = Number(res.data) === 0
  197. })
  198. },
  199. loadList(onLoad){
  200. if (uni.getStorageSync('whether_openShare') == 1) {
  201. appDetailNew(onLoad).then(res => {
  202. this.dataForm = res.data
  203. if (res.data.type == 0) {
  204. this.form = res.data.thisLocality
  205. } else {
  206. this.form = res.data.offsite
  207. }
  208. this.form.goodsNum = Number(this.form.goodsNum)
  209. this.stockDescListfun()
  210. })
  211. } else {
  212. appDetail(onLoad).then(res => {
  213. this.dataForm = res.data
  214. if (res.data.type == 0) {
  215. this.form = res.data.thisLocality
  216. } else {
  217. this.form = res.data.offsite
  218. }
  219. this.form.goodsNum = Number(this.form.goodsNum)
  220. this.stockDescListfun()
  221. })
  222. }
  223. },
  224. loadByCloud(id) {
  225. getGoodsDetailStockByCloud(id).then(res => {
  226. this.inventoryData = res.data.weChatDetailStockVos
  227. this.inventoryDataForm.storeInventory = res.data.storeInventory
  228. this.inventoryDataForm.storeInventoryShare = res.data.storeInventoryShare
  229. })
  230. },
  231. getCloudAppDetail(id){
  232. appDetailCloud(id).then(res => {
  233. this.dataForm = res.data
  234. if (res.data.type == 0) {
  235. this.form = res.data.thisLocality
  236. } else {
  237. this.form = res.data.offsite
  238. }
  239. this.form.goodsNum = Number(this.form.goodsNum)
  240. this.loadByCloud(id)
  241. })
  242. },
  243. previewImage() {
  244. uni.previewImage({
  245. current: 0, // 当前显示图片的索引,默认是0
  246. urls: [this.form.filesList[0].url] // 需要预览的图片HTTP链接列表
  247. });
  248. },
  249. // admin确认
  250. adminConfirm() {
  251. uni.clearStorageSync();
  252. uni.redirectTo({
  253. url: '/pages/login/login'
  254. })
  255. },
  256. // 轮播图点击预览
  257. swiperclick(e) {
  258. let arr = this.form.filesList.map(item => {
  259. return item.url
  260. })
  261. uni.previewImage({
  262. count: arr[e],
  263. current: e,
  264. urls: arr
  265. })
  266. },
  267. inventoryFalsefun() {
  268. this.inventoryFalse = !this.inventoryFalse
  269. this.stockDescListfun()
  270. },
  271. // 库存查询
  272. stockDescListfun() {
  273. listShareV1({
  274. code: uni.getStorageSync('whether_openShare') == 1 ? this.form.goodsCode : this.form.code,
  275. id: this.form.id,
  276. whether: 0
  277. }).then(res => {
  278. this.inventoryDataForm = res.data
  279. })
  280. stockDescListV1({
  281. cname: this.form.cname,
  282. whether: 0
  283. }).then(res => {
  284. this.inventoryData = res.data.records
  285. })
  286. },
  287. soldOut() {
  288. uni.showToast({
  289. icon: "none",
  290. title: '商品已售罄',
  291. mask: true
  292. });
  293. },
  294. backToHome() {
  295. uni.$u.route({
  296. url: 'pages/tabBar/home',
  297. type: "switchTab"
  298. })
  299. },
  300. // 加入购物车
  301. placeAnOrder() {
  302. if (uni.getStorageSync('userInfo').tenant_id == '000000') {
  303. this.adminShow = true
  304. return
  305. }
  306. if (this.cloudWarehouse === 1) {
  307. uni.showLoading({
  308. title: '加载中',
  309. mask: true
  310. });
  311. addToCart({
  312. ...this.form,
  313. whetherIntegral: '0',
  314. detailsText: ''
  315. }).then(res => {
  316. uni.hideLoading();
  317. uni.showToast({
  318. title: "加入购物车成功",
  319. icon: "none",
  320. });
  321. }).catch(err => {
  322. uni.hideLoading();
  323. })
  324. return;
  325. }
  326. if (this.inventoryDataForm.storeInventory == 0 && this.inventoryDataForm.storeInventoryShare > 0) {
  327. let _this = this
  328. uni.showModal({
  329. title: '提示',
  330. content: '确实要购买次日达商品吗?',
  331. success: function(res) {
  332. if (res.confirm) {
  333. uni.showLoading({
  334. title: '加载中',
  335. mask: true
  336. });
  337. addToCart({
  338. ..._this.form,
  339. whetherIntegral: '0',
  340. detailsText: ''
  341. }).then(res => {
  342. uni.hideLoading();
  343. uni.showToast({
  344. title: "加入购物车成功",
  345. icon: "none",
  346. });
  347. }).catch(err => {
  348. uni.hideLoading();
  349. })
  350. }
  351. }
  352. });
  353. }
  354. if (this.inventoryDataForm.storeInventory > 0) {
  355. uni.showLoading({
  356. title: '加载中',
  357. mask: true
  358. });
  359. addToCart({
  360. ...this.form,
  361. whetherIntegral: '0',
  362. detailsText: ''
  363. }).then(res => {
  364. uni.hideLoading();
  365. uni.showToast({
  366. title: "加入购物车成功",
  367. icon: "none",
  368. });
  369. }).catch(err => {
  370. uni.hideLoading();
  371. })
  372. }
  373. },
  374. filterAll(screen) {
  375. this.screen = screen
  376. switch (screen[1]) {
  377. case "salesCompanyId":
  378. this.columns = [this.form.shareList]
  379. this.keyName = screen[1]
  380. this.showWarehouse = true
  381. break
  382. }
  383. },
  384. confirmWarehouse(e) {
  385. appModifyPrice({
  386. id: e.value[0].id
  387. }).then(res => {
  388. this.form.salesCompanyName = e.value[0].salesCompanyName
  389. this.form.salesCompanyId = e.value[0].salesCompanyId
  390. this.form.mallPrice = res.data.mallPrice
  391. this.form.inventory = res.data.inventory
  392. this.showWarehouse = false
  393. })
  394. },
  395. shoppingCart() {
  396. uni.$u.route({
  397. url: 'pages/tabBar/shoppingCart',
  398. type: "switchTab"
  399. })
  400. }
  401. }
  402. }
  403. </script>
  404. <style lang="scss" scoped>
  405. ::v-deep .u-number-box {
  406. border: 2rpx #E1E1E1 solid;
  407. border-radius: 8rpx;
  408. }
  409. ::v-deep .u-number-box__minus {
  410. border-right: 2rpx #E1E1E1 solid;
  411. }
  412. ::v-deep .u-number-box__plus {
  413. border-left: 2rpx #E1E1E1 solid;
  414. }
  415. ::v-deep .u-button {
  416. height: 60rpx;
  417. }
  418. .dynamic-bottom {
  419. padding: 20rpx 20rpx 0 20rpx;
  420. padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx);
  421. }
  422. .text-bottom {
  423. height: calc(env(safe-area-inset-bottom) + 126rpx);
  424. }
  425. .retailPrice {
  426. display: flex;
  427. color: #909399;
  428. font-size: 22rpx;
  429. height: 28rpx;
  430. }
  431. </style>