commodityDetails.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  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"
  19. mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  20. <image v-if="Number(inventoryDataForm.storeInventory)==0" src="/static/images/tabBar/14.png"
  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"
  28. mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  29. <image v-if="Number(inventoryDataForm.storeInventoryShare)==0"
  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. }
  174. },
  175. onLoad(onLoad) {
  176. isProcurement({
  177. "param": "cloud_warehouse"
  178. }).then(res => {
  179. this.cloudWarehouse = res.data ? Number(res.data) : 0
  180. if (this.cloudWarehouse === 1) {
  181. this.getCloudAppDetail(onLoad.id)
  182. } else {
  183. this.loadList(onLoad)
  184. }
  185. })
  186. },
  187. methods: {
  188. loadList(onLoad){
  189. this.checkStatus = uni.getStorageSync('checkStatus');
  190. if (uni.getStorageSync('whether_openShare') == 1) {
  191. appDetailNew(onLoad).then(res => {
  192. this.dataForm = res.data
  193. if (res.data.type == 0) {
  194. this.form = res.data.thisLocality
  195. } else {
  196. this.form = res.data.offsite
  197. }
  198. this.form.goodsNum = Number(this.form.goodsNum)
  199. this.stockDescListfun()
  200. })
  201. } else {
  202. appDetail(onLoad).then(res => {
  203. this.dataForm = res.data
  204. if (res.data.type == 0) {
  205. this.form = res.data.thisLocality
  206. } else {
  207. this.form = res.data.offsite
  208. }
  209. this.form.goodsNum = Number(this.form.goodsNum)
  210. this.stockDescListfun()
  211. })
  212. }
  213. },
  214. loadByCloud(id) {
  215. getGoodsDetailStockByCloud(id).then(res => {
  216. this.inventoryData = res.data.weChatDetailStockVos
  217. this.inventoryDataForm.storeInventory = res.data.storeInventory
  218. this.inventoryDataForm.storeInventoryShare = res.data.storeInventoryShare
  219. })
  220. },
  221. getCloudAppDetail(id){
  222. appDetailCloud(id).then(res => {
  223. this.dataForm = res.data
  224. if (res.data.type == 0) {
  225. this.form = res.data.thisLocality
  226. } else {
  227. this.form = res.data.offsite
  228. }
  229. this.form.goodsNum = Number(this.form.goodsNum)
  230. this.loadByCloud(id)
  231. })
  232. },
  233. previewImage() {
  234. uni.previewImage({
  235. current: 0, // 当前显示图片的索引,默认是0
  236. urls: [this.form.filesList[0].url] // 需要预览的图片HTTP链接列表
  237. });
  238. },
  239. // admin确认
  240. adminConfirm() {
  241. uni.clearStorageSync();
  242. uni.redirectTo({
  243. url: '/pages/login/login'
  244. })
  245. },
  246. // 轮播图点击预览
  247. swiperclick(e) {
  248. let arr = this.form.filesList.map(item => {
  249. return item.url
  250. })
  251. uni.previewImage({
  252. count: arr[e],
  253. current: e,
  254. urls: arr
  255. })
  256. },
  257. inventoryFalsefun() {
  258. this.inventoryFalse = !this.inventoryFalse
  259. this.stockDescListfun()
  260. },
  261. // 库存查询
  262. stockDescListfun() {
  263. listShareV1({
  264. code: uni.getStorageSync('whether_openShare') == 1 ? this.form.goodsCode : this.form.code,
  265. id: this.form.id,
  266. whether: 0
  267. }).then(res => {
  268. this.inventoryDataForm = res.data
  269. })
  270. stockDescListV1({
  271. cname: this.form.cname,
  272. whether: 0
  273. }).then(res => {
  274. this.inventoryData = res.data.records
  275. })
  276. },
  277. soldOut() {
  278. uni.showToast({
  279. icon: "none",
  280. title: '商品已售罄',
  281. mask: true
  282. });
  283. },
  284. backToHome() {
  285. uni.$u.route({
  286. url: 'pages/tabBar/home',
  287. type: "switchTab"
  288. })
  289. },
  290. // 加入购物车
  291. placeAnOrder() {
  292. if (uni.getStorageSync('userInfo').tenant_id == '000000') {
  293. this.adminShow = true
  294. return
  295. }
  296. if (this.inventoryDataForm.storeInventory == 0 && this.inventoryDataForm.storeInventoryShare > 0) {
  297. let _this = this
  298. uni.showModal({
  299. title: '提示',
  300. content: '确实要购买次日达商品吗?',
  301. success: function(res) {
  302. if (res.confirm) {
  303. uni.showLoading({
  304. title: '加载中',
  305. mask: true
  306. });
  307. addToCart({
  308. ..._this.form,
  309. whetherIntegral: '0',
  310. detailsText: ''
  311. }).then(res => {
  312. uni.hideLoading();
  313. uni.showToast({
  314. title: "加入购物车成功",
  315. icon: "none",
  316. });
  317. }).catch(err => {
  318. uni.hideLoading();
  319. })
  320. }
  321. }
  322. });
  323. }
  324. if (this.inventoryDataForm.storeInventory > 0) {
  325. uni.showLoading({
  326. title: '加载中',
  327. mask: true
  328. });
  329. addToCart({
  330. ...this.form,
  331. whetherIntegral: '0',
  332. detailsText: ''
  333. }).then(res => {
  334. uni.hideLoading();
  335. uni.showToast({
  336. title: "加入购物车成功",
  337. icon: "none",
  338. });
  339. }).catch(err => {
  340. uni.hideLoading();
  341. })
  342. }
  343. },
  344. filterAll(screen) {
  345. this.screen = screen
  346. switch (screen[1]) {
  347. case "salesCompanyId":
  348. this.columns = [this.form.shareList]
  349. this.keyName = screen[1]
  350. this.showWarehouse = true
  351. break
  352. }
  353. },
  354. confirmWarehouse(e) {
  355. appModifyPrice({
  356. id: e.value[0].id
  357. }).then(res => {
  358. this.form.salesCompanyName = e.value[0].salesCompanyName
  359. this.form.salesCompanyId = e.value[0].salesCompanyId
  360. this.form.mallPrice = res.data.mallPrice
  361. this.form.inventory = res.data.inventory
  362. this.showWarehouse = false
  363. })
  364. },
  365. shoppingCart() {
  366. uni.$u.route({
  367. url: 'pages/tabBar/shoppingCart',
  368. type: "switchTab"
  369. })
  370. }
  371. }
  372. }
  373. </script>
  374. <style lang="scss" scoped>
  375. ::v-deep .u-number-box {
  376. border: 2rpx #E1E1E1 solid;
  377. border-radius: 8rpx;
  378. }
  379. ::v-deep .u-number-box__minus {
  380. border-right: 2rpx #E1E1E1 solid;
  381. }
  382. ::v-deep .u-number-box__plus {
  383. border-left: 2rpx #E1E1E1 solid;
  384. }
  385. ::v-deep .u-button {
  386. height: 60rpx;
  387. }
  388. .dynamic-bottom {
  389. padding: 20rpx 20rpx 0 20rpx;
  390. padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx);
  391. }
  392. .text-bottom {
  393. height: calc(env(safe-area-inset-bottom) + 126rpx);
  394. }
  395. .retailPrice {
  396. display: flex;
  397. color: #909399;
  398. font-size: 22rpx;
  399. height: 28rpx;
  400. }
  401. </style>